Adding annoallvisible to an existing lisp

Adding annoallvisible to an existing lisp

jpetrozzi289LU
Explorer Explorer
1,292 Views
7 Replies
Message 1 of 8

Adding annoallvisible to an existing lisp

jpetrozzi289LU
Explorer
Explorer

I have an existing list used to move, create and edit the layouts. When copying layouts, the "show annotative objects" in the new layout turns off. I know the command to turn it on but I can't figure out how to add it to my lisp.

The command is ANNOALLVISIBLE and it needs to be set to 1. Can someone please help me add this in?

This is the copy layout portion of the lisp:

 

(defun _CopyTab ( idx lst / upp oldname oldlay newname i objlst newlay newblk )

(setq upp (mapcar 'strcase lst))

(foreach x idx
(setq oldname (nth x lst)
oldlay (vla-item aclay oldname)
newname (strcat oldname " (2)")
i 2
objlst nil
)
(while (member (strcase newname) upp)
(setq newname (strcat oldname " (" (itoa (setq i (1+ i))) ")"))
)
(setq newlay (vla-add aclay newname)
newblk (vla-get-block newlay)
lst (append lst (list newname))
)
(vla-copyfrom newlay oldlay)

(if
(vlax-for o (vla-get-block oldlay)
(setq objlst (cons o objlst))
)
(vla-copyobjects acdoc
(vlax-make-variant
(vlax-safearray-fill
(vlax-make-safearray vlax-vbobject (cons 0 (1- (length objlst)))) (reverse objlst)
)
)
newblk
)
)
)

lst
)

0 Likes
1,293 Views
7 Replies
Replies (7)
Message 2 of 8

jerry.ford
Alumni
Alumni

ANNOALLVISIBLE is a system variable.  Have you tried (setvar "annoallvisible" 1).


Jerry Ford

Senior Interaction Designer
0 Likes
Message 3 of 8

jpetrozzi289LU
Explorer
Explorer

Yes, ANNOALLVISIBLE is set to <1>.

0 Likes
Message 4 of 8

rapidcad
Collaborator
Collaborator

Could it be that you missed the fact that ANNOALLVISIBLE is unique to each layout and modelspace too?

 

Hope this helps.

 

ADN CAD Developer/Operator
0 Likes
Message 5 of 8

jpetrozzi289LU
Explorer
Explorer

That's the issue, I want to avoid having to manually go to each layout space to turn on my annotations. When I use my lisp routine for creating layouts I would like the lisp to turn "show all annotative objects" on automatically. Any time I create/copy a paper space layout the annotative objects turn off in that new layout.

0 Likes
Message 6 of 8

dbroad
Mentor
Mentor

I'm kind of surprised you waited a year rather than just take the low tech approach and cycle through the layouts as follows

(setq ac (vlax-get-acad-object)
      do (vla-get-activedocument ac)
      la (vla-get-activelayout do)
      )
(vlax-for n (vla-get-layouts do)
  (vla-put-activelayout do n)
  (setvar "annoallvisible" 1)
  )
(vla-put-activelayout do la)

Yes, that is a bit distracting but it works.  Knowing that it was related to each layout, should have given you enough clues to search.  My general approach is to look at the object properties and methods first.  LA above can display its properties and methods  with (vlax-dump-object la t).  If that ended in a dead end, my second approach would be to assume xdata storage.  Get the layout entity and display its xdata.  See following

(entget(vlax-vla-object->ename la)'("*"))
returns
....
(-3 ("ACAD_PSEXT"
	(1000 . "Adobe PDF")
	(1000 . "Adobe PDF Converter")
	(1000 . "Documents\\*.pdf")
	(1000 . "")
	(1070 . 0)
      )
      ("AcadAnnoAV" (1070 . 1))
  )
)

So there are two applications related to each layout in this particular drawing.  All you would need to do is to make the obvious change.

 

(setq ac (vlax-get-acad-object)
      do (vla-get-activedocument ac)
      la (vla-get-activelayout do)
      )

(vlax-for n (vla-get-layouts do)
  (setq e (vlax-vla-object->ename n))
  (entmod (cons(cons -1 e) '((-3 ("AcadAnnoAV" (1070 . 1)))))))

I'll leave it up to you to complete the task by changing the modelspace layout object's annoallvisible setting.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 7 of 8

jpetrozzi289LU
Explorer
Explorer

Can you dumb that down a bit for me? What are those codes that you listed and how do I apply them? I don't know anything about programming for CAD, just the basics for reading lisp commands.

0 Likes
Message 8 of 8

dbroad
Mentor
Mentor

I don't know how to respond to that.  The last block of code just turns on annoallvisible in all the layouts except modelspace. Just cut and paste it into your lisp command.  If you have specific questions, then ask them.  Time to do some study and to read the help files.

Architect, Registered NC, VA, SC, & GA.
0 Likes