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

Plot A0 or A0+ onto several A3

8 REPLIES 8
Reply
Message 1 of 9
CAD_user85
2811 Views, 8 Replies

Plot A0 or A0+ onto several A3

Dear Autocad / Autolisp Users,

 

Please help me.

 

Is it possible to create a lips that does the following:

 

- In the Modelspace

- Get 2 points to create a plot window / give two points. (get point 1, get point 2, list points)

- Divide the window into A3 size windows

- plot scale 1:100 / prompts to ask

- Plot / Print the A3 size windows with the given / preset configuration(s)

- Perhaps even add a number to each page.

 

In other words, Plot / Print a A2, A1, A0 or bigger onto several A3 pages.

Depending on how big the page is, number of A3 pages, plotscale 1:100

Or asks what plot scale I want to use.

 

So far I've got nothing yett.

The only thing I think I will need is something like:

Get point 1, get point 2, List the points. So I can set the window.

 

Any help will be appreciated.

 

Greets,

Michel

8 REPLIES 8
Message 2 of 9
hmsilva
in reply to: CAD_user85

weedseed85 wrote:
...
Is it possible to create a lips that does the following:
- In the Modelspace
- Get 2 points to create a plot window / give two points. (get point 1, get point 2, list points)
- Divide the window into A3 size windows
- plot scale 1:100 / prompts to ask
- Plot / Print the A3 size windows with the given / preset configuration(s)
- Perhaps even add a number to each page.
In other words, Plot / Print a A2, A1, A0 or bigger onto several A3 pages.
Depending on how big the page is, number of A3 pages, plotscale 1:100
Or asks what plot scale I want to use.
So far I've got nothing yett.
The only thing I think I will need is something like:
Get point 1, get point 2, List the points. So I can set the window.
...


Michel,
as I had some free time, here's a demo, that you can develop to fill your needs.
The "test" works in "WCS" and "landscape"...and minimally tested...

 

(defun c:test (/ osm_old P1 P2 P3 sc width eight hor vert itmh	numh
	       itmv numv Pll Pur)
  (setq osm_old (getvar "OSMODE"))
  (setvar "OSMODE" 32)
  (if (and (setq P1
		  (getpoint
		    "\nSpecify window for printing\nSpecify the lower left corner:"
		  )
	   )
	   (setq P2 (getcorner P1 "\nSpecify opposite corner:"))
      );; and
    (progn
      (setvar "OSMODE" 0)
      (if (not  (setq sc (getint "\nEnter the scale <1/100>:")))
	(setq sc 100)
      );; if
      (setq width (* 0.42 sc))
      (setq height (* 0.297 sc))
      (setq P3 (list (car P1) (cadr P2)))
      (setq hor (fix (+ (/ (distance P3 P2) width) 0.99)))
      (setq vert (fix (+ (/ (distance P1 P3) height) 0.99)))
      (setq itmh 0
	    numh hor
      )
      (setq itmv 0
	    numv vert
      )
      (while (< itmh numh)
	(setq itmv 0
	      numv vert
	)
	(while (< itmv numv)
	  (setq Pll
		   (list (+ (car P1) (* width itmh))
			 (+ (cadr P1) (* height itmv))
		   )
	  )
	  (setq Pur
	    (polar (list (+ (car P1) (+ (* width itmh) width)) (cadr P1))
		   (angle P1 P3)
		   (+ (* itmv height) height)
	    )
	  )
	  (command ".-plot" "y" "" "" "" "" "" "" "" Pll Pur (strcat "1000=" (rtos sc 2 0)) "" "" "" "" "" "" "" "")
	  (setq itmv (1+ itmv))
	);; while
	(setq itmh (1+ itmh))
      );; while
    );; progn
  );; if
  (setvar "OSMODE" osm_old)
  (princ)
);; test

 

Hope that helps, good luck!
Henrique

EESignature

Message 3 of 9
CAD_user85
in reply to: hmsilva

Dear Henrique,

 

I would really like to thanks you verry much for your help so far!

When I have some more time, I will test the lisp you gave me.

 

I'll let you know when i've tried the lisp.

 

Thank You

 

Greets,

Michel

 

Message 4 of 9
hmsilva
in reply to: CAD_user85

You're welcome, Michel

Henrique

EESignature

Message 5 of 9
CAD_user85
in reply to: hmsilva

Dear Henrique,

 

I've tested the lisp.

Unfortunaly it got stuck in a infinite loop or it just crashed 😞

 

I'll try something, with my limited knowlage 😛 perhaps I'll get it to work.

Thank you verry for the lips so far.

 

Greets Michel

Message 6 of 9
hmsilva
in reply to: CAD_user85

