Author Topic: Remove annotative properties on dimension entity  (Read 2077 times)

0 Members and 1 Guest are viewing this topic.

Lupo76

  • Bull Frog
  • Posts: 343
Remove annotative properties on dimension entity
« on: July 21, 2016, 02:25:01 AM »
With the following line of code I can see all the properties associated to an object:
(vlax-dump-object vlaobj T)

Can you help me find the property that controls whether a dimension entity is annotative?


T.Willey

  • Needs a day job
  • Posts: 5251
Re: Remove annotative properties on dimension entity
« Reply #1 on: July 21, 2016, 05:08:06 AM »
I just post a code I use to find stuff associated with entities:
https://www.theswamp.org/index.php?topic=51751.0

This will allow you to select an entity and step though the stuff that makes it up.  For you, select an entity, then in the dialog select the extension dictionary (this is the first ename coded by number 360), then select the ename under "AcDbContextDataManager", as this is the name of the dictionary but the ename is the item after it in the list, then you will see a dictionary title "ACDB_ANNOTATIONSCALES" and you will select the ename after that.  Then you will see a list of all the annotation scales, but you will have to look at them as they are named crypticly.

Once you find how to get there, I think you can use the 'dictremove' lisp function to remove one or more annoscales from the entity.

I don't use annoscales, but I hope this helps.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Crank

  • Water Moccasin
  • Posts: 1503
Re: Remove annotative properties on dimension entity
« Reply #2 on: July 23, 2016, 06:25:21 AM »
Code: [Select]
(defun is_Annotative (ent / xdata)
(setq xdata (cadr (assoc -3 (entget ent '("AcadAnnotative")))))
(and xdata (= (cdr (nth 4 xdata)) 1)) ; returns T or nil
)
Vault Professional 2023     +     AEC Collection

Lupo76

  • Bull Frog
  • Posts: 343
Re: Remove annotative properties on dimension entity
« Reply #3 on: July 24, 2016, 10:30:29 AM »
Code: [Select]
(defun is_Annotative (ent / xdata)
(setq xdata (cadr (assoc -3 (entget ent '("AcadAnnotative")))))
(and xdata (= (cdr (nth 4 xdata)) 1)) ; returns T or nil
)

thank you!

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Remove annotative properties on dimension entity
« Reply #4 on: July 25, 2016, 05:52:20 AM »
@ Crank:
Your code works in most cases, but not on annotative mleaders and block references (note: I use BricsCAD instead of AutoCAD).

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Remove annotative properties on dimension entity
« Reply #5 on: July 26, 2016, 04:37:10 AM »
Code - Auto/Visual Lisp: [Select]
  1. ; (ObjectAnnotative_P (vlax-ename->vla-object (car (entsel))))
  2. (defun ObjectAnnotative_P (obj / cnt)
  3.   (and
  4.     (= :vlax-true (vla-get-hasextensiondictionary obj))
  5.     (not ; Check for the presence of the "ACDB_ANNOTATIONSCALES" dictionary.
  6.         (vl-catch-all-apply
  7.           (function
  8.             (lambda ()
  9.               (setq cnt
  10.                 (vla-get-count
  11.                   (vla-item
  12.                     (vla-item
  13.                       (vla-getextensiondictionary obj)
  14.                       "AcDbContextDataManager"
  15.                     )
  16.                     "ACDB_ANNOTATIONSCALES"
  17.                   )
  18.                 )
  19.               )
  20.             )
  21.           )
  22.         )
  23.       )
  24.     )
  25.     (/= 0 cnt) ; Check if the dictionary is not empty.
  26.   )
  27. )

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Remove annotative properties on dimension entity
« Reply #6 on: July 26, 2016, 01:25:48 PM »
I have the following in my library, but I can't recall if I've tested it under all possible circumstances:
Code - Auto/Visual Lisp: [Select]
  1. (defun annotative-p ( ent / dic )
  2.     (and
  3.         (member  '(102 . "{ACAD_XDICTIONARY") (setq ent (entget ent)))
  4.         (setq dic (cdr (assoc 360 ent)))
  5.         (setq dic (dictsearch dic "acdbcontextdatamanager"))
  6.         (setq dic (dictsearch (cdr (assoc -1 dic)) "acdb_annotationscales"))
  7.         (dictnext (cdr (assoc -1 dic)) t)
  8.     )
  9. )