[Closed] Pro Cutter
Hi!
I am trying to write a script that slices an object along a plane with pro cutter. The code is the following:
object_source = #()
object_source = getCurrentSelection()
slice_plane = plane width:1 length:1 widthSegs:1 lengthSegs:1
slice_plane.position = [0,0,0]
ConvertTo slice_plane Editable_poly
slice_plane.tesselateBy=1 --switch to tesselate by face mode
slice_plane.tessTension = 100.0 --tension only works for edge mode, as with the UI?
polyOp.tessellatebyface slice_plane #all--selected face
newSeed = random 0 9999
plane_noise = NoiseModifier seed: newSeed scale: 100 fractal: true roughness: 0.995 iterations: 5 strength: [5.0,5.0,5.0] frequency: 0.25 phase: 0
addModifier slice_plane plane_noise
current_object = execute("$" + object_source[1].name + "")
ProCutter.CreateCutter slice_plane 4 true true false true true
ProCutter.AddStock slice_plane current_object 1 1
But I get the error “Unknown Property”AddStock” in ProCutter”. Can anyone help me? Thanks a lot.
Use brackets in Procutter
ProCutter.CreateCutter #(cutterObj) 3 true true false false false
ProCutter.AddStocks cutterObj #(stockObj) 3 1
Thanks for the answer. Now I have this code:
object_source = #()
object_source = getCurrentSelection()
slice_plane = plane width:100 length:100 widthSegs:1 lengthSegs:1
--slice_plane.position = [0,0,0]
ConvertTo slice_plane Editable_poly
theMod = tessellate facetype: 0 type:1 iterations:2
addmodifier slice_plane theMod
newSeed = random 0 9999
plane_noise = NoiseModifier seed: newSeed scale: 100 fractal: true roughness: 0.995 iterations: 10 strength: [5.0,5.0,5.0] frequency: 0.25 phase: 0
addModifier slice_plane plane_noise
current_object = execute("$" + object_source[1].name + "")
slice_plane.position = current_object.position
slice_plane.center = current_object.center
ProCutter.CreateCutter #(slice_plane) 4 true true false false false
ProCutter.AddStocks slice_plane #(current_object) 3 1
but I have the problem that when I select an object that should be sliced, it isn’t sliced by the script. Does anyone knows what the problem is?
It’s cutted but hold in one shape two elements.If you need to detach pieces automatic change this :
ProCutter.CreateCutter #(slice_plane) 4 true true false true true
Thanks for the fast answer, but it also doesn’t work. It only change the color
Thanks for the fast answer, but it also doesn’t work. It only change the color
I have tried to move pieces, but there is only one object in the end.
make change in second line from bottom in code from post #3 last two false to true, select obj, and run your script. and you’ll end up with 3 different objects – 2 parts and one cutter plane.
Hi I made the changes. So it looks like this:
macroscript slice_plane category: "test_scripts"
(
on execute do
(
object_source = #()
object_source = getCurrentSelection()
slice_plane = plane width:100 length:100 widthSegs:1 lengthSegs:1
--slice_plane.position = [0,0,0]
ConvertTo slice_plane Editable_poly
theMod = tessellate facetype: 0 type:1 iterations:2
addmodifier slice_plane theMod
newSeed = random 0 9999
plane_noise = NoiseModifier seed: newSeed scale: 100 fractal: true roughness: 0.995 iterations: 10 strength: [5.0,5.0,5.0] frequency: 0.25 phase: 0
addModifier slice_plane plane_noise
current_object = execute("$" + object_source[1].name + "")
ConvertTo current_object Editable_poly
slice_plane.position = current_object.position
slice_plane.center = current_object.center
ProCutter.CreateCutter slice_plane 4 true true false true true
ProCutter.AddStocks slice_plane current_object 4 1
)
)
but it doesn’t work. But when I comment the last two lines and make the cutting myself in 3ds max with the settings I make in the script, then it works. What can be wrong?