MaxStudio Posted October 24, 2008 Share Posted October 24, 2008 Anyone know if there is a way to create a new layer or a set of layers using a script? Quote Link to comment
MullinRJ Posted October 24, 2008 Share Posted October 24, 2008 I'm not sure how you want your script to run, interactively or not, but it's not hard to cobble one together. The VS procedure Layer() will create a new design layer. Layer('New Layer Name'); The VS function CreateLayer() will create a new layer and returns a handle to the new layer, which can be ignored if you only want to create them. LayerHandle := Layer('Another Layer Name', 1);?????????{ 1 = Design Layer / 2 = Sheet Layer } Each new layer you create will be on top of all other layers visually, so you may want to create new layers in the reverse order you want them displayed in the layer pop-up menu. Raymond Quote Link to comment
MaxStudio Posted October 24, 2008 Author Share Posted October 24, 2008 yeah I'm trying to make a script that allows a user to create a new floor.... and gives them all the layers they need in the order that they need to be in. It will work sort of like what the program does all ready if you use 'Create Standard Viewport'. Except the viewport will not be setup. unless you know of anyone who has experience doing that too.. I once messed around with the actual program itself to get the 'Standard Viewports' to do what i wanted but I don't know if that is a good idea or just over complicated. Quote Link to comment
Pat Stanford Posted October 24, 2008 Share Posted October 24, 2008 Just a couple of clarifications on what Raymond said. Layer is used not just to create a new design layer, but also to change the active layer. If the name you pass already exists, it just changes the layer. It if does not exist, it creates a new layer and makes it active. The last example should be Layer := CreateLayer('Another Layer Name',1); (instead of Layer). In the Vectorscript Function Reference, set it to View by Class and scroll down to Layer to see all of the functions you can use to set the layer scale, stacking order, Layer Z height, etc. Pat Quote Link to comment
MaxStudio Posted October 24, 2008 Author Share Posted October 24, 2008 Great thanks Pat Quote Link to comment
MaxStudio Posted October 24, 2008 Author Share Posted October 24, 2008 ok i got this working but, i want the user to be able to type the name of the layer they want is it possible for that? VAR s:string; H1:handle; Begin s:= 'Hello'; H1 := CreateLayer(s,'RC Shade'', 1); End; Run(program) I get an error it doesn't like reading the 's' variable. it seems to only want 1 string and 1 integer. Quote Link to comment
MaxStudio Posted October 24, 2008 Author Share Posted October 24, 2008 ok i got it. I always seem to figure out the problem right after i posted the question. i just eliminated the 'RC Shade'... i'll have to define another string and then add the two together. S:String; Begin s:='Hello'; X:=s +'RC Shade'; H!:=CreateLayer(x,1); End; Run() Quote Link to comment
Pat Stanford Posted October 24, 2008 Share Posted October 24, 2008 Use: s:=StrDialog('Enter New Layer Name','New Layer Name'); Pat Quote Link to comment
MaxStudio Posted October 24, 2008 Author Share Posted October 24, 2008 that was much better thanks pat Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.