Jump to content

Copy Plot configuration...to many plan at once?


bono05

Recommended Posts

Hi,

It's possible to "copy" a plot configuration to other plans (with many layout) at once?

 

Actually i'm using a lisp this to copy a plot config to all other layout but in the same plan.

 

Many thanks for help! 8)

Link to comment
Share on other sites

Using a script you will be suprised how quick it can carry out mods on multiple dwgs. You do not want user interaction, so your lisp to copy config to layouts would have to have any questions changed to pre-set the answer required.

 

eg script

open DWG1 (load "myplotconfigs") Close Y
open DWG2 (load "myplotconfigs") Close Y

 

Ps have a cup of coffee and all may be done by the time you finish the cup.

Link to comment
Share on other sites

Hi guy's!

 

Actually i used this one to "copy" a plot config to aal others layouts...but from the same plan.

It's possible to have a similair lisp but for a lot's of dwg' at once?

 

(defun c:mpl(/ s *errmpl* MsgBox multiplie_plt)

 

;;;---------------------------------------------------------------

;;;

;;; Gestion des erreurs

;;;

;;;---------------------------------------------------------------

 

(defun *errmpl* (msg)

(if (/= msg "Function cancelled")

(if (= msg "quit / exit abort")

(princ)

(princ (strcat "\nErreur : " msg))

)

(princ)

)

(setq *error* s)

(vla-endundomark (vla-get-activedocument (vlax-get-acad-object)))

(princ)

)

 

;;;---------------------------------------------------------------

;;;

;;; Message

;;;

;;;---------------------------------------------------------------

 

(defun MsgBox (Titre Bouttons Message / Reponse WshShell)

(vl-load-com)

(setq WshShell (vlax-create-object "WScript.Shell"))

(setq Reponse (vlax-invoke WshShell 'Popup Message 0 Titre (itoa Bouttons)))

(vlax-release-object WshShell)

Reponse

)

 

;;;---------------------------------------------------------------

;;;

;;; Routine principale

;;;

;;;---------------------------------------------------------------

 

(defun multiplie_plt(/ config doc i init_mpl j lay liste_lay lst n position positiondests resultat)

 

(defun liste_destination()

(start_list "dest")

(mapcar 'add_list (vl-remove (nth (atoi position) liste_lay) liste_lay))

(end_list)

(set_tile "dest" positiondest)

)

 

(if (setq init_mpl (findfile "mpl.dcl"))

(progn

(setq init_mpl (load_dialog init_mpl)

liste_lay nil

n 1

position "0"

positiondest "0"

)

(vlax-for lay (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))

(setq lst (cons (cons (vla-get-taborder lay) lay) lst))

)

(while (assoc n lst)

(setq liste_lay (cons (vla-get-name (cdr (assoc n lst))) liste_lay))

(if (and (eq (vla-get-name (cdr (assoc n lst))) (getvar "ctab")) (zerop (getvar "tilemode")))

(setq position (itoa (1- n)))

)

(setq n (1+ n))

)

(setq liste_lay (reverse liste_lay))

(if (cdr liste_lay)

(progn

(new_dialog "mpl" init_mpl "")

(start_list "mpl")

(mapcar 'add_list liste_lay)

(end_list)

(liste_destination)

(set_tile "titre" "Copie Présentation V1.03")

(set_tile "mpl" position)

(mode_tile "mpl" 2)

(while (and (/= resultat 1)(/= resultat 0))

(action_tile "mpl" "(setq position $value)(liste_destination)")

(action_tile "dest" "(setq positiondest $value)")

(action_tile "accept" "(done_dialog 1)")

(action_tile "cancel" "(done_dialog 0)")

(setq resultat (start_dialog))

)

(unload_dialog init_mpl)

(if (eq resultat 1)

(progn

(setq doc (vla-get-activedocument (vlax-get-acad-object))

config (vla-item (vla-get-layouts doc) (nth (atoi position) liste_lay))

)

(setq liste_lay (vl-remove (nth (atoi position) liste_lay) liste_lay))

(while (not (eq positiondest ""))

(setq position (read positiondest))

(setq lay (vla-item (vla-get-layouts doc) (nth position liste_lay)))

(vla-copyfrom lay config)

(princ (strcat "\nMise à jour de la mise en page de " (vla-get-name lay) " depuis " (vla-get-name config)))

(setq positiondest (substr positiondest (+ 2 (strlen (itoa position))) (strlen positiondest)))

)

)

)

)

(msgbox "MPL" 48 "Une seule présentation\nUtilisation inutile du Lisp")

)

)

(msgbox "MPL" 16 "Fichier MPL.DCL introuvable")

)

)

 

;;;---------------------------------------------------------------

;;;

;;; Routine de lancement

;;;

;;;---------------------------------------------------------------

 

(vl-load-com)

(setq s *error*)

(setq *error* *errmpl*)

(vla-startundomark (vla-get-activedocument (vlax-get-acad-object)))

(multiplie_plt)

(vla-endundomark (vla-get-activedocument (vlax-get-acad-object)))

(setq *error* s)

(princ)

)

Link to comment
Share on other sites

That code is calling DCL or some sort of Dialog Box while executing... How do you plan to implement it on multiple DWGs if Box is appearing in every DWG? Maybe with avoiding Dialog Boxes and then through ObjectDBX calling DBX document VLA-OBJECT and function (lisp without Dialog Box) through DBX Wrapper :

http://www.lee-mac.com/odbxbase.html

Link to comment
Share on other sites

Like Marko look at these two lines

 

(action_tile "mpl" "(setq position $value)(liste_destination)")
(action_tile "dest" "(setq positiondest $value)")
need to be
(setq position somevalue)
(setq positiondest someothervalue)

remove all code above and below referring to the dialouge call. NOT TESTED

(new_dialog "mpl" init_mpl "")
............
(setq position somevalue)
(setq positiondest someothervalue)
......................
(unload_dialog init_mpl)

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...