Jump to content

Loop thru polylines


Jozi68

Recommended Posts

I have a drawing with thousands of Polylines. They all have a "Height" property (that i've added with some import command a while ago). Now I need a small procedure to take the value in the "Height" property, and put it in the "Elevation" property.

I have no idea where to start.

Link to comment
Share on other sites

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • Jozi68

    13

  • marko_ribar

    7

  • MSasu

    3

  • BIGAL

    2

Top Posters In This Topic

Posted Images

If is not about properties that were specific to Civil 3D entities, but of Thickness (as Marko observed first) and Elevation properties, then those were stored under DXF codes 39, respectively 38 into the associated list of the entity. then will have to

Link to comment
Share on other sites

To clarify, any entity is stored into drawing database as a list of features, named associated list, where the data is sorted by pairs/sets of keys and values; the keys were named DXF codes.

 

I noticed that you are saying that the aforementioned Height property is a custom one. How did you proceeded when defined/added it?

Link to comment
Share on other sites

MAPIMPORT

Select a shp file

Click the speedbutton in the Data column

Click "Create object data"

Click select Fields...

Uncheck all except "Height"

click OK

click OK

 

The result: Thousands of polylines, each with a height property.

NOW, how do I get the value of the height property into the elevation property?

 

PolylinesWithHeight.jpg

Link to comment
Share on other sites

So, it is about something specific to Civil 3D pack.

Can you load here what return the code below? Paste it into your command line and select one of those polylines, preferable with a small number of vertexes:

(entget (car (entsel)))

Link to comment
Share on other sites

Select object: ((-1 . ) (0 . "LWPOLYLINE") (5 .

"E9CC") (102 . "{ACAD_XDICTIONARY") (360 . ) (102 .

"}") (330 . ) (100 . "AcDbEntity") (67 . 0) (410 .

"Model") (8 . "2628_RELIEF10_LINE_2007_1") (100 . "AcDbPolyline") (90 . 14) (70

. 0) (43 . 0.0) (38 . 0.0) (39 . 0.0) (10 28.7529 -26.0) (40 . 0.0) (41 . 0.0)

(42 . 0.0) (91 . 0) (10 28.7528 -26.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 .

0) (10 28.7526 -26.0001) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 28.7524

-26.0001) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 28.7521 -26.0) (40 .

0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 28.7519 -26.0) (40 . 0.0) (41 . 0.0)

(42 . 0.0) (91 . 0) (10 28.7517 -26.0001) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91

. 0) (10 28.7515 -26.0001) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10

28.7513 -26.0001) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 28.7513

-26.0002) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 28.7512 -26.0002) (40 .

0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 28.751 -26.0001) (40 . 0.0) (41 . 0.0)

(42 . 0.0) (91 . 0) (10 28.7508 -26.0001) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91

. 0) (10 28.7505 -26.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (210 0.0 0.0

1.0))

 

I'm assuming it would be possible to write a simple LISP routine that loops through all polylines, takes the Height property, and updates the elevation property.

Only problem is: I've never written anything in LISP.

Link to comment
Share on other sites

It looks that data ab "Height" property is hidden... In above posted DXF codes, we can't see height of "LWPOLYLINE" entity... So perhaps, try through VLISP Activex...

 

(vl-load-com)
(setq pl (vlax-ename->vla-object (car (entsel))))
(vlax-dump-object pl T)

Type this, line by line in Command: prompt, select polyline after (setq pl (vlax-ename->vla-object (car (entsel)))) and copy+paste here output from last line (vlax-dump-object pl T)

Link to comment
Share on other sites

Command: (vlax-dump-object pl T)

; IAcadLWPolyline2: AutoCAD Lightweight Polyline Interface

; Property values:

; Application (RO) = #

; Area (RO) = 1811.32

; Closed = 0

; ConstantWidth = 0.0

; Coordinate = ...Indexed contents not shown...

; Coordinates = (-24729.8 -2.87722e+006 -24742.3 -2.87722e+006 -24761.3

-2.87722e+006 ... )

; Document (RO) = #

