Ingo
Guest
Good morning to all of you
I'm desperately looking, without being able to create a lisp (autolip or visuallisp? )
given a file with varei presentations (layout)
I would like to copy the position scale and center from the current viewport to all other present of the dwg
I started mixing pieces of coduce found here and there but without really being able to do it
this code allows you to copy an object in all current presentations,
(it could be okay if someone reexces to change it so as to delete the presentations present in the other layouts before lashing the command that copies it)
I don't know if I managed to explain correctly thanks to your help
I'm desperately looking, without being able to create a lisp (autolip or visuallisp? )
given a file with varei presentations (layout)
I would like to copy the position scale and center from the current viewport to all other present of the dwg
I started mixing pieces of coduce found here and there but without really being able to do it
this code allows you to copy an object in all current presentations,
(it could be okay if someone reexces to change it so as to delete the presentations present in the other layouts before lashing the command that copies it)
I don't know if I managed to explain correctly thanks to your help
Code:
(defun c:cpp (/ acdoc layouts *error* lay clayout ss sa)
; copies selected objects in all presentations.
(vl-load-com)
(setq layouts (vla-get-layouts)
acdoc (vla-get-activedocument (vlax-get-acad-object)))
)
(defun *error* (msg)
(and msg
(g)
(member (strcase msg) '("function canceled" "quit / exit abort" "function canceled" "quitter / exit abandon"))
(princ (strcat "\nerror: " msg))
)
)
(if ss (vla-delete ss))
(vla-endundomark acdoc)
(principal)
)
(vla-startundomark acdoc)
(g)
(and
(/= (setq clayout (getvar 'ctab)) "model")
(= (getvar 'cvport) 1)
)
(progn
(principal "\n** command not allowed in object space**)
(quite)
)
)
(if)
(g)
(setq ss (ssgetfirst))
(setq ss (ssget))
)
(setq sa (bss:ss2safearray ss))
)
(progn
(vlax-for Layout)
(if (and (eq:vlax-false (vla-get-modeltype lay))
(/= clayout (vla-get-namelay))
)
(vla-copyobjects acdoc sa (vla-get-block lay))
)
);vlax-for layout
(principal "\ncopy done!")
)
);if ssget
(*rror* nil)
(cpp)
(defun bs:ss2safearray (sset / i entlst)
(setq i 0)
(sslength sset)
(setq entlst (cons (vlax-name->vla-object (ssname sset i)))
(setq i (1+ i))
)
(vlax-safearray-fill
(vlax-make-safearray vlax-vbobject (cons 0 (1- (length entlst))))
Enter
)
)
(principal "\command to use: cpp")
(principal)