Community
Civil 3D Forum
Welcome to Autodesk’s Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Label Polyline/Feature line with Layer Name Description

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
rcabrera9993G
620 Views, 5 Replies

Label Polyline/Feature line with Layer Name Description

Does anybody know of a way to label multiple polyline or a feature line with its layer name description without using mtext and fields/objects.

 

Basically i would like to be able to add a label, select the polyline/feature lines and it will label it with the layer name at appropriate offset and also be orientated along the line.

 

Thanks for your help, Reyes

Labels (2)
5 REPLIES 5
Message 2 of 6

Only way I can think to do this is to treat it like a GIS export/import exercise.

 

You first use MAPEXPORT and then include the ACAD Layer Property as an Attribute. Then you can reimport back to C3D using the SHP IMPORT\EXPORT Tool (extra tool you download) to create feature lines of all the line work...upon import, C3D will create Property Sets for attributes...Then you can create a Feature Line label style that points to the Property Set for Layer.

 

You could also just drag and drop the .shp in Civil 3D and stylize the FDO connected SHP file to show the Layer attributes...or 

 

There is another older...more complicated way using the MAPIMPORT method and creating object data upon import, and then annotating the objects through a query but there are more steps and the annotation is not as flexible as the first option. 

 

 




Michael M. Carlson
Senior Civil Designer
CADD Manager
AutoCAD Civil 3D Professional
AutoCAD Professional

Message 3 of 6

There is another way but im not that well versed in creating these, essentially with this .lsp that i found you can do exactly that, but it points to the layer name instead of the layer description.

 

(defun c:labelobjlayer(/ LM:objectid model ent obj DIR INSPT MTEXT OFFSET PARM PT TEXT VEC)
;; ObjectID - Lee Mac lee-mac.com & theswamp.org
;; Returns a string containing the ObjectID of a supplied VLA-Object
;; Compatible with 32-bit & 64-bit systems
(defun LM:objectid ( obj )
(eval
(list 'defun 'LM:objectid '( obj )
(if
(and
(wcmatch (getenv "PROCESSOR_ARCHITECTURE") "*64*")
(vlax-method-applicable-p (vla-get-utility (vla-get-activedocument (vlax-get-acad-object))) 'getobjectidstring)
)
(list 'vla-getobjectidstring (vla-get-utility (vla-get-activedocument (vlax-get-acad-object))) 'obj ':vlax-false)
'(itoa (vla-get-objectid obj))
)
)
)
(LM:objectid obj)
)
(setq model (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))
(while (setq ent (entsel "\nSelect object to label with layer name: "))
(setq obj (vlax-ename->vla-object (car ent))
pt (vlax-curve-getclosestpointto obj (cadr ent))
parm (vlax-curve-getparamatpoint obj pt)
vec (vlax-curve-getfirstderiv obj parm)
dir (angle '(0 0 0) vec)
offset 0.5 ;;adjust to desired offset may want to scale this based on annoscale
inspt (polar pt (+ dir (* pi 0.5)) offset)
)
(setq text (strcat "%<\\AcObjProp Object(%<\\_ObjId " (LM:objectid obj) ">%).Layer>%"))
(setq mtext (vlax-invoke model 'addmtext inspt 0 text))
(vla-put-rotation mtext dir)
(vla-put-attachmentpoint mtext acbottomcenter)
)
(princ)
)

Message 4 of 6
kenmart
in reply to: rcabrera9993G

This can easily be done with Property Sets.

Go to the Manage Tab in the Ribbon.  Click on Define Property Sets.  Right click on Property Set Definition and select new.   Name it appropriately, then go to Applies To Tab.   Select General Segment Label & Polyline.   Then go to the Definition Tab, click on Add Automatic Property Definition (button with lightning bolt).   In there you will see Layer Name, check the box.  Then click ok.   Next create a Label under General > Label Styles > Line.   The property sets will show up the Layout Tab under Text Contents.

 

Let us know if that  works?

 

Regards,

K

Message 5 of 6
rcabrera9993G
in reply to: kenmart

under the property definitions the closest option was "Layer" however when applied to a line using a label it shows as <(Name created for Property Set Definition):Layer)>

Message 6 of 6
kenmart
in reply to: rcabrera9993G

That tells me that you have not assigned the PS to the Polyline.   Right click on the Polyline go into Properties, Extended Data Tab and Assign the PS to PL.  Lower left corner.

 

I have included a sample drawing for your reference.

 

Regards,

K

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report