Michel,
I tested the code a few times, without errors...
"it got stuck in a infinite loop"
Can you tell me in which part the code gives error?

 

EDITED

print once using the command line version
command: -plot
answers the prompts, and post back the command and prompts from the AutoCAD Text Window...

 

Henrique

EESignature

Message 7 of 9
CAD_user85
in reply to: hmsilva

Dear Henrique,

 

This is what the command promt tells me:

 

Command: appload A3Plot !.lsp successfully loaded.


Command:
Specify window for printing
Specify the lower left corner:
Specify opposite corner:
Enter the scale <1/100>:100
-plot Detailed plot configuration? [Yes/No] <No>: y
Enter a layout name or [?] <Model>: Enter an output device name or [?] <DWG To
PDF.pc3>: Enter paper size or [?] <A3>: Enter paper units [Inches/Millimeters]
<Millimeters>: Enter drawing orientation [Portrait/Landscape] <Landscape>: Plot
upside down? [Yes/No] <No>: Enter plot area
[Display/Extents/Limits/View/Window] <Window>: Enter lower left corner of
window <0.000000,0.000000>: Enter upper right corner of window
<59400.000000,42000.000000>: Enter plot scale (Plotted Millimeters=Drawing
Units) or [Fit] <Fit>: 1000=100 Enter plot offset (x,y) or [Center] <Center>:
Plot with plot styles? [Yes/No] <Yes>: Enter plot style table name or [?]
(enter . for none) <Mul BV.ctb>: Plot with lineweights? [Yes/No] <Yes>: Enter
shade plot setting [As displayed/legacy Wireframe/legacy Hidden/Visual
styles/Rendered] <Legacy wireframe>:
Enter file name <Drawing1-Model.pdf>: Save changes to page setup [Yes/No]? <N>
Proceed with plot [Yes/No] <Y>: Effective plotting area: 420.00 wide by 297.00
high

Plotting viewport 2.


Command: -plot Detailed plot configuration? [Yes/No] <No>: y
Enter a layout name or [?] <Model>: Enter an output device name or [?] <DWG To
PDF.pc3>: Enter paper size or [?] <A3>: Enter paper units [Inches/Millimeters]
<Millimeters>: Enter drawing orientation [Portrait/Landscape] <Landscape>: Plot
upside down? [Yes/No] <No>: Enter plot area
[Display/Extents/Limits/View/Window] <Window>: Enter lower left corner of
window <0.000000,0.000000>: Enter upper right corner of window
<59400.000000,42000.000000>: Enter plot scale (Plotted Millimeters=Drawing
Units) or [Fit] <Fit>: 1000=100 Enter plot offset (x,y) or [Center] <Center>:
Plot with plot styles? [Yes/No] <Yes>: Enter plot style table name or [?]
(enter . for none) <Mul BV.ctb>: Plot with lineweights? [Yes/No] <Yes>: Enter
shade plot setting [As displayed/legacy Wireframe/legacy Hidden/Visual
styles/Rendered] <Legacy wireframe>:
Enter file name <Drawing1-Model.pdf>: Save changes to page setup [Yes/No]? <N>
Proceed with plot [Yes/No] <Y>: Effective plotting area: 420.00 wide by 297.00
high

Plotting viewport 2.


Command: -plot Detailed plot configuration? [Yes/No] <No>: y
Enter a layout name or [?] <Model>: Enter an output device name or [?] <DWG To
PDF.pc3>: Enter paper size or [?] <A3>: Enter paper units [Inches/Millimeters]
<Millimeters>: Enter drawing orientation [Portrait/Landscape] <Landscape>: Plot
upside down? [Yes/No] <No>: Enter plot area
[Display/Extents/Limits/View/Window] <Window>: Enter lower left corner of
window <0.000000,0.000000>: Enter upper right corner of window
<59400.000000,42000.000000>: Enter plot scale (Plotted Millimeters=Drawing
Units) or [Fit] <Fit>: 1000=100 Enter plot offset (x,y) or [Center] <Center>:
Plot with plot styles? [Yes/No] <Yes>: Enter plot style table name or [?]
(enter . for none) <Mul BV.ctb>: Plot with lineweights? [Yes/No] <Yes>: Enter
shade plot setting [As displayed/legacy Wireframe/legacy Hidden/Visual
styles/Rendered] <Legacy wireframe>:
Enter file name <Drawing1-Model.pdf>: Save changes to page setup [Yes/No]? <N>
Proceed with plot [Yes/No] <Y>: Effective plotting area: 420.00 wide by 297.00
high

Plotting viewport 2.


