Jump to content

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,

 

Link to comment
  • 9 months later...

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,

 

 

 

 

Link to comment

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.

×
×
  • Create New...