; Elevation = 0.0

; EntityTransparency = "ByLayer"

; Handle (RO) = "18BB8"

; HasExtensionDictionary (RO) = -1

; Hyperlinks (RO) = #

; Layer = "2628_RELIEF10_LINE_2007_1"

; Length (RO) = 245.725

; Linetype = "ByLayer"

; LinetypeGeneration = 0

; LinetypeScale = 1.0

; Lineweight = -1

; Material = "ByLayer"

; Normal = (0.0 0.0 1.0)

; ObjectID (RO) = 136

; ObjectID32 (RO) = 136

; ObjectName (RO) = "AcDbPolyline"

; OwnerID (RO) = 137

; OwnerID32 (RO) = 137

; PlotStyleName = "ByLayer"

; Thickness = 0.0

; TrueColor = #

; Visible = -1

; Methods supported:

; AddVertex (2)

; ArrayPolar (3)

; ArrayRectangular (6)

; Copy ()

; Delete ()

; Explode ()

; GetBoundingBox (2)

; GetBulge (1)

; GetExtensionDictionary ()

; GetWidth (3)

; GetXData (3)

; Highlight (1)

; IntersectWith (2)

; Mirror (2)

; Mirror3D (3)

; Move (2)

; Offset (1)

; Rotate (2)

; Rotate3D (3)

; ScaleEntity (2)

; SetBulge (2)

; SetWidth (3)

; SetXData (2)

; TransformBy (1)

; Update ()

T

Link to comment
Share on other sites

Neither here, we can't see "Height" property... So, do you know how to retrieve polyline "Height" value? It seems that this new property is hidden from ordinary entity data... We can't help you, if we can't obtain this new property value...

Link to comment
Share on other sites

Because its come from a shp file it probably has the value of height in the extended data hence does not display just like aecc objects will say a "surface" and its "name" but there is more info.

 

Not sure dont play with shp leave that to those who know how but can you not as part of import make the elevation = height hence true 3d plines.

 

Is the question to draw more objects at this pline implied elevation ?

Edited by BIGAL
Link to comment
Share on other sites

Command: (entget (car (entsel)) '("HEIGHT"))

Select object: ((-1 . ) (0 . "LWPOLYLINE") (5 .

"18BB8") (102 . "{ACAD_XDICTIONARY") (360 . ) (102 .

"}") (330 . ) (100 . "AcDbEntity") (67 . 0) (410 .

"Model") (8 . "2628_RELIEF10_LINE_2007_1") (100 . "AcDbPolyline") (90 . 14) (70

. 0) (43 . 0.0) (38 . 0.0) (39 . 0.0) (10 -24729.8 -2.87722e+006) (40 . 0.0)

(41 . 0.0) (42 . 0.0) (91 . 0) (10 -24742.3 -2.87722e+006) (40 . 0.0) (41 .

0.0) (42 . 0.0) (91 . 0) (10 -24761.3 -2.87722e+006) (40 . 0.0) (41 . 0.0) (42

. 0.0) (91 . 0) (10 -24782.0 -2.87722e+006) (40 . 0.0) (41 . 0.0) (42 . 0.0)

(91 . 0) (10 -24813.4 -2.87722e+006) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0)

(10 -24834.7 -2.87722e+006) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10

-24850.2 -2.87722e+006) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 -24872.3

-2.87723e+006) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 -24889.9

-2.87723e+006) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 -24896.1

-2.87723e+006) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 -24906.2

-2.87723e+006) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 -24928.2

-2.87723e+006) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 -24939.9

-2.87723e+006) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 -24970.9

-2.87722e+006) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (210 0.0 0.0 1.0))

Link to comment
Share on other sites

As I can see, there are no registered app "HEIGHT" to this entity... Still, try to check for all registered APPIDS in your DWG, so execute this code and copy+paste here results :

 

(defun c:appids ( / app )
 (setq app (tblnext "APPID" T))
 (princ app)
 (while (setq app (tblnext "APPID"))
   (terpri)
   (princ app)
 )
 (princ)
)

Link to comment
Share on other sites

