I kind of get tired of guessing. I would like to build a calculator that figures the max number of segments I can use in an arc. Is it based of the radius or circumference? I figured I’d ask before going too far down this rabbit hole.
It’s based on the length of the segments in the arcs or circles. The idea is to prevent creation of edges that are so short they create tiny faces that SketchUp won’t fill. The problem is setting a maximum number is that what might work for a simple circle or even a cylinder may not work with a curved Follow Me path. The other thing to consider is there’s a point of dimishing returns with segments in a circle.
What are you modeling and why do you need to increase the number of sides in circles?
I like to create SVG files to send over to Shaper Studios. I also prefer more true circles for 3D printed models as well. However since you mentioned it I have noticed problems in the past of tiny spaces not getting filled. I didn’t realize this was likely the issue. I always wanted the smoothest arcs as possible.
I’ll still want to max them out for my 2D SVG drawings.
Here’s what Claude in ChatGPT gave me for my experiement
Observations:
The relationship between radius and maximum segments is not linear.
The increase in segments slows down as the radius increases.
There's a hard cap at 999 segments in SketchUp.
After analyzing this data, it appears that SketchUp might be using a logarithmic or square root relationship. Let’s try to find a formula that fits this data.
A formula that seems to fit reasonably well is:
Segments ≈ round(140 * √radius)
This gives us:
3" Radius: 242 (actual: 243)
10" Radius: 443 (actual: 444)
20" Radius: 626 (actual: 628)
26" Radius: 714 (actual: 716)
30" Radius: 767 (actual: 769)
40" Radius: 885 (actual: 888)
50" Radius: 990 (actual: 993)
This formula is not perfect, but it’s quite close to the actual values you observed. The slight differences could be due to rounding in SketchUp’s internal calculations.
To use this formula:
** Take the square root of the radius**
** Multiply by 140**
** Round to the nearest whole number**
** If the result is over 999, cap it at 999**
This formula suggests that SketchUp is likely using some form of square root relationship to determine the maximum number of segments, possibly to balance detail with performance as the circle size increases.
Remember, this is an approximation based on the data provided, and SketchUp’s actual internal algorithm might be more complex. However, this formula should give you a good estimate of the maximum segments for any given radius in SketchUp.
Since you’re creating SVG files, you could work at some larger scale which would allow you to use a larger number of segments. When I model for 3D printing I model using meters as if they were millimeters since the units are really immaterial. I do the same thing for the small steam engines and other machine parts I model. You can see plenty of examples in the link in my profile. that said I find that generally there’s no benefit in using more than 96 sides for circles. Even for 3D printed parts that have to move together (think screw threads) 96 sides are plenty.
Also, if you are just doing 2D drawing, maybe you would do better to use an actual 2D drawing application. A 3D modeling application is probably not the best choice for doing 2D drawings.
It’s good to hear that. I was just over thinking it and stressing about the quality of finish. I have adobe Illustrator but I hate it, I need to cancel it. It’s so much easier for me to design on Sketchup. I was going to post an HTML code of that formula but I can’t get it to structure correctly to make it legible on here. Anyone is more than willing to try to plug this into VScode and see if they can sort it out but I’m not going to try to do all the tabs and lines properly on here lol
Segment Finder function calculateSegments() { // Get the radius value from the input let radius = parseFloat(document.getElementById('radius').value); // Calculate the number of segments
let segments = Math.sqrt(radius) * 140;
segments = Math.round(segments);
if (segments > 999) {
segments = 999;
}
// Display the result
document.getElementById('result').innerText = `Maximum segments: ${segments}`;
}
</script>
Segment Finder
Radius: CalculateSorry… It didn’t work. Idk why but it’s doing something with my code instead of just printing the text from it
Hello, I think it would be easier and faster to export your parts using the Open Cut List plugin.
OCL can export parts in SVG
It also knows how to smooth curves. If your curve is an arc or a circle, and even if it’s any curve with at least 6 segments, the curve will be smoothed when exported.
This plugin is available on Extention Warehouse.
More information Here
I wrote some “Versine” stuff a long while ago.
The thread is over at SketchUcation’s forum
Here’s the code snippet to run in the Ruby Console:
r = 25.mm
v = 0.001
a = 360.0
res = inputbox(["Rad.", "Tol.\"", "Ang.° "],[r, v, a], "Versine")
if res
r, v, a = res
n = (0.5 * a.degrees / Math.acos(r/(r+v))).round
m = n
m += 1 until m%4 == 0
b = 0.5 * a / m
s = (r * 2.0 * Math.sin(b.degrees)).to_l
puts"\nRad.=#{r}, Tol.=#{v}\", Ang.=#{a}°, Num.Segs=#{n}, \n%4=#{m}, Seg.Len.=#{s}>=0.001\"=#{s>=0.001}"
end
You probably need to temporarily reset your Model’s Units display precision to see the full results without excessive ~ approx…
The dialog’s inputs are:
Radius [current units]
Tolerance [inches - defaults to 1/1000" - i.e. abs min segment length] - aka ‘Versine’
Angle [360 for circle, less for arcs]
The output in the console shows those values, and the other calculated values for:
Maximum number of segments still within tolerance
Absolute max segments rounding
Actual segment length in current units, and also if it matches the given criteria.
From this info you can determine the number of segments you need for the given radius, and if it is within SketchUp’s tolerance etc…
It was only an example of how to do it, you can work it up into a better tool yourself…
Thanks for the advice! I’ll definitely check that out!
Thanks for sharing! I’ll definitely look into that soon! I still haven’t tried any Ruby projects but this should be a fun one to play with. I love building calculators and stuff like that.