Jump to content

Recommended Posts

Posted

Some times comes a file has all the project drawings.

All frames on one layout (as attached)

 

So I wrote this simple lisp

(defun c:Mltiplt ()

 (alert "make changes in next window \nthen click on Apply to Layout \nthen click on Canel")
 [color="red"](command "_plot")[/color]
 
 (while t

   (setq p1 (getpoint))
   (setq p2 (getpoint))

   (command "-plot" "y" "" "" "" "" "" "" "w"
     p1
     p2
     "" "" "" "" "" "" "" "" "")
   )
 (princ)
 )

 

I am facing 2 problems

- How to open Plotting window

This error message comes

Command: (command "_plot")
nil

 

- Could I change the layout in WHILE Loop?

 

Thanks for help

mltiprt.PNG

Posted

Hi,

 

To open the AutoCAD plot window add (initdia) directly before (command "_plot"). This allows you to override the command line by launching the plot dialog box

 

(initdia)
(command "_plot")

 

To control the loop I'd change the

 

 (while t

 

to

 

  (while 
   (and
   (setq p1 (getpoint))
   (setq p2 (getpoint))
   ...)

Posted

(initdia)
(command "_plot")

Working perfect

 

But when Plotting dialog box launched and select a window in plot area the Function cancelled

Command: MLTIPLT

Invalid window specification.
; error: Function cancelled

Specify first corner: *Cancel*
*Invalid*

 

 (while t
...

[/code]

Did not solve the problem

 

Thanks for your help

Posted

i never had to reset my initdia

And i use ".-plot", repeat and vla-getboundingbox for loop

 

(setq ss (ssget "x" (list '(0 . "INSERT")(cons 2 [color=blue][b]Blkname[/b][/color])(cons 410 (getvar 'CTAB)))))
(repeat (setq i (sslength ss))
(vla-getboundingbox
       (setq blockobject
         (vlax-ename->vla-object (ssname ss (setq i (1- i))))
       )
       'lowerleft 'upperright
     )
(command [color=blue][b]".-plot"[/b][/color] "Y" "" "pltDevice"   "ANSI B (11.00 x 17.00 Inches)"
   "Inches" "Landscape"
   "N" "Window" (trans (vlax-safearray->list lowerleft) 0 1)
   (trans (vlax-safearray->list  upperright) 0 1) "Fit" "Center" "Y" "pltStyles" "Y" "Y" "N" "N" 
   "N" "N" "Y")

 

Hope this helps

Posted

Okay I see whats happening. At first I thought it could be something to do with the dialogFlag which you can add to the (initdia ) but its not the case.

 

When you launch the plot dialog box, and press the select window button, you actually proceed to the loop instead of picking the points as per the plot window. Adding a double pause as shown seems to work but you might want to test this

 

 

(defun c:Mltiplt ()

 (alert "make changes in next window \nthen click on Apply to Layout \nthen click on Canel")

 (INITDIA)
 (command "_plot" pause pause )


 (while

   (AND

   (setq p1 (getpoint "\nBottom left"))
   (setq p2 (getpoint "\nUpper right"))
   )
    
       (command "-plot" "y" "" "" "" "" "" "" "w"
     p1
     p2
     "" "" "" "" "" "" "" "" "")
   )
   
   
 (princ)
 )

Posted

Oh.. now I see what the OP is trying to do. fire up the Plot Dialog to set the parameters on the first window selection. and use "-plot" afterwards.

My bad.

 

Clever guys. :thumbsup:

Posted

I am more like Pbe plot all titleblocks automatically or pick the ones you want or pick smaller title and do all, or just one could be all sorts of combo's ?

 

Maybe pick 1 title then use selection set rather than "X" change plot scale if required.

 

I just say plot all and done I use the title block insertion point and work out the plot "window" co-ords as I know the title block sheet size, I have 4 options A3 A1 tiff PDF.

 

Why not ignore default plot window all together and just ask questions with as default

  • 3 weeks later...
Posted

Is there a way to keep the lisp working while selecting another layout?

Posted

Yes if you make an outside loop that is your layout tabs then it will go to the next one and run again.

 

(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vlax-for lay (vla-get-Layouts doc)
 (setq plotabs (cons (vla-get-name lay) plotabs))
)
(setq plottablist (acad_strlsort plotabs))
(setq len (length plottablist))
(setq x 0)
(repeat len
 (setq name (nth x plottablist))
 (princ name)
 (if (/= name "Model")
   (progn
     (setvar "ctab" name)
your code
)

Posted

(layoutlist) will give you the layout names excluding "MODEL" and its already sorted

Posted

Thanks Bigal,

 

This is what I have but I get ; error: malformed list on input

 

;Based on PageSetups from Alan J. Thompson
(defun c:A1_All ()
(PlotReactorOFF)
 (if (findfile "T:/Drawing Tools/Templates/CCC2009.dwt")
   (progn
     (command "_.psetupin" (findfile "T:/Drawing Tools/Templates/CCC2009.dwt") "A1")
     (while (wcmatch (getvar "cmdnames") "*PSETUPIN*")
       (command "_yes")
     ) ;_ while
     T
   ) ;_ progn
 ) ;_ if

(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vlax-for lay (vla-get-Layouts doc)
 (setq plotabs (cons (vla-get-name lay) plotabs))
)
(setq plottablist (acad_strlsort plotabs))
(setq len (length plottablist))
(setq x 0)
(repeat len
 (setq name (nth x plottablist))
 (princ name)
 (if (/= name "Model")
   (progn
     (setvar "ctab" name)
)
)
(command "-plot" "n" "" "A1" "" "n" "y" "n")
(command "_-purge" "a" "*" "N")
(setq CCC_Sheet "A1")
(command "updatefield" "all" "")
(command "regenall")
(command "_zoom" "e")
 (initdia)
 (command "._plot")
(PlotReactorON)
;(princ)
)

 

Can you help?

Posted

Sorry I replied to the wrong thread.

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