Darien Shannon
Darien Shannon

Reputation: 227

What does it mean when a dxf vertex with a bulge factor is not followed by an end point?

I have a DXF file that was exported from a drawing of a simple arc that starts at (0, 0), ends at (2, 0) and has a radius of 1.0. I would expect the LWPOLYLINE to be made up of two vertices with the first containing the start point and bulge factor, and the second point simply containing the end point. However, the end point contains a bulge factor as well. How is this bulge point to be interpreted? Shouldn't all vertices with a bulge be followed by another point that defines the end point?

AcDbPolyline
 90
        2
 70
     0
 43
0.0
 10
0.0  -----------------> x1
 20
0.0  -----------------> x2
 42
0.9999999999999998 ---> p1 to p2 w/ bulge = 1, makes sense
 10
2.0  -----------------> x2
 20
0.0  -----------------> y2
 42
1.330537671996453 ----> why does p2 have a bulge? Shouldn't all vertices w/ 
                        a bulge be followed by another point (to define the 
                        end point)?
  0
ENDSEC

Upvotes: 3

Views: 2797

Answers (2)

Lee Mac
Lee Mac

Reputation: 16015

DXF group 70 is bit-coded, with bit 1 indicating that the LWPolyline entity is closed (note that this is not the same as the LWPolyline having coincident endpoints).

With bit 1 set, the bulge factor (DXF group 42) and starting & ending width values (DXF groups 40 & 41) define how the closing segment (i.e. the segment spanning the last vertex & first vertex) should appear.

You can witness the effect of this value in the following examples:

The following entmake expression with the final DXF group 42 entry omitted (and therefore interpreted as 0) produces a polyline as shown in the image:

(entmake
   '(
        (000 . "LWPOLYLINE")
        (100 . "AcDbEntity")
        (100 . "AcDbPolyline")
        (090 . 3)
        (070 . 1)
        (010 0.0 0.0)
        (010 1.0 1.0)
        (010 1.0 0.0)
    )
)

Zero Bulge

Whereas the following entmake expression with the final DXF group 42 entry set to -1 (=tan(-pi/4)) produces a polyline as shown in the image:

(entmake
   '(
        (000 . "LWPOLYLINE")
        (100 . "AcDbEntity")
        (100 . "AcDbPolyline")
        (090 . 3)
        (070 . 1)
        (010 0.0 0.0)
        (010 1.0 1.0)
        (010 1.0 0.0)
        (042 . -1.0)
    )
)

Non-zero Bulge

Upvotes: 2

mozman
mozman

Reputation: 2249

The best way to find out such details, is to test. If you don't have an AutoCAD application try Autodesk TrueView, it's free.

What I found out by testing is: the last bulge value does nothing, you can change it to any value you want or just delete it, the LWPOLYLINE looks always the same.

EDIT:

This is only true if the LWPOLYLINE isn't closed.

If the LWPOLINE is closed, group code 70=1, the last bulge and also the last start width and end width value, apply to the closing segment from the last vertex to first vertex, your example as closed polyline looks like this:

enter image description here

Upvotes: 6

Related Questions