Command: -plot Detailed plot configuration? [Yes/No] <No>: y
Enter a layout name or [?] <Model>: Enter an output device name or [?] <DWG To
PDF.pc3>: Enter paper size or [?] <A3>: Enter paper units [Inches/Millimeters]
<Millimeters>: Enter drawing orientation [Portrait/Landscape] <Landscape>: Plot
upside down? [Yes/No] <No>: Enter plot area
[Display/Extents/Limits/View/Window] <Window>: Enter lower left corner of
window <0.000000,0.000000>: Enter upper right corner of window
<59400.000000,42000.000000>: Enter plot scale (Plotted Millimeters=Drawing
Units) or [Fit] <Fit>: 1000=100 Enter plot offset (x,y) or [Center] <Center>:
Plot with plot styles? [Yes/No] <Yes>: Enter plot style table name or [?]
(enter . for none) <Mul BV.ctb>: Plot with lineweights? [Yes/No] <Yes>: Enter
shade plot setting [As displayed/legacy Wireframe/legacy Hidden/Visual
styles/Rendered] <Legacy wireframe>:
Enter file name <Drawing1-Model.pdf>: Save changes to page setup [Yes/No]? <N>
Proceed with plot [Yes/No] <Y>: Effective plotting area: 420.00 wide by 297.00
high

Plotting viewport 2.


Command: -plot Detailed plot configuration? [Yes/No] <No>: y
Enter a layout name or [?] <Model>: Enter an output device name or [?] <DWG To
PDF.pc3>: Enter paper size or [?] <A3>: Enter paper units [Inches/Millimeters]
<Millimeters>: Enter drawing orientation [Portrait/Landscape] <Landscape>: Plot
upside down? [Yes/No] <No>: Enter plot area
[Display/Extents/Limits/View/Window] <Window>: Enter lower left corner of
window <0.000000,0.000000>: Enter upper right corner of window
<59400.000000,42000.000000>: Enter plot scale (Plotted Millimeters=Drawing
Units) or [Fit] <Fit>: 1000=100 Enter plot offset (x,y) or [Center] <Center>:
Plot with plot styles? [Yes/No] <Yes>: Enter plot style table name or [?]
(enter . for none) <Mul BV.ctb>: Plot with lineweights? [Yes/No] <Yes>: Enter
shade plot setting [As displayed/legacy Wireframe/legacy Hidden/Visual
styles/Rendered] <Legacy wireframe>:
Enter file name <Drawing1-Model.pdf>: Save changes to page setup [Yes/No]? <N>
Proceed with plot [Yes/No] <Y>: Effective plotting area: 420.00 wide by 297.00
high

Plotting viewport 2.


Command: -plot Detailed plot configuration? [Yes/No] <No>: y
Enter a layout name or [?] <Model>: Enter an output device name or [?] <DWG To
PDF.pc3>: Enter paper size or [?] <A3>: Enter paper units [Inches/Millimeters]
<Millimeters>: Enter drawing orientation [Portrait/Landscape] <Landscape>: Plot
upside down? [Yes/No] <No>: Enter plot area
[Display/Extents/Limits/View/Window] <Window>: Enter lower left corner of
window <0.000000,0.000000>: Enter upper right corner of window
<59400.000000,42000.000000>: Enter plot scale (Plotted Millimeters=Drawing
Units) or [Fit] <Fit>: 1000=100 Enter plot offset (x,y) or [Center] <Center>:
Plot with plot styles? [Yes/No] <Yes>: Enter plot style table name or [?]
(enter . for none) <Mul BV.ctb>: Plot with lineweights? [Yes/No] <Yes>: Enter
shade plot setting [As displayed/legacy Wireframe/legacy Hidden/Visual
styles/Rendered] <Legacy wireframe>:
Enter file name <Drawing1-Model.pdf>:
Enter file name <Drawing1-Model.pdf>:
Enter file name <Drawing1-Model.pdf>:
Enter file name <Drawing1-Model.pdf>: -plot Save changes to page setup
[Yes/No]? <N> y Proceed with plot [Yes/No] <Y>: Effective plotting area:
420.00 wide by 297.00 high

Plotting viewport 2.


Command: APPLOAD

Command: APPLOAD

Command: APPLOAD

Command: APPLOAD

Command: APPLOAD

Command: APPLOAD

Command:

Command:

Command: 1000=100 Unknown command "1000=100". Press F1 for help.


Command: APPLOAD

Command: APPLOAD

Command: APPLOAD

Command: Function cancelled
Command:
Command:
Command: *Cancel*

Command: *Cancel*

Command: *Cancel*

Command: *Cancel* 

 

 

I've canceld the command. If i don't, it will keep on plotting and give me the question of what program / lisp to runn (repeats last used command).

 

Yesterday I've filled in the blanks on the -plot command.

After this, it got stuck in a infinite loop and kept on going until the program gave up :P.

 

If you need anny more information, please ask.

