Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

3dPolyline, Polyline, LightweightPolyline.

7 REPLIES 7
Reply
Message 1 of 8
Shneuph
1309 Views, 7 Replies

3dPolyline, Polyline, LightweightPolyline.

Hi all,

  I thought I knew about polylines but now I'm a bit confused.  The VBA reference says that a POLYLINE object is a legacy version of LIGHTWEIGHTPOLYLINES and should be replaced with LightWeightPolylines (See attached image).  However, when I use the 3DPoly command it creates a POLYLINE.  In the VBA reference there is also a 3DPolyline object but I can't seem to figure out how to create one.  A POLYLINE is 3d.. but it's not called a 3DPOLYLINE??  I'm sure this is some easy answer that's going to make me feel stupid. 🙂  Or maybe the help files are just contradicting?

 

Command: 3DPOLY

Specify start point of polyline:
Specify endpoint of line or [Undo]:
Specify endpoint of line or [Undo]:

Command: (entget (entlast))
((-1 . <Entity name: 7eebfe10>) (0 . "POLYLINE") (330 . <Entity name:
7ee8fee8>) (5 . "D92") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0")
(100 . "AcDb3dPolyline") (66 . 1) (10 0.0 0.0 0.0) (70 . 😎 (40 . 0.0) (41 .
0.0) (210 0.0 0.0 1.0) (71 . 0) (72 . 0) (73 . 0) (74 . 0) (75 . 0))

Command: pl
PLINE
Specify start point:
Current line-width is 0.0000
Specify next point or [Arc/Halfwidth/Length/Undo/Width]:
Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:

Command: (entget (entlast))
((-1 . <Entity name: 7eebfe30>) (0 . "LWPOLYLINE") (330 . <Entity name:
7ee8fee8>) (5 . "D96") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0")
(100 . "AcDbPolyline") (90 . 2) (70 . 128) (43 . 0.0) (38 . 0.0) (39 . 0.0) (10
5.58114 7.91279) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 6.03534 8.00256)
(40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (210 0.0 0.0 1.0))

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
7 REPLIES 7
Message 2 of 8
Anonymous
in reply to: Shneuph

The information you are looking at is correct.  If you want only polylines when you use the pline command, there is a variable to set it, I just can't remember it at the moment.  Also there is a conversion function to convert polylines to ltwtpolys.  I don't remember when ltwtpolys where introduced in AutoCAD, but before then everything was a polyline.  If would imagine if you use the entmake with a "polyline" setting it would create the polyline you are looking for. 

Message 3 of 8
Kent1Cooper
in reply to: Shneuph


@Shneuph wrote:

....  The VBA reference says that a POLYLINE object is a legacy version of LIGHTWEIGHTPOLYLINES and should be replaced with LightWeightPolylines....  However, when I use the 3DPoly command it creates a POLYLINE.  In the VBA reference there is also a 3DPolyline object but I can't seem to figure out how to create one.  A POLYLINE is 3d.. but it's not called a 3DPOLYLINE??  ....


2D Polylines were all originally what we now call "heavy" as compared to the newer "lightweight" Polylines.  The main difference is that in older "heavy" ones, the overall Polyline has an entity name, and each vertex in it also has its own entity name.  The only way to get at the information about the vertices from entity data is to use (entnext) from the overall Polyline's entity data.  But in newer "lightweight" Polylines, there's only one entity name involved, and the vertices are just a series of 10-code entries in its entity data, which makes it easier to get information about them.

 

It's partly a matter of reduced memory consumption, using fewer entity names and storing one Z coordinate for the whole entity instead of one for each vertex.  But there may have been other reasons for developing the "lightweight" variety.  It's a lot easier to make a "lightweight" one using (entmake), for instance [I'm not even sure how you would make a "heavy" one or a 3D one that way...].  The old "heavy" 2D variety is still kept around, I'm sure, for compatibility with old drawings.

 

3DPolylines still have separate entity names for each vertex, as "heavy" 2D ones do.  They were originally the "same kind of thing," before LWPolylines came along, with 2D ones requiring all vertices to have the same Z coordinate, and with 3D ones not allowing arc segments or width [nor, for some reason, displaying non-continuous linetypes].  So 3DPolylines and "heavy" 2D Polylines still share the "POLYLINE" entity type, but if you look at the second 100-code entry in their entity data list, or their VLA ObjectName property, you'll see the difference.

 

You can still make "heavy" 2D Polylines, if you have some reason to, by setting the PLINETYPE System Variable to 0 before using the Pline command.  Or you can turn "lightweight" ones into "heavy" ones, and vice versa, with the ConvertPoly command.

 

Confusing enough?

Kent Cooper, AIA
Message 4 of 8
Anonymous
in reply to: Kent1Cooper

Convertpoly is the one I couldn't remember, I knew you'd come up with the answer.  I tried looking it up in the help but couldn't find.  Started to think it was only an LDD tool.  I helped a co-worker with this years ago because he didn't like ltwtpolys because his lisp toolpac called for polylines, he was on Eaglepoint software and I was using LDD.  Thanks Kent.

Message 5 of 8
Shneuph
in reply to: Kent1Cooper

yah.. Thanks for the explanation Kent.  That is confusing enough!!  haha.  Thank you also azrdgldr!

 

Since this is about the only thing re polylines that was left out so far.. here is a snippet from the AutoLISP Developers Guide re entmaking polylines..

 

in:

Using the AutoLISP Language > Using AutoLISP to Manipulate AutoCAD Objects > Object Handling > Entity Data Functions >

 

(entmake '((0 . "POLYLINE")    ; Object type
 (62 . 5)             ; Color
 (6 . "dashed")       ; Linetype
 (66 . 1)             ; Vertices follow
) )
(entmake '((0 . "VERTEX")      ; Object type
 (10 1.0 1.0 0.0)     ; Start point
) )
(entmake '((0 . "VERTEX")      ; Object type
 (10 4.0 6.0 0.0)     ; Second point
) )
(entmake '((0 . "VERTEX")      ; Object type
 (10 3.0 2.0 0.0)     ; Third point
) )
(entmake '((0 . "SEQEND")))    ; Sequence end

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 6 of 8
Kent1Cooper
in reply to: Shneuph


@Shneuph wrote:

.... 

Since this is about the only thing re polylines that was left out so far.. here is a snippet from the AutoLISP Developers Guide re entmaking polylines..

.... 

(entmake '((0 . "POLYLINE")    ; Object type
....

(entmake '((0 . "VERTEX")      ; Object type
....

(entmake '((0 . "SEQEND")))    ; Sequence end


I guess it makes sense that you would need to (entmake) all of the pieces separately, since they all need to be their own entities.  I would file that away for future reference, if I could imagine any reason why I would want to make a heavy Polyline that way.  I've made routines that can work with either kind, in case you select a heavy one in an old drawing or something, which is why I've needed to know some things about the differences.  But I think for new ones [2-dimensional, that is], I'll stick with the lightweight kind.

Kent Cooper, AIA
Message 7 of 8
Shneuph
in reply to: Kent1Cooper

What if you want to edit an existing Heavy one?  Convert it first and then add a vertex?

 

Do you think you can find the polyline entity, (entnext), (entmake) the new vertices before the sequend to add a vertices?

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 8 of 8
hofcad
in reply to: Shneuph

Kent,

 

You can not stick with the lightweight kind.
The old "heavy" 2D variety is still kept around, not only for compatibility with old drawing
but also for Splined and Fitted polylines!
If you use the command PEDIT with the option Spline or Fit, you get always as a result the
heavyweight.

 

HofCAD CSI.

 

PS See attachment for examples of entmake LWPOLYLINE, entmake POLYLINE and entmake 3D POLYLINE,

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost