relume Posted May 16, 2018 Share Posted May 16, 2018 Hello I am wondering if there is an easy assignment command for objects to change layers as it is for classes (vs.setClass or vs.setClassN). Can it be true, that this should be only possible by duplicating the object first (by vs.CreateDuplicateObject) and thereafter deleting the original? In the VW GUI info-Palette with the appropriate pop-list the task seems more as an reasignment than a duplication (or a hidden cut/past operation). Many thanks in advance and best regrads, Quote Link to comment
Marionette Maven Marissa Farrell Posted May 16, 2018 Marionette Maven Share Posted May 16, 2018 vs.SetParent() will help you out with that. Quote Link to comment
relume Posted May 16, 2018 Author Share Posted May 16, 2018 Hello Oh many thanks for your prompt response that helps a lot! http://developer.vectorworks.net/index.php/VS:SetParent vs.SetParent(ObjectHandle, LayerHandle) best regards Quote Link to comment
Glenn17 Posted February 25, 2019 Share Posted February 25, 2019 Hi, Can you please put up the whole script start to finish? I've seen various posts on this but I can't customise SetParent to work. I'd be super grateful if you can do this! Thanks Quote Link to comment
relume Posted February 25, 2019 Author Share Posted February 25, 2019 Hello please find two scripts that I have created as part of libs: # use : assigns a new layer to object def object_layer_assign(vObject_Handle, vLayer_Destination_Name): vLayer_Destination_Handle = vs.GetLayerByName(vLayer_Destination_Name) if vLayer_Destination_Handle == None: vLayer_Actual_Handle = vs.ActLayer() vLayer_Actual_Name = vs.GetLName(vLayer_Actual_Handle) vs.Layer(vLayer_Destination_Name) vLayer_Destination_Handle = vs.ActLayer() vs.Layer(vLayer_Actual_Name) vs.SetParent(vObject_Handle, vLayer_Destination_Handle) and : # use : assigns a new layer to objects selected by criteria def object_layer_assign_criteria(vSelection_Criteria, vLayer_Destination_Name): vLayer_Destination_Handle = vs.GetLayerByName(vLayer_Destination_Name) if vLayer_Destination_Handle == None: vLayer_Actual_Handle = vs.ActLayer() vLayer_Actual_Name = vs.GetLName(vLayer_Actual_Handle) vs.Layer(vLayer_Destination_Name) vLayer_Destination_Handle = vs.ActLayer() vs.Layer(vLayer_Actual_Name) def object_layer_assign_iterator(vObject_Handle): vs.SetParent(vObject_Handle, vLayer_Destination_Handle) vs.ForEachObject(object_layer_assign_iterator, vSelection_Criteria) I hope they will be to your help, best regards, Quote Link to comment
Glenn17 Posted February 27, 2019 Share Posted February 27, 2019 Thank you! I'm new to scripting so I'll try work with this. Might need to repost for some help later. Cheers. 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.