# Dxf Polyline Bulge

Polyline Bulges

The bulge factor is located with group code 42. If a segment does not have an arc, the bulge factor is zero. When there is an arc in the segment, the value seen with group code 42 is the result of calculating the tangent value of one quarter of the included angle. If one division point is on the arc? I need to calculate the bulge for the two arcs made. That produce a bulge value with a change in radius (comparing to the original) attached sample dwg: the cyan polyline is the original. The magenta polylines is the division. How can i calculate more accurate bulge? Thanks in advance.

Bulges are something that women have (mostly to please the opposite sex it seems) and something that guys try to get by placing socks in strategic places. At least until they get older. Which is the time they tend to develop bulges in not so strategic places. In other words: bulges are all about curvature.
In AutoCAD, bulges are used in shapes and in arc segments of polylines. This article only deals with polyline bulges, and because polyline bulges are describing circular arcs, let's first look at the geometry of a circular arc.

Because a circular arc describes a portion of the circumference of a circle, it has all the attributes of a circle:

• Radius (r) is the same as in the circle the arc is a portion of.
• Center point (P) is also the same as in the circle.
• Included angle (θ). In a circle, this angle is 360 degrees.
• Arc length (le). The arc length is equal to the perimeter in a full circle.

Adding to these attributes are some that are specific for an arc:

