Jump to content

Layout tab name change


gazzalp

Recommended Posts

Is there any way to get the layout tab name changed anytime you create a pdf? Anytime i create a pdf it calls the drawing "title (layout1)" i want it to be able to ask me to change the name of "layout" anytime i PDF so i can change it to the drawing revision number. IE Click Print to PDF, it has a dailog box asking for the revision, then the pdf is created called "title-A" (for a revision A). and next time i open the drawing instead of layout tab being called "layout" it will be "A"

 

any help is appreciated

Link to comment
Share on other sites

sorry i should have made it clearer. I work for a company and we are always emplying new staff. we dont want people to have to think about renaming the layout tab everytime a drawing revision changes. so we want autocad to prompt us anytime we create a pdf, because ultimately thats when the layout tab will change. therefore with the click of one button (the pdf button) it will ask us to change the layout tab and will automatically rename our pdf file. With the way you have suggested we would have to first rename the layout tab then click on pdf, so it just adds another step, and means our new employees who arent used to it may forget to change the layout tab.

Link to comment
Share on other sites

I know very well of your problem, gazzalp, as I too have had to deal with such an issue...

 

We would sometimes just have users PDF the whole load of files and then some poor sod would have to go through all the filenames, taking out the (Layout 1) or (Model) at the end of the filename...

 

I suppose you could use a reactor that would run off the back of the plot command, and run a LISP that would somehow change the layout tab name, but I am not too sure if or how this could be done - just a suggestion. :P

Link to comment
Share on other sites

This may suffice for the first part. It only allows a single Layout tab though.

 

Public Sub RenameLayoutTabToInputRevLetter()
Dim sRev As String
sRev = InputBox("Revision Level", "Get Revision Level", "A")
'--------------------------------------
Dim acLayout As AcadLayout
'''''''''''''''''''''''''''''''''''''''
If ThisDrawing.Layouts.Count > 2 Then Exit Sub
For Each acLayout In ThisDrawing.Layouts
   Select Case acLayout.Name
   Case "Model"
   Case Else
       acLayout.Name = sRev
   End Select
Next acLayout
End Sub

Link to comment
Share on other sites

Thanks, although im not sure how to use that. Is it just a lisp routine that should be saved as normal (ie: save in notepad as.lsp) because i tried that but it didn't work.

Link to comment
Share on other sites

Thanks, I got it to work but it doesnt exactly do what i want. I want to be able to do a PDF from the dwg, and it come up and ask me what the revision is, and accordingly change the name of the pdf to "title (revision)" as well as the layout tab to be the revision as well. And next time i open the drawing it should still have that revision instead of layout.

Link to comment
Share on other sites

  • 3 years later...

I have 2 Lisp routines that I use for this;

 

One takes the variable "DWGNAME" and sets this value as the layout tab name (truncated to exclude the .dwg). This only works for single layouts since you are using the DWGNAME variable and multiple layout tabs cannot have the same name.

 

The other takes a specific attribute and sets the layout name to that attribute (In my case the "Revision" attribute).

 

I include this lisp in my accodoc.lsp file, so when I publish multiple files (pdf) to single sheets it names them 'Filename-Revision' eg STMP0345-C

 

It would be nice however to combine the two lisps into one to provide DWGNAME+ATTRIBUTE for the layout name...

 

Harris

Link to comment
Share on other sites

Its pretty easy to get a list of the layout tab names then do a ssget of the title block plus this layout only then pull out attribute value and up date layout name.

Heres a start

 

(PROMPT ".....PRINTING DRAWING TO pdf's....")
(setvar "cmddia" 0)
(setvar "filedia" 0)
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vlax-for lay (vla-get-Layouts doc)
 (setq plotabs (cons (vla-get-name lay) plotabs))
)
(setq plottablist (acad_strlsort plotabs))
(setq len (length plottablist))
(setq x 0)
(repeat len
 (setq name (nth x plottablist))
 (princ name)
 (if (/= name "Model")
   (progn
     (setvar "ctab" name)

     (COMMAND "-PLOT"  "Y"  "" "Cutepdf Writer"
       "A3" "m"    "LANDSCAPE"    "N"   "W"  "-6,-6"    "807,560" "1=2"  "C"
       "y"   "Designlasercolour.ctb" "Y" "n"    "n"    "y"   "N" "N" "y"      )
   )
 )
 (setq x (+ x 1))
)
(setvar "cmddia" 1)
(setvar "filedia" 1)
(princ)

 

now ssget where is it

 

(setq ss2 (ssget "x" '((0 . "INSERT")(2 . "Da1drsht")(410 . name))))

 

Probably use a vl-get & vl-put to change layout name others help please.

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