TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: jlogan02 on July 28, 2021, 04:51:00 PM
-
(setq tagname1
"DESIGNER") (setq ss1
(ssget "x" '
((2 .
"TBLK_ATT_CTL")(66 .
1)))) )
)
)
)
In this code I'm setting the case of tagname1 to lower case. Correct?
I've tested 4 different users and tagname1 gets filled in with lowercase in all cases but mine. I checked their actual LogInName with and all were indeed lowercase except mine.
So it seems that I need to update their LogInName to be uppercase as the variable LogInName is read only. Or change the result of tagname1 after it's populated.
-
(strcase "Sample" T)
Specifying the witch as true will convert the string to lower case.
...click on the strcase function in your code block above to get the help for the function.
-
I did exactly that before I wrote the OP. It's clear to me, I read the help wrong.
Thanks for pointing that out,.
-
Note that you are applying strcase to the attribute tag as returned by vla-get-tagstring in order to use a case-insensitive match between the attribute tag and the value held by the variable tagname1, not to the value that is used to populate the attribute.
I might suggest the following changes:
(if (setq sel
(ssget "_X" '
((0 .
"INSERT") (2 .
"TBLK_ATT_CTL") (66 .
1)))) )
)
)
)
)
)
Here:
- (0 . "INSERT") is included in the ssget filter list
- vl-some will cease evaluation of the attributes when the target attribute is found
- An if statement is used to verify that a valid selection exists
- vlax-write-enabled-p checks that the attribute can be modified (i.e. does not reside on a locked layer) prior to modification