Why dose vlax-get-property only accept single word strings in this lisp?

Why dose vlax-get-property only accept single word strings in this lisp?

Satoews
Advocate Advocate
585 Views
6 Replies
Message 1 of 7

Why dose vlax-get-property only accept single word strings in this lisp?

Satoews
Advocate
Advocate

This is on civ3d but hopfully I am just missing a step in getting this to work in the programming:

 

(defun c:lbcng (/ ss i parcelLabel vlaObj lbl)
(vl-load-com)
  (setq ss (ssget))
  (setq i (sslength ss))
  (while (not (minusp (setq i (1- i))))
	   (setq parcelLabel (ssname ss i))
	   (setq vlaObj (vlax-ename->vla-object parcelLabel))
       (setq lbl (vlax-get-property vlaObj 'LineLabelStyleName))
	     (if (= lbl "Lot Labels")
		   (vlax-put-property vlaObj 'LineLabelStyleName "Lot Labels Plus Minus" )
           (vlax-put-property vlaObj 'LineLabelStyleName "CW house label" )))
(princ)	
)

So at the end of the lisp vlax-put-property vlaobj 'linelabelstylename will work if i put in "standard" but will not work with any argument strings more than one word.

 

Thanks in advance!

 

Shawn T
0 Likes
586 Views
6 Replies
Replies (6)
Message 2 of 7

dgorsman
Consultant
Consultant

You should check the object model for what you are attempting to modify.  It may have a restriction on what it can be set to.  The property name (LineLabelStyleName) would suggest it is looking for a style name which may check for valid names, or the style names themselves may not work with spaces or special characters.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 3 of 7

Satoews
Advocate
Advocate
;   LineLabelStyle = #<VLA-OBJECT IAeccLabelStyle 000000003ef43570>
;   LineLabelStyleName = "Lot Labels" 

I think it is showing the space as invalid, any way for myself to use Linelabelstyle at all? Tried different ways to input but it was shown as invalid. 

Shawn T
0 Likes
Message 4 of 7

Satoews
Advocate
Advocate

Ok troubleshot it some more and found that. 

 

(vlax-get-property vlaObj 'LineLabelStyleName)

will return any label style in any list, but. . .

 

(vlax-put-property vlaObj 'LineLabelStyleName "changetothis" )

will only change from the list of the general 'linelabelstylename, thats why standard worked.

 

I need to get to the parcel list of the 'linelabelstylename. 

 

So instead of

 

general - label styles - line - "standard" 

 

I need

 

Parcel - label styles - line - "Lot Labels Plus Minus"

 

Shawn T
0 Likes
Message 5 of 7

Satoews
Advocate
Advocate

So after a night of searching I was able to piece together this.

 

(defun C:changelabel ( / ss i parcelLabel vlaObj *acad* verstr c3d c3ddoc parcel_label_styles parcel_line_label_styles styl )
(if (setq ss (SSGET))
(progn
(setq i (sslength ss))
(while (not (minusp (setq i (1- i))))
(setq parcelLabel (ssname ss i))
(setq vlaObj (vlax-ename->vla-object parcelLabel))
(setq *acad* (vlax-get-acad-object))
(setq verstr (strcat "HKEY_LOCAL_MACHINE\\"
(if vlax-user-product-key
(vlax-user-product-key)
(vlax-product-key)
)
)
verstr (vl-registry-read verstr "Release")
verstr (substr verstr
1
(vl-string-search
"."
verstr
(+ (vl-string-search "." verstr) 1)
)
)
C3D (vla-getinterfaceobject
*acad*
(strcat "AeccXUiLand.AeccApplication." verstr)
)
)
(setq C3Ddoc (vlax-get c3d 'activedocument))
(setq parcel_label_styles (vlax-get c3ddoc 'parcellabelstyles))
(setq parcel_line_label_styles (vlax-get parcel_label_styles 'linelabelstyles))
(vlax-for x parcel_line_label_styles
(if
(eq (vlax-get x 'name) "Lot Labels Plus Minus")
(setq styl x)
)
)
(vlax-put-property vlaobj 'linelabelstyle styl)
(vlax-release-object c3ddoc)
(vlax-release-object c3d)
(princ)
)
)
)
)

Part from here (post 9 of 10) and part from here (post 6 of 7). Works to adjust parcel label styles in a selection set, just change "lot labels plus minus" to whatn you'd like.

 

 

 

Shawn T
0 Likes
Message 6 of 7

brianchapmandesign
Collaborator
Collaborator

Am curious Tornac, why wouldn't you just select similar and change in the properties?


"Very funny, Scotty. Now beam down my clothes.
0 Likes
Message 7 of 7

Satoews
Advocate
Advocate
Select similar would grab every label if I'm not mistaken. Changing them in properties also takes time, this lisp makes it much faster in comparison.
Shawn T
0 Likes