Author Topic: LISP - plot command question  (Read 2528 times)

0 Members and 1 Guest are viewing this topic.

andrew_nao

  • Guest
LISP - plot command question
« on: June 06, 2011, 04:56:41 PM »
im trying to print a section of a dwg to pdf but im getting undesirable results (the contents of the window selction is not printing to the pdf but other parts that werent selected are)

so i would like to know if someone else can give this a try and tell me if you get undesireable results or if it what you selected in the window is what appears

thanks

Code: [Select]
;DWG To PDF.pc3
(defun printpdfsect (/ fileloc filenam point pointa pointb)
(setq fileloc (strcat (getvar "dwgprefix")
                      (vl-filename-base (getvar "dwgname"))
 )
)
(setq pointa (getpoint "\n Select first point: "))
(setq pointb (getcorner pointa "\n Select second point: "))
(setq point (list (car pointa) (cadr pointb)))

(command "-plot"
          "y"
 ""
 "DWG To PDF.pc3"
 "ANSI expand A (8.50 x 11.00 Inches)"
 "I"
 "P"
 "N"
 "W"
 (car point)
 (cadr point)
 "F"
 ""
 "Y"
 "nao.ctb"
 "Y"
 ""  
          fileloc "n" "y")

;
)
(printpdfsect)
« Last Edit: June 09, 2011, 02:22:46 PM by CAB »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: can someone test this for me
« Reply #1 on: June 06, 2011, 08:22:03 PM »
Are you in WCS and are the snaps OFF?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

andrew_nao

  • Guest
Re: can someone test this for me
« Reply #2 on: June 07, 2011, 08:50:45 AM »
Are you in WCS and are the snaps OFF?


snaps are off

how do i check if im in WCS

Crank

  • Water Moccasin
  • Posts: 1503
Re: can someone test this for me
« Reply #3 on: June 07, 2011, 12:13:23 PM »
Code: [Select]
(getvar "WORLDUCS")
Vault Professional 2023     +     AEC Collection

andrew_nao

  • Guest
Re: can someone test this for me
« Reply #4 on: June 09, 2011, 01:20:22 PM »
ok i need to revise this, i got it working but now i need to change it where it prompts with the dialog box to name it and save it to what the user wants

if i remove the fileloc variable it stops and if i put a pause or "" in place, it just blows right thru without asking

how can i get it to pause with the dialog box to ask for the user input

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: LISP - plot command question
« Reply #5 on: June 09, 2011, 02:24:40 PM »
You will need to first collect that data from the user when you get point selections and then use it within the plot command.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

andrew_nao

  • Guest
Re: LISP - plot command question
« Reply #6 on: June 13, 2011, 10:37:14 AM »
thanks for the help

i have 1 more question.
im trying to make it where if the person hit the escape key, that is ends quietly however when the escape is pressed the command still runs what am i missing in my error trapping?

Code: [Select]
(defun *error* (msg)
  (if (and msg (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*QUIT*,*EXIT*,")))
    (princ (strcat "\nError: " msg))
  )
)

(defun printpdfsect (/ fileloc filename pointa pointb)

(setq fileloc (strcat (getvar "dwgprefix")
                      (vl-filename-base (getvar "dwgname"))
  )
)

(setq pointa (getpoint "\n Select first point: "))
(setq pointb (getcorner pointa "\n Select second point: "))
(setq filename (dos_getfilenav "Select Files" fileloc "PDF" 1))

(command "-plot"
          "y"
  ""
  "DWG To PDF.pc3"
  "ANSI expand A (8.50 x 11.00 Inches)"
  "Inches"
  "Landscape"
  "NO"
  "Window"
  pointa
  pointb
  "Fit"
  "Center"
  "YES"
  "nao.ctb"
  "YES"
  "As Displayed"
  filename
  "NO"
  "YES")
)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: LISP - plot command question
« Reply #7 on: June 13, 2011, 02:48:13 PM »
You need to test the return value from dos_getfilenav
Not sure what the value is when ESC is pressed but it must be a odd value like nil or -1 or something you can test for.
HTH
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.