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.
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) ) ) )