Problem happens when path is closed

Dear friends,

In following commands if path is not closed (first and last point are same) program works well but when path is closed program terminated and last command don’t execute. Can you help me to find problem?

face = $ent.add_face pt1, pt2, pt3, pt4
path = $ent.add_curve @pt[0...@st]
face.followme path 
grp = $ent.add_group face.all_connected

At first but second time:

NOTE: AVOID USING GLOBAL VARIABLE ( starting with $ )


What does it mean?

Is Sketchup closing with bug splat or you have got an error massage in Ruby console?

There is a known issue creating group with entities collection prior to SU8, but maybe it is still apply…
at least if you try add in an entities context that’s not ‘active’ entities it’ll Bug Splat as well.
Entities#add_group-instance_method
Calling add_group with entities in its parameters has been known to crash SketchUp before version 8.0. It is preferable to create an empty group and then add things to its Entities collection.

Thank you for your attention. I used Ruby Code Editor and no error message show to me. Also it seems problem happen when in followme starting face and ending face are same. What can I do?

Try this.
If you make the follow me in SU like this.
image

You will realize that he face inside ‘disappears’:
image

Same thing happens in your code
face.all_connected
is referring to deleted face
You can get the created surface into group something like this

grp = Sketchup.active_model.active_entities.add_group
face = grp.entities.add_face pt1, pt2, pt3, pt4
path = grp.entities.add _curve @pt[0...@st]
face.followme path

Note that the often mentioned "$ent" has been replaced… :stuck_out_tongue_winking_eye:

2 Likes

it works really good. You are great!! Thank you so much.

2 Likes