Jump to content

Recommended Posts

Posted

Is there a way to put the drawing name in the first paper space layout tab

using VBA?

Thank you,

Posted

I'm pretty bad at VBA but perhaps?

 

  Dim dwg As String
  Dim lay As ACADLayout

  dwg = ThisDrawing.GetVariable("DWGNAME")

  lay = ThisDrawing.Layouts.Item("Layout1")
  lay.name = dwg

Posted

Lee, what about simple lisp for it?

Posted
Lee, what about simple lisp for it?

 

(defun c:test (/)
 (or *AcadDoc* (setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
 (vlax-for l (vla-get-layouts *AcadDoc*)
   (if (eq 1 (vla-get-taborder l))
     (vl-catch-all-apply (function vla-put-name) (list l (vl-filename-base (getvar 'dwgname))))
   )
 )
)

Posted

Alan, I don't know what happen but it is not working.

I just updated my Autocad version (2010), wonder if it is version related.

 

Command: (LOAD "test.lsp") TEST

 

Command: test

Unknown command "TEST". Press F1 for help.

Posted
Alan, I don't know what happen but it is not working.

I just updated my Autocad version (2010), wonder if it is version related.

 

Command: (LOAD "test.lsp") TEST

 

Command: test

Unknown command "TEST". Press F1 for help.

 

I had it created as a subroutine, which you would call with (test). However, I've changed it above. Try it now.

Posted

My mistake, I didn't look at it-just loaded. Sorry, it work now. Thank you.

Posted
My mistake, I didn't look at it-just loaded. Sorry, it work now. Thank you.

 

No problem. :)

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