Author Topic: Finding list of tabs ...  (Read 5461 times)

0 Members and 1 Guest are viewing this topic.

Hangman

  • Swamp Rat
  • Posts: 566
Finding list of tabs ...
« on: January 08, 2007, 06:37:54 PM »
Hey ever-body,
I'm on my way out the door at the moment, so I'll catch your comments tomorrow but I want to leave a question for you all.

I've searched the swamp for most of the day and have found a lot of info I'm looking for in regards to layout tabs.

I am wondering however, how I can get a list of the current layout tabs and then automatically select the one I need.

We set our drawings up with the first & second tabs pertaining to the drawings.  Any other tabs we may have in the drawing would be Addendums to the plans & details.
When working on our drawings in Model space, and we switch to Paper space, many times it goes to the last layout tab used, and many times that tab is an Addendum tab.
Also, when we send our drawings out to others, we usually clean them up and package them nicely for others to use.
I am looking for a way to automate this tedious, mundane task.

So if we have the plan tabs labeled S-01 or S-1 or S-1.1A & S-1.1B and the rest are labeled Add-1, Add-2, SCS-02, PR-07, etc., I want to, when going from model space to paper space, have a lisp routine diagnose all the tabs and automatically put S-01 or S-1.1A as the current tab.

I think I have most of the info I need to put the code together, but I don't know how to find the list of all the tabs and then filter them to get the one I want.  Can you help me ??

I do appreciate your help.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8718
  • AKA Daniel
Re: Finding list of tabs ...
« Reply #1 on: January 08, 2007, 06:51:09 PM »
you mean like (layoutlist) ?
Dan

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Finding list of tabs ...
« Reply #2 on: January 08, 2007, 07:09:34 PM »
Sort a list of tabs
http://www.theswamp.org/index.php?topic=5939.0

Tab Mover Lisp
http://www.theswamp.org/index.php?topic=6511.0
This one uses a special sort, see the thread.
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.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Finding list of tabs ...
« Reply #3 on: January 08, 2007, 07:33:25 PM »
On a side note:  Does anyone know how to get which paper space tab it will switch to?  I don't really have a need, but was trying some stuff out for this thread, and ran into an error when trying to find it out with ActiveX.  I was trying to get the Paper space block for the active document, which works some times, and then check it against what values are associated with the tabs, ie the block names of the tabs.  Here is a partial dump of the active document object to show the error.
Quote
;   ModelSpace (RO) = #<VLA-OBJECT IAcadModelSpace3 1bcac2b4>
;   MSpace = AutoCAD: Invalid mode
;   Name (RO) = "Drawing1.dwg"
;   ObjectSnapMode = 0
;   PaperSpace (RO) = Exception occurred

This is weird; it should return an object like ModelSpace does.  Anyone else ever seen this before? or knows of a way around it?
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Finding list of tabs ...
« Reply #4 on: January 08, 2007, 10:34:08 PM »
Try
Code: [Select]
(vla-get-name(vla-get-layout(vla-get-paperspace (vla-get-activedocument (vlax-get-acad-object)))))
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.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Finding list of tabs ...
« Reply #5 on: January 08, 2007, 10:37:45 PM »
Tim, my first thought was that you'd get an error for the Paperspace object if no paperspace had yet been created...i.e. before any Layout had been activated. But, based on a quick test in 2002, that doesn't appear to be correct. I started a new drawing and before doing anything else dumped the Doc object and it reports a Paperspace object.

So, I dunno..... although I'm having vague recollections of running into something similar quite some time ago. I'll go through some of my old test junk later tonight or tomorrow to see what I can find.

Hangman

  • Swamp Rat
  • Posts: 566
Re: Finding list of tabs ...
« Reply #6 on: January 09, 2007, 10:47:47 AM »
Morn'n everyone.

Thank you for the plethora of responses.

Dan asked ...
Quote
you mean like (layoutlist) ?

