Jump to content
relume

change layer assignment of an object | moving object to an other layer?

Recommended Posts

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,

 

Share this post


Link to post

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

Share this post


Link to post

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,

 

 

 

 

Share this post


Link to post

Thank you! I'm new to scripting so I'll try work with this. Might need to repost for some help later. Cheers.

Share this post


Link to post

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...