Jump to content

Extract Mleader annotative properties


broncos15

Recommended Posts

I had a quick question on the annotative scale properties of mleaders. I cannot find any documentation in the acadauto.chm about the annotative scale properties of an object. What I am wanting to do is to add in the current annotative scale (easily done using the -objectscale command), delete all the annotative scales of the mleaders besides the current one, then add them back. If I knew how to find/store the scales associated with each object I know that I could accomplish it using a repeat loop. Does anyone have any suggestions?

Link to comment
Share on other sites

To provide an insight into where the annotative data is stored, the following function will return all annotative scale associated with a given MLeader entity:

(defun getmleaderannoscales ( ent / dic enx itm rtn )
   (if
       (and
           (setq enx (entget ent))
           (setq dic (cdr (assoc 360 (cdr (member '(102 . "{ACAD_XDICTIONARY") enx)))))
           (setq dic (cdr (assoc -1  (dictsearch dic "acdbcontextdatamanager"))))
           (setq dic (cdr (assoc -1  (dictsearch dic "acdb_annotationscales"))))
       )
       (while (setq itm (dictnext dic (not itm)))
           (setq rtn (cons (cdr (assoc 300 (entget (cdr (assoc 340 itm))))) rtn))
       )
   )
   (reverse rtn)
)

_$ (getmleaderannoscales (car (entsel)))
("1:1" "1:4")

Link to comment
Share on other sites

To provide an insight into where the annotative data is stored, the following function will return all annotative scale associated with a given MLeader entity:

(defun getmleaderannoscales ( ent / dic enx itm rtn )
   (if
       (and
           (setq enx (entget ent))
           (setq dic (cdr (assoc 360 (cdr (member '(102 . "{ACAD_XDICTIONARY") enx)))))
           (setq dic (cdr (assoc -1  (dictsearch dic "acdbcontextdatamanager"))))
           (setq dic (cdr (assoc -1  (dictsearch dic "acdb_annotationscales"))))
       )
       (while (setq itm (dictnext dic (not itm)))
           (setq rtn (cons (cdr (assoc 300 (entget (cdr (assoc 340 itm))))) rtn))
       )
   )
   (reverse rtn)
)

_$ (getmleaderannoscales (car (entsel)))
("1:1" "1:4")

Lee, thank you so much for the help, that function is super useful! It's weird that AutoCad made it so difficult to extract the mleader scales (the fact that you have to do a dictionary search for them seems ridiculous).
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...