Jump to content

Recommended Posts

Posted
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.

  • Replies 27
  • Created
  • Last Reply

Top Posters In This Topic

  • Ohnoto

    13

  • Lee Mac

    12

  • stevesfr

    2

  • alanjt

    1

Top Posters In This Topic

Posted

PERFECTO :-)

 

Sorry for the confusion on dividing by 100, sometimes the simplest things avoid my mind.

Posted

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))) 
)

Posted
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".

Posted

Kinda what I thought, which would mean editting your defun code for applying an attribute, at the bottom, right?

Posted

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...