Thank you verry verry much.

 

Greets Michel

 

Message 8 of 9
hmsilva
in reply to: CAD_user85

Michel,

was giving error in the "plot" command...

The demo that I posted, was to plot in a normal printer, not to "pdf", the prompts are different, inclusive have to provide the name of the file to create.

 

"Yesterday I've filled in the blanks on the -plot command.

After this, it got stuck in a infinite loop and kept on going until the program gave up"

 

it is preferable to use the command line, type the command and responds to what is prompted, and then, transcribe to the code.

 

Revised code

 (defun c:A3Plot (/ osm_old P1 P2 P3 sc width eight hor vert itmh numh itmv numv Pll Pur inc)
  (setq osm_old (getvar "OSMODE"))
  (setvar "OSMODE" 32)
  (if (and (setq P1
		  (getpoint
		    "\nSpecify window for printing\nSpecify the lower left corner:"
		  )
	   )
	   (setq P2 (getcorner P1 "\nSpecify opposite corner:"))
      );; and
    (progn
      (setvar "OSMODE" 0)
      (if (not  (setq sc (getint "\nEnter the scale <1/100>:")))
	(setq sc 100)
      );; if
      (setq width (* 0.42 sc))
      (setq height (* 0.297 sc))
      (setq P3 (list (car P1) (cadr P2)))
      (setq hor (fix (+ (/ (distance P3 P2) width) 0.99)))
      (setq vert (fix (+ (/ (distance P1 P3) height) 0.99)))
      (setq itmh 0
	    numh hor
	    itmv 0
	    numv vert
	    inc 1
      )
      (while (< itmh numh)
	(setq itmv 0
	      numv vert
	)
	(while (< itmv numv)
	  (setq Pll
		   (list (+ (car P1) (* width itmh))
			 (+ (cadr P1) (* height itmv))
		   )
	  )
	  (setq Pur
	    (polar (list (+ (car P1) (+ (* width itmh) width)) (cadr P1))
		   (angle P1 P3)
		   (+ (* itmv height) height)
	    )
	  )
	  (command ".-plot"
	     "Y" ;; Detailed plot configuration? [Yes/No] <No>: y
	     ""  ;;Enter a layout name or [?] <Model>:
	     "DWG To PDF.pc3" ;;Enter an output device name or [?] <DWG To PDF.pc3>:
	     "ISO A3 (420.00 x 297.00 MM)" ;;Enter paper size or [?] <ISO A3 (297.00 x 420.00 MM)>:
	     "Millimeters" ;;Enter paper units [Inches/Millimeters] <Millimeters>:
	     "Landscape" ;;Enter drawing orientation [Portrait/Landscape] <Landscape>:
	     "No" ;;Plot upside down? [Yes/No] <No>:
	     "Window" ;;Enter plot area [Display/Extents/Layout/View/Window] <Window>:
	      Pll  ;;Enter lower left corner of window <35.140282,118.583857>:
	      Pur  ;;Enter upper right corner of window <77.140282,148.283857>: 
	     (strcat "1000=" (rtos sc 2 0)) ;;Enter plot scale (Plotted Millimeters=Drawing Units) or [Fit] <Center>:
	     "Center" ;;Enter plot offset (x,y) <0.00,0.00>:
	     "Yes" ;;Plot with plot styles? [Yes/No] <Yes>:
	     "Mul BV.ctb" ;;Enter plot style table name or [?] (enter . for none) <acad.ctb>:
	     "Yes" ;;Plot with lineweights? [Yes/No] <Yes>:
	     "As displayed" ;;Enter shade plot setting [As displayed/Wireframe/Hidden/Visual styles/Rendered] <As displayed>:
	     (strcat (getvar "dwgprefix")
				  (vl-string-right-trim ".dwg" (getvar "dwgname"))
				  "-A3-" (rtos inc 2 0 )".pdf"
			  ) ;; the pdf file with the dwg name plus A3 1, 2, etc
	     "No" ;;Save changes to page setup [Yes/No]? <N>
	     "Yes" ;;Proceed with plot [Yes/No] <Y>:
          );; end .-plot
	  (setq inc (1+ inc))
	  (setq itmv (1+ itmv))
	);; while
	(setq itmh (1+ itmh))
      );; while
    );; progn
  );; if
  (setvar "OSMODE" osm_old)
  (princ)
);; A3Plot

hope that helps
Henrique

EESignature

Message 9 of 9
CAD_user85
in reply to: hmsilva

Dear Henrique,

 

Thank you again for your help.

 

I'll  have a look see at the lisp, and I'll let you know how it turns out.

 

Thank you verry mucht for your help.

 

Greets Michel

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

Post to forums  

Autodesk Design & Make Report

”Boost