How to get followme path from polyline and bulges?

Given points of a polyline and bulges, for example:

polyline: points: [x: 0.9899570345878601, y: 0.23871071636676788, z: 0.0]
[x: 1.2544461488723755, y: 0.5894935727119446, z: 0.0]
[x: 1.6359206438064575, y: 0.18278881907463074, z: 0.0]

bulges: [0.0, -1.1879018545150757, 1.7657634019851685]

How to get its path for followme?

Please explain more what do you want to achieve?

First, the syntax of example you give cannot be interpreted by Ruby. At least not in a simple way. You should give a proper arrays, or hashes with Point3d (or coordinates) to be able to deal with.

If we draw the “polyline: points:”, as a curve and the “bulges:” as a cpoint it will be like this:


.

The #followme is an instance method of Sketchup::Face, therefor you will need a face then an edge or an array of edges on which the face follow along.

The polyline (curve) can be used as path to followme here, but I have no idea what face you want to use as a base and what the “bulges:” point (or coordinate) means here… Would you please elaborate!

The last time I dealt with the bulge concept it was in this topic:

Thanks dezmo. Yes, I know how to use #followme with a face and an array of edges. Now I get the data (polyline points and bulges) that exported from AutoCAD. My colleague drew arcs in AutoCAD, and exported them as the data with information for generating pipe. My task is to draw the pipe in Sketchup. I already draw the pipe face, but do not know how to get the path from the data.

If I can convert the data to arcs in Sketchup, add_arc would be a solution.

See the other topic I linked.

Also what units are the values you posted ?
SketchUp is designed to model buildings. It’s points have a 0.001" precision.
Also SketchUp’s API uses inches internally.

Thanks Dan, I followed the link. There is acr_to_bulge, but no bulge_to_arc. I suppose I need the latter.

The unit we use is meter. Yes, we will change the data from meter to inch when drawing entities in Sketchup.

You should also check the original code from where Dan made the “translation” to Ruby code.

Here there are two version:

You maybe able to do similar “translation” to make your own bulge_to_arc method…

1 Like

Yes, seconding what @dezmo said. I pointed you there so it could serve as an example of what is possible, and you could see the difference between an ACAD bulge and a SketchUp Arc.

We here usually ask that you at least make an attempt to solve your own codding challenges, but when you get stuck, come back and post what you have and explain what isn’t working for you.

2 Likes

Hi @Henry12 If you want to find the bulge you can use this formula
bulge = Math.tan(( end_angle - start_angle)/4)
where start_angle and end_angle could found on the ArcCurve instance of an edge edge.curve.end_angle. In recreating the bulge take please take into consideration the direction of the bulge if it is left to right or right to left as it would produce the bulge the other way around (instead of pointing north it would point south)