Innerloop of an opening in a face created by a glued component


#1

Is there an easy way to get the innerloop of an opening in face created by a glued component? What i mean is, when you use a glued component to create a opening in a face and you look to the loops of the face, you can’t find the innerloop of the opening.


#2

It probably does not exist as <Sketchup::Entity> object in the model, just as some kind of virtual loop that is considered for rendering to the screen, but that can’t interact, merge, intersect with other entities.

One could search for entities inside the component definition that lay in the plane of the outside face, and form a closed loop (but not necessarily a SketchUp loop).
edges = entities.grep(Sketchup::Edge).select{ |e| e.on_plane?(plane) }
With plane transformed into the component definition’s coordinate system. Then find the largest loop…? But that takes quite many assumptions on SketchUp’s internal implementation on which loop is cut open, because from the Ruby API we cannot get any evidence.


#3

Yes, this is what I thought, but I hoped I missed something.


#4

I would be curious (haven’t tested yet) whether a raytest goes through the hole? It depends on whether raytest considers strictly entity objects or only geometry where it is visible (rendered).


#5

My HolePunch tool does this.
Look at its code.
It’s not possible without making some temporary geometry.


The steps are…
A temp group is made.
An instance of the cutting component defn is added at ORIGIN - in the instance’s [inst] parent.entities.
A flat circular face is added at ORIGIN with its radius = defn.bounds.diagonal.
The face is intersected with the group.entities.
The circle’s original edges are erased - auto-deleting the excess face[s] around the new cut-lines.
Now any edges in the group.entities, with edge.faces.length==1 define the ‘outer loop’.
You then collect those edges’ vertices, converting them into a 2 element array of points, into an array.
The temp group is erased.
You know the transformation of the original cutting component-instance, you use that to transform the pairs of points from the ORIGIN to the make a series of edges defining the cutting ‘loop’ in the context of the inst.glued_to face
You can then intersect those edges with that face to cut it.
You know the original face so you can readily get the new face[s].

If you don’t want physical edges make a unique array of the loop-edges vertices, turn them into points and transform them as before, but now use the array of points which define the cut-loop, as you will…

My tool then pushpulls the face[s] to the ‘parallel’ back face…
You can just delete if if that’s your bag…