Home
Reply
Contributor
ericteng
Posts: 10

Trim a body with a plane

 
Hi guys,
 
could anyone tell me how to trim a body, e.g. cylinder with a plane in Scheme? Here I create a cylinder as an example, but the body can be a body with a single shell that has many faces.
 
e.g: I create a cylinder
           (solid:cylinder (position 10 10 0) (position 10 10 30) 15)
Now I trim this cylinder with a plane:
          (face:plane (position -5 -5 10) 100 100 (gvector 0.21 0.21 0.9))
 
I may not give the right commands here. But what I want is to chop the cylinder above a certain height. I can create another block, and do the subtraction, but I think there should be a easy way to do that in Scheme.
 
Thanks for help.
Eric
 
Contributor
AlanC
Posts: 6

Re: Trim a body with a plane

Your best choice is to use a full solid, such as a block, that is exact on the face you want to trim and larger than needed on all other faces.  Theoretically, it is possible to do the subtraction with a one-sided sheet body, but this can result in unexpected surprises.  It is usually better to provide a fully defined solid.
 
This applies even if the cutting surface is not as simple as a plane.  We always define the desired cutting surface accurately and define a solid that is beyond the other faces of the solid to be cut by several orders of magnitude higher than resabs.  It may be a little extra work, but you are looking for consistency and speed in the subtraction.
Spatial Moderator
rbagley
Posts: 126

Re: Trim a body with a plane

Hi Eric,
 
Try bool:chop.
Contributor
ericteng
Posts: 10

Re: Trim a body with a plane

yes, bool:chop works. Thanks.