A, yes, I think that's what it would be.  If that would give a list of the layout tabs currently in the drawing.

Tim brought up a good question,
Quote
Does anyone know how to get which paper space tab it will switch to?

Couldn't you just filter the list to find the layout and set it to the variable 'CTAB' ??
(of course this won't work out of the gate as is, I'm not THAT good)   :wink:
Code: [Select]
... Assuming the layoutlist gives a list of available tabs (I haven't seen it in working order to know)
... "S1.1A" "S1.1B" "Add-1" "Add-2" "Add-3"

(setq tab-1 (car (layoutlist)))
(if (= tab-1 S1.1A)
    (setvar "CTAB" tab-1))

Perhaps I'm up in the night, (Don't ask my Wife, she'll just confirm it   :-D)  but this is where my thoughts on this subject are at.  I don't have enough experience with this to know any better.

Thanks Jeff for your input.  You're right, there is always a layout tab (Well, for the newer versions of cad anyway).  So with a layoutlist, on a blank drawing, you would still have "layout" if I'm not mistaking.
We appreciate your looking into some more though, thank you.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Finding list of tabs ...
« Reply #7 on: January 09, 2007, 11:09:21 AM »
Try
Code: [Select]
(vla-get-name(vla-get-layout(vla-get-paperspace (vla-get-activedocument (vlax-get-acad-object)))))
I was looking for something simple like that, and must have missed it, but it will still error once in awhile, because the '(vla-get-paperspace' will return an error.

Thanks though Alan, I don't know how I missed that one '(vla-get-layout' that is.  :wink:
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Finding list of tabs ...
« Reply #8 on: January 09, 2007, 11:16:51 AM »
Tim,
When it errors can you reissue the call & get the layout name or does it still error?
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.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Finding list of tabs ...
« Reply #9 on: January 09, 2007, 11:28:12 AM »
Alan,

  When it errors, it will continue to error until Acad tells it not to.  I have issued it and had it error 4 times in a row, then I manually switch (push the tabs) and it still errors.  Using 'tilemode' and it still errors.  This dosn't happen offten, but it does happen.  I don't know what causes it, or how to fix it, so maybe an error catch will work probably 80% of the time.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Finding list of tabs ...
« Reply #10 on: January 09, 2007, 11:50:13 AM »
Wow, sounds like it really broken.  :-o
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.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Finding list of tabs ...
« Reply #11 on: January 09, 2007, 12:03:04 PM »
Wow, sounds like it really broken.  :-o
Yea, and I never noticed it until I tried to do the stuff in the this thread, so it might just be a random thing with certain drawings.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Hangman

  • Swamp Rat
  • Posts: 566
Re: Finding list of tabs ...
« Reply #12 on: January 09, 2007, 03:13:04 PM »
So what's the conclusion to this little dilemma, ...

are you telling me that it doesn't matter what tab it goes to when switching to paper space, you can't determine and set active the particular tab you want ???
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Finding list of tabs ...
« Reply #13 on: January 09, 2007, 03:18:48 PM »
So what's the conclusion to this little dilemma, ...

are you telling me that it doesn't matter what tab it goes to when switching to paper space, you can't determine and set active the particular tab you want ???
You might be able to, but sometimes it might error, so it won't be able to.

If all you want to do is a get a list of the layouts, and then pull up a little dialog so select, then yest you can make it work (I think).  If you have a specific layout you want it to always go to, then I think you can make a button to do that also.  I would think you would want a new button, and not a reactor (just a thought I wanted to put out there =D).
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Finding list of tabs ...
« Reply #14 on: January 09, 2007, 04:06:03 PM »
So what's the conclusion to this little dilemma, ...

are you telling me that it doesn't matter what tab it goes to when switching to paper space, you can't determine and set active the particular tab you want ???
Questions:
Is the preferred tab always the first one after the Model Space Tab?
Does the preferred tab always have the same name or is the name unique in some way?
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.