Kowal Posted August 28, 2017 Share Posted August 28, 2017 How to get label names existing in a drawing using visuallisp. Quote Link to comment Share on other sites More sharing options...
Commandobill Posted August 28, 2017 Share Posted August 28, 2017 Look here Quote Link to comment Share on other sites More sharing options...
Kowal Posted August 28, 2017 Author Share Posted August 28, 2017 Thanks Commandobill. I modified some code from this forum. Maybe someone will use it. The program works only in Civil 3D 2014, but it's not a problem. (prompt "\ncglab") (vl-load-com) (defun c:cglab (/ C3Ddoc ptlblstyles styl lst) (setq C3Ddoc (vla-get-activedocument (vla-getinterfaceobject (vlax-get-acad-object) "AeccXUiLand.AeccApplication.10.3"))) (setq ptlblstyles (vlax-get C3Ddoc 'pointlabelstyles)) (vlax-for styl ptlblstyles (print (vlax-get styl 'name)) (setq lst (cons (vlax-get styl 'name) lst)) ) (print lst) (princ) ) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 29, 2017 Share Posted August 29, 2017 Here is one way to get the versions. What are you trying to do ? It gets complicated playing with the styles, some things you look for are not located where you think they should be. ;vercheck.lsp version check for *aecc objects (defun ah:vercheck ( / vrsn appstr) (vl-load-com) (if ((lambda (vrsn) (cond ((vl-string-search "R17.2" vrsn) (setq appstr "6.0")) ;09 ((vl-string-search "R18.0" vrsn) (setq appstr "7.0")) ;10 ((vl-string-search "R18.1" vrsn) (setq appstr "8.0")) ;11 ((vl-string-search "R18.2" vrsn) (setq appstr "9.0")) ;12 ? ((vl-string-search "R19.0" vrsn) (setq appstr "10.0")) ;13 ((vl-string-search "R19.1" vrsn)(setq appstr "10.3"));;2014 ((vl-string-search "R20.0" vrsn)(setq appstr "10.4"));;2015 ((vl-string-search "R20.1" vrsn)(setq appstr "10.5"));;2016 ((vl-string-search "R21.0" vrsn)(setq appstr "11.0"));;2017 ((vl-string-search "R22.0" vrsn)(setq appstr "12.0"));;2018 ((alert "This version of C3D not supported!")) ) ) (vlax-product-key) ) ; end if condition progn is true (progn (cond (*AeccDoc*) ((setq *AeccDoc* (vlax-get (cond (*AeccApp*) ((setq *AeccApp* (vla-getinterfaceobject (cond (*Acad*) ((setq *Acad* (vlax-get-acad-object))) ) (strcat "AeccXUiLand.AeccApplication." appstr) ) ) ) ) 'ActiveDocument ) ) ) ) ; end main cond ) ; end progn ) ; end if vsrn ) You may be interested in this. CH Points style.zip Chcontourstoolbar.zip Quote Link to comment Share on other sites More sharing options...
ronjonp Posted August 29, 2017 Share Posted August 29, 2017 Here is one way to get the versions. What are you trying to do ? It gets complicated playing with the styles, some things you look for are not located where you think they should be. ;vercheck.lsp version check for *aecc objects (defun ah:vercheck ( / vrsn appstr) (vl-load-com) (if ((lambda (vrsn) (cond ((vl-string-search "R17.2" vrsn) (setq appstr "6.0")) ;09 ((vl-string-search "R18.0" vrsn) (setq appstr "7.0")) ;10 ((vl-string-search "R18.1" vrsn) (setq appstr "8.0")) ;11 ((vl-string-search "R18.2" vrsn) (setq appstr "9.0")) ;12 ? ((vl-string-search "R19.0" vrsn) (setq appstr "10.0")) ;13 ((vl-string-search "R19.1" vrsn)(setq appstr "10.3"));;2014 ((vl-string-search "R20.0" vrsn)(setq appstr "10.4"));;2015 ((vl-string-search "R20.1" vrsn)(setq appstr "10.5"));;2016 ((vl-string-search "R21.0" vrsn)(setq appstr "11.0"));;2017 ((vl-string-search "R22.0" vrsn)(setq appstr "12.0"));;2018 ((alert "This version of C3D not supported!")) ) ) (vlax-product-key) ) ; end if condition progn is true (progn (cond (*AeccDoc*) ((setq *AeccDoc* (vlax-get (cond (*AeccApp*) ((setq *AeccApp* (vla-getinterfaceobject (cond (*Acad*) ((setq *Acad* (vlax-get-acad-object))) ) (strcat "AeccXUiLand.AeccApplication." appstr) ) ) ) ) 'ActiveDocument ) ) ) ) ; end main cond ) ; end progn ) ; end if vsrn ) You may be interested in this. Here is another way to get the versions ( Jeff M ) Quote Link to comment Share on other sites More sharing options...
Kowal Posted September 1, 2017 Author Share Posted September 1, 2017 Thank you for your help. BIGAL thanks for the programs. I need one more information. How to set the label to none? If none label is set. (vlax-get-property (vlax-ename->vla-object (car (entsel))) 'LabelStyle) Returns: nil If any label is set. (vlax-get (vlax-get-property (vlax-ename->vla-object (car (entsel))) 'LabelStyle) 'Name) Returns for example: "Point Number Only" Setting the label on nil returns an error. (vlax-put-property (vlax-ename->vla-object (car (entsel))) 'LabelStyle nil) How to set the label to none? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 2, 2017 Share Posted September 2, 2017 Have a look at this. You change the 'Pointgroups style not the entity. This is what I was getting at look elsewhere to change some stuff. The entity tells what style is in use. CH Points style.zip Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.