Notifications
Clear all

[Closed] Slice Plane intersection

Hi, everyone!
I need to check, if Slice plane gizmo actually intersect any geometry (with the object this modifier is added to).

What’s the best way to do it? I don’t think I can use IntersectRay here, and it is sooo slow, I also was thinking using “fencePickNode”, but converting coords to viewport and doing some checks did not work well for me.

Maybe there are some other functions I can use and I did not know about?

8 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

in other words… do you want to know if the slice plane slices the geometry?

check trimesh topology (number of verts for example) before the modifier and after…

if you want to touch it with your own hands:
#1 make manipPlane using slice gizmo info (see manip.makePlaneFromNormal)
and
#2 check an intersection with all trimesh edges while meet the first one (see <manipPlane>.intersect)

Hmmm, thanks, good idea! I’ll try it out and see if it works.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

which of these two ideas is good? both of them work

i would pick the first one. slice means change the topology

Yes, the first one worked perfectly.

_vertexnow = OBJ.GetNumVertices()
																  modPanel.addModToSelection (sliceModifier ()) ui:on
																  OBJ.modifiers[1].slice_type = 1;
																	  
																	  
																  ConvertTo OBJ Editable_Poly  
																  _vertexafter = OBJ.GetNumVertices()
																  max undo 

Again, thanks a lot!

everything can be easier. you can make the check without opening modifiers panel and using undo:


   (
 	delete objects
 	b = box()
 	numverts = b.mesh.numverts
 	addmodifier b (modi = sliceModifier slice_type:1)
 	modi.slice_plane.position.z += b.height/2 
 	format "slice enabled:	% >> %
" numverts b.mesh.numverts
 	
 	modi.enabled = off
 	format "slice disabled:	% >> %
" numverts b.mesh.numverts
 )
 

Thank you, did not think that enable/disable will apply mech change instantly, now it will work much more faster