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

Need help with the plotting command in LISP

17 REPLIES 17
SOLVED
Reply
Message 1 of 18
licences
7437 Views, 17 Replies

Need help with the plotting command in LISP

Greetings,

 

We need to use the DWG to PDF.pc3 with the -Plot command in a LISP script for batch printing to files.

 

The problem is that we need the users to select where they need to save the document, but the LISP command then select the next parameter during the save screen. For instance, if the parameter following the save dialog prompt is "No", it will save the file as "No" in the My Documents folder.

 

Here is what the line looks like at the moment (please note that this is working for the prompt with a printer like Adobe PDF but not DWG to PDF.pc3):

 

(COMMAND "_-PLOT" "OUI" "OBJET" "DWG TO PDF.PC3" FORMATP unite orient1 "NON" "L" P1 P2 FACTEUR "C" "OUI" "STAS_DESIGNJET.CTB" "OUI" "A" "NON" "NON" "OUI")

We are using AutoCAD Mechanical 2013 french.

 

Can you help us out please?

 

Thanks a lot for your time and help.

17 REPLIES 17
Message 2 of 18
scottbolton
in reply to: licences

In AutoCAD and Civil 2013 this works for me:

 

(command "-plot"
  "Yes"                      ;Detailed plot configuration? [Yes/No] <No>: Y
  ""                         ;Enter a layout name or [?] <0_01a>:
  "DWG To PDF.pc3"           ;Enter an output device name or [?] <DWG To PDF.pc3>:
  (substr PLOT_framesize 17) ;Enter paper size or [?] <ISO full bleed A3>:
  "Millimeters"              ;Enter paper units [Inches/Millimeters] <Millimeters>:
  PLOT_rotation              ;Enter drawing orientation [Por.../Lan...] <Lan...>:
  "No"                       ;Plot upside down? [Yes/No] <No>:
  "Window"                   ;Enter plot area [D.../E.../L.../V.../W...] <Window>:
  PLOT_BL                    ;Enter lower left corner of window <0,0>:
  PLOT_TR                    ;Enter upper right corner of window <420,297>:
  "1=1"                      ;Enter plot scale or [Fit] <1=1>:
  "Center"                   ;Enter plot offset (x,y) or [Center] <Center>:
  "Yes"                      ;Plot with plot styles? [Yes/No] <Yes>:
  ""                         ;Enter plot style table name or [?] <>:
  "Yes"                      ;Plot with lineweights? [Yes/No] <Yes>:
  "No"                       ;Scale lineweights with plot scale? [Yes/No] <No>:
  "No"                       ;Plot paper space first? [Yes/No] <No>:
  "No"                       ;Hide paperspace objects? [Yes/No] <No>:
  PLOT_filename
  "Yes"                      ;Save changes to page setup [Yes/No]? <N> y
  "Yes"                      ;Proceed with plot [Yes/No] <Y>:
  )

 

where PLOT_filename = (strcat (getvar "DWGPREFIX") (vl-filename-base (getvar "DWGNAME")) ".pdf")

 

i.e. the PDF is created with the same name and in the same folder as the DWG.

 

S

Message 3 of 18
licences
in reply to: scottbolton

Greetings,

 

Thanks for your answer, but what we actually need is to get the save dialog prompt to show up to manually select the location and type the filename as well.

 

Is it possible to do it that way?

 

Thanks again.

Message 4 of 18
scottbolton
in reply to: licences

You can't get the dialogue box to show DURING the print process, but you could set the filename BEFORE the _PLOT command using (getfiled,

 

S

Message 5 of 18
licences
in reply to: scottbolton

Greetings,

 

Thanks a lot, it worked with getfiled.

Message 6 of 18
hmsilva
in reply to: licences

licences,
using a tilde you can bring up the dialogue box

 

(COMMAND "_-PLOT" "OUI" "OBJET" "DWG TO PDF.PC3" FORMATP unite orient1 "NON" "L" P1 P2 FACTEUR "C" "OUI" "STAS_DESIGNJET.CTB" "OUI" "A" "NON" "~" "NON" "OUI")

 

I hope I have understood the French commands...

 

