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

LISP and C3D labels

2 REPLIES 2
Reply
Message 1 of 3
mfernandes
602 Views, 2 Replies

LISP and C3D labels

I need to label a parcel line or just a line using LISP.

Anyone have a sample code

1. to label a line with a perticular label style using LISP

2. to chage a label style using LISP

 

thanks in advance.

2 REPLIES 2
Message 2 of 3
Jeff_M
in reply to: mfernandes

Changing a label style:

http://forums.autodesk.com/t5/AutoCAD-Civil-3D-Customization/Change-Label-Style/m-p/2532483#M3968

 

Adding labels by lisp must be done via a call to the command that adds labels. You can set the default style to use before doing so.

 

Here's some example code I wrote back for C3D2009, but is still valid for the newer releases by adding the pertinent values for them in the (cond) check ( search of the forum will yeild what you need if you can't figure it out):

  (vl-load-com)
  (setq vrsn (vlax-product-key))
  (cond ((vl-string-search "R16.2" vrsn)(setq appstr "3.0"));;2006
	((vl-string-search "R17.0" vrsn)(setq appstr "4.0"));;2007
        ((vl-string-search "R17.1" vrsn)(setq appstr "5.0"));;2008
        ((vl-string-search "R17.2" vrsn)(setq appstr "6.0"));;2009
	(t (alert "This version of C3D not supported!"))
	)
  (if (and appstr
	   (or *acad*
	       (setq *acad* (vlax-get-acad-object))
	       )
	   (or *AeccApp*
	       (setq *AeccApp* (vla-getinterfaceobject *acad*
				 (strcat "AeccXUiLand.AeccApplication." appstr)))
	       )
	   (or *AeccDoc*
	       (setq *AeccDoc* (vlax-get *AeccApp* 'ActiveDocument))
	       )
	   )
    ;;;all the prelims are OK, carry on
    (progn
      (setq ParcelLblStyles (vlax-get *AeccDoc* 'parcellabelstyles)
	    AreaLabelStyles (vlax-get ParcelLblStyles 'arealabelstyles)
	    CurveLabelStyles (vlax-get ParcelLblStyles 'curvelabelstyles)
	    LineLabelStyles (vlax-get ParcelLblStyles 'Linelabelstyles)
	    )
      )
    )

 

 

Jeff_M, also a frequent Swamper
EESignature
Message 3 of 3
mfernandes
in reply to: Jeff_M

thanks a bunch Jeff,this is a great starting point

cheers

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report