Jump to content

Plotting lisp Help


Millsy29

Recommended Posts

i have created a button on my palette that plots a A0, a1 & a3 pdf's.

 

how do i but this into a lisp routine that would allow me to plot A# (full size maybe as a wide card) to printer and pdf and a3 scale to fit to printer.

 

-PLOT

YES

PDFCREATOR

A0

LANDSCAPE

NO

EXTENTS

1=1

CENTER

YES

BLL-STD.stb

YES

YES

NO

NO

NO

NO

YES

 

I think i have a grasp of how to set it up to my own system but if someone could help with this, it would save me so much time..

 

Millsy

Link to comment
Share on other sites

So far so good. You're on the right track, and that bit of code is pretty much all you need. Just put all that into a (command ...) function, then copy and paste for all the different plot settings and styles that you want.

 

For example:

 

(defun c:millsyplot( / )
(command "-PLOT" "YES" "PDFCREATOR" "A0" "LANDSCAPE" "NO" "EXTENTS" "1=1" "CENTER" "YES" "BLL-STD.stb" "YES" "YES" "NO" "NO" "NO" "NO" "YES")
)

Link to comment
Share on other sites

i have created a button on my palette that plots a A0, a1 & a3 pdf's.

 

how do i but this into a lisp routine that would allow me to plot A# (full size maybe as a wide card) to printer and pdf and a3 scale to fit to printer.

 

-PLOT

YES

PDFCREATOR

A0

LANDSCAPE

NO

EXTENTS

1=1

CENTER

YES

BLL-STD.stb

YES

YES

NO

NO

NO

NO

YES

 

I think i have a grasp of how to set it up to my own system but if someone could help with this, it would save me so much time..

 

Millsy

 

Hi Millsy.

What i do for printing is after i ve completed the dwg in model space, i do the complete page setup in paper space. when done just run a short lisp routine. Whenever you want to print the drawing, just open the dwg go to the layout you want to print, type pp & hit enter.

 

;start of code

(defun c:pp()

(princ "Type PP to run the command.

\n Prints in one click,provided layout is set.

\n Lisp by Vivian Carvalho")

(setvar "cmdecho" 0)

(command "plot" "n" "" "" "" "n" "n" "y"))

;end of code.

Link to comment
Share on other sites

i am having trouble with the output device (\\ukman04ma401\UK-MAN-04-01-KIP5000)

 

lisp

 

(defun c:plotsA0 nil

(vl-load-com)

(command "_.-plot" "yes" "" "PDFCREATOR" "A0" "m" "LANDSCAPE" "NO" "EXTENTS" "1=1" "CENTER" "YES" "BLL-STD.stb" "YES" "YES" "NO" "NO" "NO" "NO" "yes" )

(command "_.-plot" "yes" "" "\\ukman04ma401\UK-MAN-04-01-KIP5000" "A0_841x1189mm" "M" "LANDSCAPE" "NO" "EXTENTS" "1=1" "CENTER" "YES" "BLL-STD.stb" "YES" "YES" "NO" "NO" "NO" "NO" "yes" )

(command "_.-plot" "yes" "" "ukman04mz401\UK-RO-MAN-04-03 HPLJ5550 Design Printer" "A3" "M" "LANDSCAPE" "NO" "EXTENTS" "FIT" "CENTER" "YES" "BLL-STD.stb" "YES" "YES" "NO" "NO" "NO" "NO" "yes" )

(princ)

)

 

 

AutoCAD text widow

 

Command: _.-plot Detailed plot configuration? [Yes/No] : yes

Enter a layout name or [?] : Enter an output device name or [?]

\\ukman04ma401\UK-MAN-04-01-KIP5000>:

> not found.

 

 

 

 

when exicuted it comes out like this it seems to have a problem with the \'s

 

does anyone know how to get around this?

 

Millsy

Link to comment
Share on other sites

This is a common occurrence. The backslash is a control code in LISP. You may have seen code that looks like this:

 

(entsel "\nSelect entity: ")

 

Well, that "backslash-n" means "insert a new line here". Without the backslash, it would just print the "n". TL;DR, what this means is that you can't just put a backslash in a string of text, otherwise when you run the code, it's expecting that backslash to indicate a control code.

 

You can fix that by using the control code to create a special character. Ever want to put a quote in a text string? You do it like this: "something\"somethingelse". That "backslash-quote" says, "Don't stop the text string here, put a quotation mark in it!" By following the same logic, we can do this: "something\\somethingelse".

 

Here's a way to see for yourself how it works. Copy and paste these bits of code into your command line on AutoCAD:

 

(princ "Control code: \ ")

(princ "Backslash: \\ ")

(princ "Double-backslash: \\\\ ")

 

In short, the answer to your question is:

Replace \\ukman04ma401\UK-MAN-04-01-KIP5000 with \\\\ukman04ma401\\UK-MAN-04-01-KIP5000

Link to comment
Share on other sites

  • 2 weeks later...

Thank you for this one, it helps me a lot, specially now that I'm trying to work a lisp that plot my drawings without the annoying window plot, I succeeded to plot a drawing to a pdf document and also plot an A1 sheet, but I've been experience troubles when trying to plot to a personalized sheet, always shows that the size sheet is not found, when trying to print, after the paper size, founds an error and cannot recognize the rest of the routine.

 

If you would be so kind to help me with this, I'm writing the routine to see what's wrong:

 

(defun c:toto nil

(vl-load-com)

(command "_.-plot" "yes" "" "HP DesignJet 500 24 by HP" "Pers. 5: 594 x 1150 mm." "m" "LANDSCAPE" "NO" "EXTENTS" "fit" "CENTER" "YES" "ba2.ctb" "no" "wireframe" "NO" "yes" "yes" )

(princ)

)

 

many thanks in advance.

 

Also, if I have elements outside the format, when I plot in "extents" mode this will plot everything in the model, is there any way to select "window" instead of "extents"?

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