Lee Mac Posted April 28, 2011 Posted April 28, 2011 Close... oh so close... For the value of 77.5725, the stationing would be 0+78, but it put the value of 77+57. as another example, If the footage was 1058.4878, the stationing would be 10+58, 105687.4578 would be 1056+87. Oh right - that wasn't so clear from your other posts so I took a wild guess at it, I'll look to revise the code. Quote
Ohnoto Posted April 28, 2011 Author Posted April 28, 2011 PERFECTO :-) Sorry for the confusion on dividing by 100, sometimes the simplest things avoid my mind. Quote
Ohnoto Posted April 28, 2011 Author Posted April 28, 2011 I would like to add in a parameter that if the STA tag is blank, it won't put a value in the STA tag, how would I do that? I tried this, and it didn't work. (if (/= "STA" null) (LM:SetAttributeValue o "STA" (vl-string-subst "+" "." (rtos (/ s 100.) 2 2))) ) Quote
Lee Mac Posted April 28, 2011 Posted April 28, 2011 I tried this, and it didn't work. (if (/= "STA" null) (LM:SetAttributeValue o "STA" (vl-string-subst "+" "." (rtos (/ s 100.) 2 2))) ) "STA" is just a string, it will never be nil - you need to get the value associated with the attribute with tag "STA". Quote
Ohnoto Posted April 28, 2011 Author Posted April 28, 2011 Kinda what I thought, which would mean editting your defun code for applying an attribute, at the bottom, right? Quote
Lee Mac Posted April 28, 2011 Posted April 28, 2011 Replace: (LM:SetAttributeValue o "STA" (vl-string-subst "+" "." (rtos (/ s 100.) 2 2))) With: (vl-some (function (lambda ( a ) (and (eq (strcase (vla-get-tagString a)) "STA") (or (eq "" (vla-get-textstring a)) (progn (vla-put-textstring a (vl-string-subst "+" "." (rtos (/ s 100.) 2 2))) t ) ) ) ) ) (vlax-invoke o 'getattributes) ) And remove the 'LM:SetAttributeValue' subfunction, since it is no longer required. Quote
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.