• Start point and end point (P1 and P2) a.k.a. vertices (although sometimes it is practical to talk about specific points that a circle passes through, there are no distinct vertices on the circumference of a circle).
• Chord length (c). An infinite amount of chords can be described by both circles and arcs, but for an arc there is only one distinct chord that passes through its vertices (for a circle, there is only one distinct chord that passes through the center, the diameter, but it doesn't describe any specific vertices).
• Given two fixed vertices, there is also a specific midpoint (P3) of an arc.
• The apothem (a). This line starts at the center and is perpendicular to the chord.
• The sagitta (s) a.k.a. height of the arc. This line is drawn from the midpoint of an arc and perpendicular to its chord.

Except for the arc itself, an arc can describe two distinct geometric forms: Circular segment and circular sector. Both figures includes all of the attributes above, but for doing calculations with bulges, we'll mostly use the piece of pie that the arc cuts out of a circle, the circular sector.

So, what is a bulge for a circular arc and how is it defined? In AutoCAD's online help reference, it says about bulges for polylines:

The bulge is the tangent of 1/4 of the included angle for the arc between the selected vertex and the next vertex in the polyline's vertex list. A negative bulge value indicates that the arc goes clockwise from the selected vertex to the next vertex. A bulge of 0 indicates a straight segment, and a bulge of 1 is a semicircle. What does this mean and how can an arc be defined without even knowing the radius - or at least a chord length? It says that the only information given for arc segments in polylines are two vertices and a bulge.
Well, it also says that the bulge has something to do with the tangent of a quarter of the included angle of an arc. That must be a clue of how to obtain the angle. In fact, once you have a bulge value, you can very quickly retrieve the included angle by inverting the above statement. Simply use the built-in function ATAN to get an angle and multiply it by 4 in order to get the included angle:

So, a bulge of 0.57735 is describing an included angle of 2.09439 radians (which is 120.0 degrees, by the way). Try it out for yourself. Start drawing a lightweight polyline, type 'A' for arc, then 'A' again for Angle and '120.0' for the included angle. Drop the endpoint somewhere, leave the polyline command and type this at the command line:

Now you have a bulge value for the arc segment in the polyline, and you can try out the formula above.

Ok, fine. But why is the bulge 1/4 of the included angle and where does the tangent fit in? There are many ways to explain this. One is shown below. The figures show a circle with a central angle describing an arc and we'll try to show that the yellow angles ε and σ are exactly one quarter of the cyan central angle θ.

If the full angle is cut in half - as shown with the blue angle η at figure 2 - we get an isosceles triangle (green) where the angles φ and τ are equal. Because the sum of angles in a triangle is always 180 degrees, we now know that the angles φ and τ are Now look at the chord from P1 to P2 in figure 3. Together with the red legs of angle θ it also forms an isosceles triangle, and therefore γ is equal to ξ. The top angle is the full angle of θ, so γ and ξ become equal to Thus, the yellow angle ε must be the magenta angle φ minus the orange angle γ. In other words, ε is a quarter of the included angle θ: The bulge is describing how much the arc 'bulges out' from the vertices, i.e. the height of the arc (the sagitta (s), or the distance P3 to P4 in figure 4). The height forms a leg of a right-angled triangle that has an exact angle of 1/4 of the included angle (see the yellow triangle P-P2-P3 in figure 4) and because tangent is describing the ratio between the legs in a right-angled triangle, it's easy to describe the geometry with this one angle:

We could also find tangent of angle ε by simply dividing the opposite leg with the adjacant leg - which means the sagitta, s, divided by half the distance of the chord, c, - but not knowing s and having the tangent of ε already, we would rather want to find s:

Given that bulge = tan(ε), we get

Radius of the arc can now be found with this formula:

The sign of a particular bulge is important for the way it's defined in relation to the vertices. If a bulge is positive it means that the arc is measured counterclockwise from the starting vertex to the end vertex. If a bulge is negative it means that the arc runs the other way round, - it's measured clockwise. The system variable ANGDIR has no influence on this.
Therefore all the formulas above has to be concerned about the absolute value of the bulge instead of the actual value - or you might end up with a negative radius. In the code below we will find the center point. There are many ways to do this, but the method that is chosen here relies on the angles that were defined previously. Subsequently, we will need it to test whether the bulge is postive or negative and act accordingly.

Remember that the orange angle γ in fig. 3 was found to be 90 degrees minus half of the included angle? What happens if we add (or subtract, depending on the arc direction) this angle to the angle between the two known vertices P1 and P2? We get the angle towards the center. Knowing the angle, the radius and the start point of the arc we can find the center point with POLAR.

Another way to find the direction towards the center is to use good old Pythagorus. We already know radius and the chord length, so by using radius as the hypothenuse and half the chord length as a leg in a right-angled triangle, where the apothem is the second leg, it's possible to draw the apothem and find the center point.

By now, enough angles and distances are known to also use other trigonometric functions in order to find the center point without using POLAR, but that has to remain a home assignment for now. Let's get some code up'n'running, utilizing the formulas and methods we just went over. Later we will repeat some of the formulas to use with bulges.

First function will be an ordinary pick-a-polyline function. It contains no magic. The user is merely asked to pick a lightweight polyline and, if successful, it returns a list of all segments on the form (vertex1 bulge vertex2). These segments will later be used to analyze each arc segment in the polyline. Although it only accepts lightweight polylines, there's nothing to prevent you from adjusting it to also accept old-style polylines.

Next function will be our workhorse. It will use everything we now know about retrieving included angle, height of arc, chord length, radius and center point.
The function accepts a list of arguments on the form that corresponds to the segment sublists from the previous function - (vertex1 bulge vertex2). If the argument is acceptable, it will print out information about the arc segment. We'll let the comments in the code take over any further explanation.

To try out these two functions, first draw a lightweight polyline with a couple of arc segments. Sims game for mac. At the command line, call getPolysegs and assign a variable to the returned list:

If a lightweight polyline was selected, it will return a list of segments. If, for example, the second segment contains a bulge value different from 0.0 then you can call the latter function like this:

The last function in this article will bind the two functions together and explore each arc segment in the selected polyline. It will appear in part two - along with some useful formulas for dealing with bulges.

Bezarc® 3.0 Windows

Bezarc® is a Graphic Translator that converts files from Adobe Illustrator into smooth circular arcs and saves files in DXF, DDES2/IT8.6 or CFF2 format.

The Diecutting, Diemaking industry will never be the same!
The transition from the drawing board to the finished product has never been so easy. Bezarc - a revolutionary graphics translator that converts line art from Adobe Illustrator into smooth arcs, that can be saved as DXF, DDES2 or CFF2 format.

Bezarc offers a choice of curve fitting algorithms, and features user-settable conformance parameters. Arcs generated by Bezarc will conform as closely as desired to the original artwork. Bezarc gives users the choice of Polylines with bulge factors or strictly arcs and lines for DXF. Bezarc pre-formats output files for use on MS-DOS or Windows, Unix or Macintosh operating systems. The 'Target System' Dialog

Industrial Strength Curve Fitting
Match arcs to Bezier curves to any degree of tolerance. Choose the algorithm and tolerance that matches your job.

Multiple Output Formats
Save your Illustrator work in the format that's right for you. Under user control, DXF output can be detailed for a variety of applications and systems. DDES2 and CFF2 output is designed for Diecutting and Diemaking.

Data Reduction
Bezarc's suite of curve fitting algorithms include options to reduce the size of its output files, save disk space, reduce transmission time and streamline the production process.

Detailed Information
Bezarc can give detailed information about how many paths or arcs, lines and circles will be generated even before the file has been saved, giving users the ability to adjust program parameters to achieve the optimum balance between curve fitting and data reduction.

The 'Count' Window

Generating DXF
Three options for generating DXF files are available:

The 'DXF Options' Dialog

* Polylines with Bulge factors
Continuous paths are maintained, i.e.: a continuous path in the input file, regardless of the number of control points, will produce a single polyline in the DXF output.

* Arcs & Lines
All input will be translated into either an ARC or a LINE object in DXF. This option offers the highest level of compatibility with existing computer controlled diecutting machinery.

* Arcs & Lines & Circles
This option is the same as 'Arcs & Lines', except that Bezarc will attempt to 'weld' arcs together. This method should be used in conjunction with the 'Weld Arcs' option. When the welding process produces a full circle, Bezarc will place a CIRCLE object in the DXF file. This results in significant data reduction in files that have a lot of circles. Some systems that read DXF do not read the CIRCLE command. If you are using such a system, one of the other 2 methods should be used.

Accuracy
Bezarc does all of its internal calculations using 16-digit accuracy for the ultimate in precision. Files can be saved with all 16 or as few as 2 digits after the decimal point. This data reduction option gives users the power to balance precision against file size.

Say good-bye to Pause & Burn
Computer controlled laser cutters will no longer pause at those annoying short straight line segments produced by other inferior file conversions when they break up the sinuous Adobe Illustrator curves into polylines.

Generating Arcs
There are four methods for generating arcs from Bezier curves:

• Curvature
• Path
• Length The 'Method & Tolerance' Dialog

Features / Options
Constraints

For each of the 4 arc generating methods, a tolerance value can be set that corresponds to the arc method selected.

Weld Arcs
When artwork is created in programs such as Illustrator or Freehand, circular arcs of more that 90 degrees are represented by 2 or more Bezier curves. Four curves are required to make a full circle. The Weld Arcs feature can significantly reduce the amount of data output from Bezarc by joining such arcs into a single entity.

Measurements
A measurement grid will help users determine how well an arc approximates a curve when examining graphics on screen. The grid lines are marked with actual coordinate values for normal or modestly enlarged views. For views that are more than modestly enlarged, a message in the lower feedback strip will tell you how far apart the grid lines are. Coordinate values are available in inches, or millimeters.

Measurement Units

The 'Units' Dialog

Select the measurement unit that's right for your situation. Bezarc will save your DXF files in inches, centimeters or millimeters. Since the DDES2 format does not support centimeters, Bezarc will automatically substitute millimeters in the output file when centimeters is selected.

Feedback
Get the information needed to complete the job right the first time. Bezarc can give detailed information about how many paths or arcs, lines and circles will be generated in the output file. Screen feedback shows the original drawing on a verification grid with arc output overlaid over the original spline control points and associated arc points or joints.

EXAMPLE:

For this example we have opened an Adobe Illustrator(tm) file with 2 simple Bezier curves connected to produce 1 smooth curve. Bezarc displays the Bezier curves in the file with Black lines.

After reading in an Illustrator file, Bezarc can display the points along the original curve where it will divide the Bezier curve into Arcs.

There are two types of points Bezarc displays, the () points are where Bezarc has calculated the Arc points should be positioned to represent the original Bezier.

Bezarc must place an Arc point where an original Bezier control point is positioned. These points are represented with a () point.

Bezarc displays the Arcs it will produce with Green lines laid over-top of the Black lines.

As you can see, Bezarc has calculated that this Adobe curve which originally consisted of 2 Beziers connected at the center, will be represented in DXF/DDES2 as 7 Arcs (with the current program tolerances).

The number of Arcs can be increased or decreased by adjusting the Tolerance or Method of calculation.

The DXF files created by Bezarc are guaranteed compatible with all versions of AutoCAD as well as other CAD applications that support the DXF standard. The DDES2 files that Bezarc writes are in version IT8.6 and will integrate beautifully into your machining & cutting operations.

If you would like to experience Bezarc for yourself, there are versions available.

Already in worldwide release Bezarc has received fantastic feedback, so be sure and place your order today!

Bezarc Specifications

• Runs under any 32-bit Windows operating system
• Features 16 digit accuracy for all calculations
• Line Terminator option can be used to allow easy transfer of translated files to other Operating Systems
• Weld Arcs option for size='2' color='#FFD700'>Comes with 60 days Technical Support and a 30-Day Money-Back Guarantee (At participating locations)

## Dxf Polyline Vertex Bulge

 Part # Description Retail Cost 10005 Bezarc® 3.0 Windows \$459.00INTRODUCTORY PRICE! Upgrade from v.1.2 \$159.00 Upgrade from v.1.0 \$329.00