They actually exist in the scenes, but I don’t want to have an effect on them, so maybe there could be copies? And how do I do the subtraction operation?
Two things first:
Sketchup doesn’t have a “solid face” definition. A solid (called “manifold” in Ruby API) is a 3D object (group or component instance) that is “watertight”. (You can find a lot of topic about definition of “solid” in this forum.) You can not apply .subtract
method to faces, it does not exist for faces.
You have a model, regardless of whether you created Scene(s) or not.
Scenes help you save different model views and properties. You can then present those views to show off different aspects of your model. Scene(s) represent different viewports, perspectives, styles, and visiblities of different entities and tags…of the same model. (in other words, all drawingelelmets are exist in a all scenes, but may not visible on all.)
_
I think what you mean by subtraction is that there is a face in the model and another one inside it, so you want to create a “hole” in the first one by “subtracting” the second one from the first one.
Well, in Ruby you have to do it in a similar way to the UI. You have to somehow determine which of the two faces in question are there. And which one of them is “outside” and which one “contains” the other. Then you have to delete the face, which is “inside.”
Please elaborate more (screenshots, modell…) what would you like to achieve.
If I understand correctly, the triangle and the quadrilateral are not on the same plane. There is no point in talking about subtraction, because the intersection is an edge.
These are the ways that come to mind to get it:
The intersect_plane_plane method is used to compute the intersection of two planes.
The intersect_line_plane method is used to compute the intersection of a line and a plane.
The intersect_line_line computes the intersection of two lines.
There is a clarification. Plane “a” is parallel to plane “b”. It is necessary to get a “top projection”, i.e. the same thing that the user sees in the top view. I am currently creating solid objects of the same height from faces. I move it to one level and subtract it. Then I leave the upper faces of the object, and delete the rest. Is there an easier way?
I don’t know if it’s easier, but you can copy each face into a group move them to the same height, and intersect their entities using:
Then filter the resultant edge array to hold only those edges that have both endpoints in common with one of the other array members. The filtered set should be the sides of a polygon representing what to subtract.
The SketchUp APIs lack collision detection both 3D and 2D. But there may be some gems or C libraries out there that could be usable.