ScriptSpot

Forum topic · General Scripting

Add Slice Modifier to the selected objects

By harumscarum · 2023-04-16

Description

what is the best way to add one Slice Modifier to the all selected objects with the Slice Plane set to Z=-100 and then Collapse them to EditableMesh

Comments (3)

Thank you!

harumscarum · 2023-04-17

Yeah, this works like a charm!
Could it add both Slice and UVW Mapping Clear Modifiers?

Thank you)

.

miauu · 2023-04-18

Try this:




(
	if selection.count != 0 do
	(
		sliceMod = sliceModifier()
		sliceMod.slice_plane.transform = matrix3 [1,0,0] [0,1,0] [0,0,1] [0,0,-100]
		
		uvwMappingClearmod = UVW_Mapping_Clear()
 
		for o in selection where validModifier o sliceMod do
		(
			addModifier o sliceMod
			addModifier o uvwMappingClearmod
			convertToMesh o
		)
	)
)

.

miauu · 2023-04-16

I am not sure that this is what you need:


(
	if selection.count != 0 do
	(
		sliceMod = sliceModifier()
		sliceMod.slice_plane.transform = matrix3 [1,0,0] [0,1,0] [0,0,1] [0,0,-100]
		
		for o in selection where validModifier o sliceMod do
		(
			addModifier o sliceMod
			convertToMesh o
		)
	)
)