ScriptSpot

Forum topic · General Scripting

boolean code error

By dussla · 2021-03-06

Description

sorry ~ many ask ~

i made this code too
this is boolean code about selected face

i tested many times

but i dont know error problem well
pls teach again ~~~

bigbox = selection[1]

faces_sel=polyOp.getFaceSelection selection[1];
polyOp.detachFaces selection[1] faces_sel delete:false asNode:true name:"newface"

smallface = copy $newface ;delete $newface

converttopoly smallface

polyop.extrudefaces smallface (polyop.getfaceselection smallface) (-100)

snapMode.active=false

ProBoolean.createBooleanObjects bigbox smallface 2 0 0
ProBoolean.SetPlanarEdgeRemoval bigbox 3

Comments (5)

.

jahman · 2021-03-06

Try to cap holes of the extracted mesh and flip its normals before performing boolean operations

hahaha . ok thank you

dussla · 2021-03-06

i will try
really thank you again ~~

tested , but still error

dussla · 2021-03-06

i tested~ but still error
pls what problem ?

bigbox = selection[1]

faces_sel=polyOp.getFaceSelection selection[1];
polyOp.detachFaces selection[1] faces_sel delete:false asNode:true name:"newface"

smallface = copy $newface ;delete $newface

converttopoly smallface

converttopoly bigbox

polyop.extrudefaces smallface (polyop.getfaceselection smallface) (-100)

snapMode.active=false
select smallface

modPanel.addModToSelection (Cap_Holes ()) ui:on
modPanel.addModToSelection (Normalmodifier ()) ui:on

ProBoolean.createBooleanObjects bigbox smallface 2 0 0
ProBoolean.SetPlanarEdgeRemoval bigbox 3

--boolObj.createBooleanObject bigbox

--boolObj.setBoolOp bigbox 3
--boolObj.SetOperandB bigbox smallface 4 2

Attachments

.

jahman · 2021-03-06

I didn't test it on your scene file. Script kinda works on my test geometry, so these errors you're having are most likely geometry/topology/selection dependent. I don't know what you can do about that. As a general rule you'd better stay away from using boolean as long as you can.

These two lines certainly make no sense. First you make a copy of $newface object and then delete $newface object for no reason.


smallface = copy $newface
delete $newface

thank you again ~~

dussla · 2021-03-07

Thanks for good advice
The script works fine
But sometimes an error occurs
It doesn’t produce a clean and clean result.
Like you said, it's better not to use it.
Thank you~~