After you load it with as you did copying+pasting code to CAD's interface, or saving code as *.lsp file and load it with APPLOAD, you'll notice that last prompt as shown in your picture is prompt C:APPIDS... This means that code was loaded into memory as C: (command function)... You'll have to type at prompt Command: APPIDS and hit ENTER... Then, your text screen (this what you showed with picture) will show info witch I want you to copy+paste here, like you did earlier in your replies...

Link to comment
Share on other sites

Got it.

Here are my results:

Command: APPIDS

((0 . APPID) (2 . ACAD) (70 . 0))

((0 . APPID) (2 . ACAD_PSEXT) (70 . 0))

((0 . APPID) (2 . AcadAnnoPO) (70 . 0))

((0 . APPID) (2 . AcadAnnotative) (70 . 0))

((0 . APPID) (2 . ACAD_DSTYLE_DIMJAG) (70 . 0))

((0 . APPID) (2 . ACAD_DSTYLE_DIMTALN) (70 . 0))

((0 . APPID) (2 . ACAD_MLEADERVER) (70 . 0))

((0 . APPID) (2 . ACAD_EXEMPT_FROM_CAD_STANDARDS) (70 . 0))

((0 . APPID) (2 . AcMapDMDisplayStyleRegapp) (70 . 0))

((0 . APPID) (2 . AeccLand70) (70 . 0))

((0 . APPID) (2 . AeccUiQTO) (70 . 0))

((0 . APPID) (2 . AeccUiQTOEntityPayItemData) (70 . 0))

((0 . APPID) (2 . AeccUiQTOPayItemFilePath) (70 . 0))

((0 . APPID) (2 . AeccUiQTOPayItemCategoryFilePath) (70 . 0))

((0 . APPID) (2 . AeccUiQTOFreqUsedPayItemsList) (70 . 0))

((0 . APPID) (2 . AeccUiQTOPayItemFormulaFilePath) (70 . 0))

((0 . APPID) (2 . AeccUiQTOPayItemSpecBookVersionFloridaDOT) (70 . 0))

((0 . APPID) (2 . AeccUiQTOPayItemFormulaParameters) (70 . 0))

((0 . APPID) (2 . AeccUiQTOPayItemFormulaExpression) (70 . 0))

((0 . APPID) (2 . AeccUiQTOTransportDesignerFileFloridaDOT) (70 . 0))

((0 . APPID) (2 . AeccUiModel) (70 . 0))

((0 . APPID) (2 . ADE) (70 . 0))

((0 . APPID) (2 . MapGWS) (70 . 0))

((0 . APPID) (2 . DCO15) (70 . 0))

((0 . APPID) (2 . AcAecLayerStandard) (70 . 0))

((0 . APPID) (2 . AcDbBlockRepETag) (70 . 0))

((0 . APPID) (2 . AcDbDynamicBlockGUID) (70 . 0))

((0 . APPID) (2 . ACAUTHENVIRON) (70 . 0))

((0 . APPID) (2 . AcDbDynamicBlockTrueName) (70 . 0))

((0 . APPID) (2 . AeccLand80) (70 . 0))

((0 . APPID) (2 . AeccUiMgr) (70 . 0))

((0 . APPID) (2 . AeccLand90) (70 . 0))

((0 . APPID) (2 . ACAD_NAV_VCDISPLAY) (70 . 0))

((0 . APPID) (2 . AcMap_E615D161-C9D7-11d3-839F-0060B0FB6B57) (70 . 0))

((0 . APPID) (2 . IRD) (70 . 0))

((0 . APPID) (2 . ADE_PROJECTION) (70 . 0))

((0 . APPID) (2 . AcPublishKml) (70 . 0))

((0 . APPID) (2 . AcCmTransparency) (70 . 0))

Link to comment
Share on other sites

Maybe try this see if xdata exists

 

(setq adict (dictsearch (namedobjdict) "ACAD_XDICTIONARY")))
then maybe entity Entity name: 7ffff2f59f0

 

Can you post a dwg with one pline wblock out maybe.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...