Henrique

EESignature

Message 7 of 18
licences
in reply to: hmsilva

Greetings,

 

Thanks for your reply hmsilva, your solution works as well and does the same with less code. The dialog is a little bit different from getfiled, it can be edited (resized) and you can see the quick shortcuts on the left side (same as the save dialog used in AutoCAD). In our case, this will prove to be handy.

 

I gave you a "kudo" as I have already accepted the solution with getfiled.

 

Thanks again to both of you for your time and help.

Message 8 of 18
hmsilva
in reply to: licences

You're welcome,  licences

EESignature

Message 9 of 18
ardeiasi
in reply to: scottbolton

if i want to add a counter in filename how can i do it?

for example i have a matrix of pages (3 rows  by 2 columns) that i want to print to pdf: for each row by column i want pdf name row_col.pdf or _counter.pdf.

Thanks!

 

Message 10 of 18
Lee_Mac
in reply to: ardeiasi

Initialise a counter variable before your plotting loop (setq count 0), and increment the variable within the loop (setq count (1+ count)). When supplying the filename to the plot command, convert the counter to a string (itoa count), then concatenate this with the plot filename (strcat "Myfile" (itoa count) ".pdf").

Message 11 of 18
ardeiasi
in reply to: Lee_Mac

thanks Mac Lee:
If i'm using the variables row and col inside my while loop it dose not increase the row to (+ row 1), because i go from row to (itoa row) inside plot command.
normaly it shoud stay in real domain whan I call back the variable Row>
Message 12 of 18
Lee_Mac
in reply to: ardeiasi

Are you re-assigning the incremented value to the row variable? e.g.:

 

(setq row (1+ row))

 

Message 13 of 18
ardeiasi
in reply to: Lee_Mac

Yes to take the next row from the matrix

i'm using this: (setq ipdfname (strcat (itoa iRow) "_" (itoa iCol) ".pdf")) inside my while loop and i'm ploting pdffilemame in command -plot. When it should go to next row it does not go. I think because is string and not integer as it should be.

i'm right?

 

Message 14 of 18

IT'S AWESOME CAN YOU PLEASE SHARE THE MACRO THAT PDF FILE SAVE AT DWG LOCATION

RECENTLY I USE

(-PLOT;N;MODEL;A1 PDF_BSI;;;;;) BUT IT SHOW MANNULY SELECT THE LOCATION

I WANT AUTOMATICALLY SAVE PDF AT FILE LOCATION

PLZ REPLY ON THIS

THANKS IN ADANCE

 

Message 15 of 18

I GET UR WHOLE COMMENTS BUT STILL NOT GETTING THE FOLLOWING

(

where PLOT_filename = (strcat (getvar "DWGPREFIX") (vl-filename-base (getvar "DWGNAME")) ".pdf")

 

i.e. the PDF is created with the same name and in the same folder as the DWG.)

 

CAN YOU PLEASE explain in details to add in macro

 

Message 16 of 18

where I put this code:

(strcat (getvar "DWGPREFIX") (vl-filename-base (getvar "DWGNAME")) ".pdf")

?

Message 17 of 18
cadffm
in reply to: darshan.mandalkar

You talk about the acad pdf driver?
When Acad is asking about the filename in your makro:
 (strcat (getvar "DWGPREFIX") (vl-filename-base (getvar "DWGNAME")) ".pdf")

Thats all.
If you try it step by step in command line you have to set filedia to 0.
If you testing as macro or script filedia can be set to 1, acad ask for filenames in commandline if a script or macro is running.
- Sebastian -
Message 18 of 18
darshan.mandalkar
in reply to: cadffm

macro.jpgHi,

I used this macros

^C^C-PLOT;N;MODEL;A1 PDF_BSI;;;;;

here "A1 PDF_BSI" is my page set up

I create a toolbar button through "CUI" command, but when I click on this button it ask to save the pdf file (see the attach snapshot)

even I set filedia to "0"

I just want to click on this button and "PDF" file is automatically save where my autocad file is save

I doesn't want to ask for location to save

 

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

Post to forums  

Autodesk Design & Make Report

”Boost