Arc Segment Issue

Quick question. I generated an arc in SketchUp using some Ruby code. I was bug testing, and when I changed the segments in the entity panel, I got some very weird results. The arc generates with 12 segments and generates correctly; it is only until I change the segments that things start to break.

Before (12 segments):

After the segment change (24 segments):

I can confirm the strange behavior when manually change Segments of Arc created by code.
I was able to reproduce it in SU2017 Make, SU 2023, and SU 2022 as shown in the animation. (I drawn two edges in advance to help identifying what is happening)

The code I’m used is the example from Ruby API doc:
Entities #add_arc instance method

model = Sketchup.active_model
entities = model.active_entities
center_point = Geom::Point3d.new
# Create an arc perpendicular to the normal or Z axis
normal = Geom::Vector3d.new(0, 0, 1)
xaxis = Geom::Vector3d.new(1, 0, 0)
edges = entities.add_arc(center_point, xaxis, normal, 10, 15.degrees, 135.degrees)

arc_seg_issue

Interesting. I’m glad you were able to reproduce it. Any ideas as to what causes it?

I have no idea. It is a bug in SketchUp code, and needs to be investigated by SketchUp devs.

The error has been there for a long time, but until now no one really noticed it. I don’t know when or if it will be fixed…
Until that, I recommend that you specify the “proper number of segment” when creating the Arc by code :wink:

Is this part of issue ?


This is a separate bug. I did actually run across that bug in my testing, so it’s still not resolved yet.

EDIT: Actually, I think you just worked it out. The issue is with the start angle, I copied the code snippet dezmo posted but changed the start angle to 0. Once I did this, I was able to change segments without any issue. This bug definitely has something to do with start angles > 0.

Please open a new API issue, if you would.

Okay, so the workaround would be to always start from 0, then afterward rotate the curve using Curve#move_vertices ?