Jump to content

Converting entity to string.


tama010

Recommended Posts

Hello,

 

I am currently trying to store any dimensional text to a string value

 

I have started to use entsel to select single dimension to store the entity

 

How should i approach to store the dimensional text from the entity information as a string value?

 

This is an example what I want to store the string as: "%%C "

 

Any help will be appreciated.

Thank you

Link to comment
Share on other sites

Welcome to CADTutor.

 

Consider the TextOverride Property; quick example:

 

(vl-load-com)

(defun c:FOO (/ ss oDim s)
 (if (setq ss (ssget ":S:E" '((0 . "DIM*"))))
   (progn
     (setq oDim (vlax-ename->vla-object (ssname ss 0)))
     (prompt
       (strcat "\nTextOverride: "
               (if
                 (and
                   (vlax-property-available-p oDim 'textoverride)
                   (/= "" (setq s (vla-get-textoverride oDim)))
                 )
                  s
                  "<Empty String> "
               )
       )
     )
   )
 )
 (princ)
)

Link to comment
Share on other sites

As an alternative to ActiveX(COM) and for compatibility on a Mac, you could also use DXF group 1, e.g.:

(defun c:test ( / e i s )
   (if (setq s (ssget "_:L" '((0 . "*DIMENSION") (1 . "~%%C <>"))))
       (repeat (setq i (sslength s))
           (setq e (entget (ssname s (setq i (1- i)))))
           (entmod (subst '(1 . "%%C <>") (assoc 1 e) e))
       )
   )
   (princ)
)

Link to comment
Share on other sites

Thank you for your help Blackbox, the textoverride property works perfect!

 

You're very welcome, tama010; I'm happy to help. :beer:

 

Cheers

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