Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Set Annotative using Lisp or VLisp

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
EC-CAD
3672 Views, 6 Replies

Set Annotative using Lisp or VLisp

Hey all, it's been awhile since I was last here..

I need a way to get / set the Annotative Property of a Dimension.

The one shown under: 'Properties, Dimension, Misc(tab), 'Annotative (Yes,No)

If I use a DimStyle that has been set to Annotative, no problem, comes up as Yes.

If I use a DimStyle that is not set, but pick a Dim, I can manually toggle to Yes.

 

So, where is the 'IsAno' bit set ?

Be kind now 🙂

Bob

 

Tags (2)
6 REPLIES 6
Message 2 of 7
pbejse
in reply to: EC-CAD


@EC-CAD wrote:

Hey all, it's been awhile since I was last here..

I need a way to get / set the Annotative Property of a Dimension.

The one shown under: 'Properties, Dimension, Misc(tab), 'Annotative (Yes,No)

If I use a DimStyle that has been set to Annotative, no problem, comes up as Yes.

If I use a DimStyle that is not set, but pick a Dim, I can manually toggle to Yes.

 

So, where is the 'IsAno' bit set ?

Be kind now 🙂

Bob

 


(defun IsAnno-p (ent /  exd ano)
(vl-load-com)  
    (and (eq (vla-get-HasExtensionDictionary ent) :vlax-true)
	   (setq exd (vla-GetExtensionDictionary ent)
		 exd (vla-item exd "AcDbContextDataManager")
		 ano (vla-item exd "ACDB_ANNOTATIONSCALES")
		 )
	   (not (zerop (vla-get-Count ano)))
	   )
  )

 

  

(IsAnno-p
  (setq itm (vlax-ename->vla-object (Car (entsel))))
  )

 

HTH

 

EDIT:    Smileys

Message 3 of 7
pbejse
in reply to: pbejse

And in case you're wondering how i would set  an object to Annotative

 

Use change or chprop

 

(defun c:test (/ ss)
  (setq ss (ssget '((0 . "DIMENSION,*TEXT"))))
  (repeat (sslength ss)
    (if	(not
	  (IsAnno-p (vlax-ename->vla-object (setq e (ssname ss 0))))
	  )
      (command "_chprop" e "" "A" "Yes" "")
      )
    (ssdel e ss)
    )
  )

HTH

 

Message 4 of 7
alanjt_
in reply to: pbejse

I use this to check, which accounts for objects that were once annotative but are no longer..

 

(defun AT:isAnnotative (ename / check)
  ;; Check if entity is annotative
  ;; ename - ename to check (returns T if annotative)
  ;; Alan J. Thompson
  (and (setq check (cdr (assoc 360 (entget ename))))
       (setq check (dictsearch check "AcDbContextDataManager"))
       (setq check (dictsearch (cdr (assoc -1 check)) "AcDb_AnnotationScales"))
       (assoc 350 check)
  )
)

 

Message 5 of 7
EC-CAD
in reply to: alanjt_

Thanks for the rapid response, forgive the feedback.

The (IsAnno function works, no problems.

 

When using    (command "_chprop" ent "" "A" "Yes" ""); Set to Annotative,

If the entity is not in 'Current Space', it throws an error.

Problem may be I'm in a Paper Space Tab when I issue the command to run the routine.

 

So, now I need to figure out how to 'set' the Current Space ?

 

I tried something like this:

 (defun set_current_space ( cur_lay / acad acdoc )
  (vl-load-com)
   (setq acad (vlax-get-acad-object)
      acdoc (vla-get-ActiveDocument acad)
   ); setq
   (if (not (= cur_lay "Model"))
     (vla-put-ActiveLayout acdoc cur_lay)
   ); if
 ); function

..

Didn't get it done. Still errors.

 

Thanks to all whom responded.

Bob


 

Message 6 of 7
alanjt_
in reply to: EC-CAD

(defun _setLayoutFromEName (ename) (setvar 'CTAB (cdr (assoc 410 (entget ename)))))

 

(_setLayoutFromEName (car (entsel)))

 

Message 7 of 7
pbejse
in reply to: EC-CAD


@EC-CAD wrote:

Thanks for the rapid response, forgive the feedback.

 

When using    (command "_chprop" ent "" "A" "Yes" ""); Set to Annotative,

If the entity is not in 'Current Space', it throws an error.

Problem may be I'm in a Paper Space Tab when I issue the command to run the routine.

 

Bob


 

Listen, changing Text/Dimensions to Annotative on paperspace tab doesnt do you any good, as a matter of fact it doesnt make any diffrence at all.

 

But for your reference:

use (layoutlist);<-------

 

(defun  c:test (/ ss)
  (vl-load-com)
  (setq curtab (getvar 'Ctab))
  (foreach
     tb (cons "Model" (layoutlist))
    (setvar 'Ctab tb)
    (if (setq
          ss (ssget "_X" (list '(0 . "DIMENSION,*TEXT") (cons 410 tb)))
          )
      (repeat (setq i (sslength ss))
        (if (not
              (IsAnno-p
                (vlax-ename->vla-object
                  (setq e (ssname ss (setq i (1- i))))
                  )
                )
              )
          (command "_chprop" e "" "A" "Yes" "")
          )
        )
      )
    )
  (setvar 'ctab curtab)
  (princ)
  )

The code above will not give you error message, but it wont change the Annotative properties of the entities selected.on paperspace.

 

try to change TEXT annotative prperty using chprop via command line .

 

Can not be set to Annotative in PaperSpace.

 

Of course  you can  set annotative on/off via _properties but then again ti doesnt make a diffrence on the behavior of those entities.

 

IMO better set paperpspace entiteis to NO, it matters somewhat  with prinitng depending on your textstyle settings

Match text orientation to layout. <------

 

personally I wouldnt even use annotative on paperspace, so if your company annotates drawon paperpspace Annotative or not wouldnt make a difference, but thats just me. 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost