Duplicating and transforming geometry


#1

I followed (very helpful) advice by TIG to create and transform copies of certain faces in a model, by creating a temporary group,

sometrans = IDENTITY  # or something more complicated...
tmpgrp = Sketchup::active_model.entities.add_group(  [su_face] + su_face.edges )
newgrp = Sketchup::active_model.entities.add_instance( tmpgrp.definition, sometrans)
tmpgrp.explode

I’m dealing with faces that have both line and arc bounding loops. This technique greatly simplifies the transformation of all the face edges. But, it loses important information - when any of the edges are ArcCurves, they get turned into just plain line segments, so that the edge is no longer a single arc or circle, instead being the individual line segments.

How can I preserve the curve?

OK, so while I was typing I decided to try something, and the answer is simple. I had chosen to model the grouping above on what you would do from the Sketchup interface, namely select the face AND all its edges to make a group. But, if you change the call above to just

tmpgrp = Sketchup::active_model.entities.add_group(  [su_face] )

Then the copied loops correctly maintain the ArcCurve information. [Edit] This turns out to be incorrect. Under some conditions the “curve” information is lost. One case seems to be copying a face that has been pulled into a 3D solid, but the basic issue is that this technique does not guarantee the curve information will be maintained


#2

This is a rather common challenge. Could you file a feature request for new functionality to perform this?


#3

Um, I could. My immediate issue was that the original approach lost information, but the alternate approach works fine. I just wanted to document it.


#4

Filed as #41


#5

It turns out that copying using this approach is simply broken for certain conditions, which we can only guess at. If you select a face that is not associated with other geometry (not part of a “solid”) then it seems to work fine. But if you pull the face into a 3D element, and copy that face, then the behavior is observed that arcs on the face edges are turned into line segments that are not part of an ArcCurve any longer. There is a video at showing the behavior. https://www.youtube.com/edit?o=U&video_id=Uy0O0x9pIR4 (no audio, just watch)