Jump to content

Append sheet number


mjab8

Recommended Posts

I wanted to append the sheet number to my quick plot to pdf. Much appreciated if someone can help to append the sheet number to the filename with _S before the sheet number.

Also having difficulty with the getkword for sheet number with 1 as Default.  Example of wanted outcome is A123_S2.pdf for Sheet 2 of drawing A123. Thanks in advance.

Part of my lisp as below:

 

(vl-load-com)

(setq sht (cond ((getkword "\nEnter Sheet number <1>:"))("1")))
         (cond
             ((= sht "1")(setq sheet "1"))
          )

(setq fname (vl-filename-base (getvar 'dwgname)))
(strcat fname "_S" sht)

    (setq p1 (getpoint "\nPick first corner to plot: "))
    (setq p2 (getcorner p1 "\nPick opposite corner: "))

(command "-plot" "Y" "Model" "Gaaiho PDF" "A3-H" "M" "L" "N" "W" p1 p2 "F" "C" "Y" ctb "Y" "A" "N" "N" "Y" fname)

Link to comment
Share on other sites

getkword and you need to set the keywords with initget in the line above (best the line immediately before).


For (setq sht (cond....  line I think you have too many brackets, see below

 

(initget 1 "1")
(setq sht (cond ((getkword "\nEnter Sheet number <1>:") "1")))

 

The way this is written you either have sht as 1 or sht as nil?, you might be better to use getint so the user can use any number and then itoa or rtos it to be a string?

 

After that it should work?

Link to comment
Share on other sites

Another problem

 

(strcat fname "_S" sht)

(setq fname (strcat fname "_S" sht))

Another problem

"Y" ctb "Y"  you have not defined ctb ?

"Y" acad.ctb "Y"

 

  • Like 1
Link to comment
Share on other sites

Thanks Steven and BIGAL.

I have tried as attached my .lsp.  The filename suffix works on variable flname, but still not in the PDF SaveAs dialog.

It still appear without .S5 (as an example) and default with *-Model 1.

 

Could this be an issue with the 'Gaaiho PDF.pc3' which doesn't allow suffix.

 

Please advise.

Test.lsp

Link to comment
Share on other sites

The reason I am writing this lisp is to do quick plot to PDF, time saving,  rather than going through plot dialog box. This is just one of my few plot lisp.

This next interest is to add the sheet suffix to the pdf, in MS and layouts. If this lisp is good, it some time saving for me.

My pc3 is always Gaaiho PDF, which produce good clear pdf. I only need two prompt, ie. Plot extend or window; Plot with lineweight to suite all drawings.

MS or PS is auto-detected with getvar "TILEMODE".

Link to comment
Share on other sites

This is an example of plot sheet number, actually plot a range for single sheet just have start and end the same. You need to save multi getvals to a support path as its autoloaded. You will need to edit the plot settings.

 

Multi GETVALS.lspplotA3Pdfrange.lsp

 

 

Edited by BIGAL
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...