Hi, I not sure if this something easy to do. I did some search and got some code from 2009 post which not really working for me.since I am not a pofr for autocad civil3D and just staring to learn how programing with autolisp, I am having trouble to debug the code myself.I
(defun xp() (setq sset1 (ssget "X" '((0 . "AECC_PARCEL_SEGMENT")))) (COMMAND "EXPLODE" SSET1 "") if (= (setq ss (ssget "X" '((0 . "AECC_COGO_POINT")))) nil) (setq ss (ssget "x" '((0 . "AECC_COGO_POINT")))) ) ;FILTERS UNCLOSED POLYLINES (defun c:changestyle() (setq xlabel (vlax-ename->vla-object (car (entsel)))) (setq prod (vlax-product-key)) (setq prodStr (strcat "AeccXUiLand.AeccApplication" (cond ((vl-string-search "\\R17.0\\" prod) ".4.0" ) ;;2007 ((vl-string-search "\\R17.1\\" prod) ".5.0" ) ;;2008 ((vl-string-search "\\R17.2\\" prod) ".6.0" ) ;;2009 ((vl-string-search "\\R18.0\\" prod) ".7.0" ) ;;2010 (t "") ) ) ) (and (setq *acad* (vlax-get-acad-object)) (setq C3D (vla-getinterfaceobject *acad* prodStr)) (setq C3Ddoc (vla-get-activedocument C3D)) ) (setq Point_label_style (vlax-get c3ddoc 'PointLabelStyles)) (vlax-for x Point_label_style (if (eq (vlax-get x 'name) "_WA Topo Data w-Elev") (setq Point_label x) ) ) (if (vlax-get xlabel 'Style) ;;;make sure the point has a style, else it will error (vlax-put xlabel 'labelstyle Point_label) ) (vlax-release-object c3ddoc) (vlax-release-object c3d) (princ) )
hope some one can help me out a bit here. please and thanks
Here is the code updated to work through C3D2014. Note that the style to be used needs to be changed to suit your styles.
(defun c:changestyle (/ *acad* c3d c3ddoc point_label point_label_style prod prodstr xlabel) (setq xlabel (vlax-ename->vla-object (car (entsel)))) (setq prod (vlax-product-key)) (setq prodStr (strcat "AeccXUiLand.AeccApplication" (cond ((vl-string-search "\\R17.0\\" prod) ".4.0" ) ;;2007 ((vl-string-search "\\R17.1\\" prod) ".5.0" ) ;;2008 ((vl-string-search "\\R17.2\\" prod) ".6.0" ) ;;2009 ((vl-string-search "\\R18.0\\" prod) ".7.0" ) ;;2010 ((vl-string-search "\\R18.1\\" prod) ".8.0" ) ;;2011 ((vl-string-search "\\R18.2\\" prod) ".9.0" ) ;;2012 ((vl-string-search "\\R19.0\\" prod) ".10.0" ) ;;2013 ((vl-string-search "\\R19.1\\" prod) ".10.3" ) ;;2014 (t "") ) ) ) (and (setq *acad* (vlax-get-acad-object)) (setq C3D (vla-getinterfaceobject *acad* prodStr)) (setq C3Ddoc (vla-get-activedocument C3D)) ) (setq Point_label_style (vlax-get c3ddoc 'PointLabelStyles)) (vlax-for x Point_label_style (if (eq (vlax-get x 'name) "Standard") ;;<<<CHange to the style name you want to use! (setq Point_label x) ) ) (if (vlax-get xlabel 'Style) (vlax-put xlabel 'labelstyle Point_label) ) (vlax-release-object c3ddoc) (vlax-release-object c3d) (princ) )
Yes. Here's some example code to set the first text component in the PointLabelStyle "Elevation only" to not be visible:
(setq Point_label_styles (vlax-get c3ddoc 'PointLabelStyles)) (setq lblstyl1 (vlax-get-property Point_label_styles 'item "Elevation Only")) (setq txtcomps (vlax-get lblstyl1 'textcomponents)) (setq txtcomp1 (vlax-get-property txtcomps 'item 0)) (setq visible (vlax-get-property txtcomp1 'visibility)) (vlax-put-property visible 'value :vlax-false)