Copying multiple meshes at once

I'm trying to copy and rotate all meshes that are in a certain layer. I already got the function to select everything in the layer but now I want to copy and rotate them. Can someone help me on how to get this working? This is what I currently have:

fn selectObjectsInLayer layer_name =
(
local nodes
(LayerManager.getLayerFromName layer_name).nodes &nodes
select nodes
)

fn RotateParts building =
(
selectObjectsInLayer "GeneratedParts"

a = instance $

rotate a (angleaxis 90 [0,0,1])
)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miauu's picture

.

(
	fn SelectObjectsInLayer layer_name =
	(
		local nodes
		(LayerManager.getLayerFromName layer_name).nodes &nodes
		nodes
	)	
 
	fn RotateParts =
	(
		--	"collect the objects in the layer. No need to select them"
		objsInLayerArr = SelectObjectsInLayer "GeneratedParts"
		--	"create instances of all objects in the layer"
		instancedObjsArr = for o in objsInLayerArr collect (instance o)
		--	rotate the objects. Each object will be rotated individually
		rotate instancedObjsArr (angleaxis 90 [0,0,1])
	)
	RotateParts()
)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.