Jump to content

Getting user input within a command


JLG

Recommended Posts

I need this command to pause so the user can select the window to plot to. then after it needs to continue through the function.

 

(defun C:GPDF ()

 

(command "-plot" "Y" "" "Adobe PDF" "Letter" "" "" "" "W" "FIT" "" "" "" "PDF plot.ctb" "" "" "N" "N" "")

 

(princ "\PDF created")

 

(princ)

 

)

Link to comment
Share on other sites

I am sure that other people can give you a better solution, but I would do it like this:

 

 

(defun C:plotPDF (/)

 

(setq window1 (getpoint "\nPick lower left corner of Plot Area:"))

(setq window2 (getpoint "\nPick upper right corner of Plot Area:"))

(command "-plot" "y" "" "Adobe PDF" "Letter" "" "" "" "W" window1 window2 "FIT" "" "" "PDF plot.ctb" "" "" "N" "N" "")

(princ)

)

 

 

I hope that helps.

Link to comment
Share on other sites

Hmm i'm not sure why but i copied that directly and it didn't work. Wont recognize the -plot function after the window is selected?....and it wont show the window selection box just asks to pick corners.

My main goal is to automate creating a PDF. In a pefect world you would press a button and then select a window for the print and it would save and rename the pdf file.....but that i think is a tall order. So im settling for press the button and select a window.

Link to comment
Share on other sites

are you plotting from model space or paper space? From paper space this works fine. In order to show the rectangle, you need to use much more in depth and complicated programming (VBA.net or ObjectARX...I think). Unfortuantely, I am not sure of a way to use the existing "window" command within a routine.

 

(defun C:plotPDF (/)

 

(setq window1 (getpoint "\nPick lower left corner of Plot Area:"))

(setq window2 (getpoint "\nPick upper right corner of Plot Area:"))

(command "-plot" "y" "" "Adobe PDF" "Letter" "" "" "" "W" window1 window2 "FIT" "" "" "monochrome.ctb" "" "" "N" "N" "" "" "")

(princ)

)

 

I did notice, as you mentioned that this does not work when plotting out of model space. I am not sure why. Maybe someone else can help you out more. I am no expert.

Link to comment
Share on other sites

In order to show the rectangle, you need to use much more in depth and complicated programming (VBA.net or ObjectARX...I think).

 

You can do it like this.

 

(setq pt2 
  (getcorner 
     (setq pt1 
        (getpoint "\nSelect first point: ")
     )
     "\nSelect second point: "
  )
)

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