Jump to content

multiply an attribute definition by a factor...help


leonucadomi

Recommended Posts

hello masters:

I have definition of attributes and I need to change their numerical value

example :

 

3.288   (meters)   I need to touch that text (definition of attributes)  and convert it to feet

 

 

 

some help please?

 

thanks

 

Link to comment
Share on other sites

A start with this ?

(defun c:foo ( / ss ename nw_str)
  (vl-load-com)
  (setq ss (ssget '((0 . "INSERT") (66 . 1))))
  (cond
    (ss
      (repeat (setq n (sslength ss))
        (setq ename (vlax-ename->vla-object (ssname ss (setq n (1- n)))))
          (mapcar 
          '(lambda (att)
            (setq nw_str (rtos (/ (atof (vlax-get att 'TextString)) (cvunit 1 "meter" "feet"))))
            (if (/= nw_str "")
              (vlax-put att 'TextString nw_str)
            )
          )
          (vlax-invoke ename 'GetAttributes)
        )
      )
    )
  )
  (prin1)
)

 

  • Thanks 1
Link to comment
Share on other sites

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