Author Topic: change active layout in autocad R14  (Read 9321 times)

0 Members and 1 Guest are viewing this topic.

yaque

  • Guest
change active layout in autocad R14
« on: October 22, 2010, 04:23:03 PM »
I have a challenge for you good people.
My office is (until recently)  exclusively Autocad R14. That means no Visual Lisp!
(I know, you can laugh, It's okay  :-)  )

We intend to transfer to Bricscad Pro.
(I want immediately, my bosses would drag it out over years  :cry: )
So, at least for a while, we'll have both.
Files would be saveas R14, that works okay.

But I would like to start using multiple layouts.
Autocad R14 and vanilla lisp can access and manipulate dictionaries,
and layouts live in dictionaries someplace.
So I could likely work out a lisp, that when the R14 user switches to paperspace,
a prompt asks the user which layout, and sets the "active" layout accordingly before switching.

I don't like to reinvent the wheel, does something like this already exist?
or a lisp fragment showing how to change the "active" layout without visual lisp?

I'm aware that this is from the stone age, sorry  :oops: .

T.Willey

  • Needs a day job
  • Posts: 5251
Re: change active layout in autocad R14
« Reply #1 on: October 22, 2010, 04:35:20 PM »
The system variable ' ctab ' will let you change the current tab ( layout ).
Tim

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

Please think about donating if this post helped you.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: change active layout in autocad R14
« Reply #2 on: October 22, 2010, 04:37:20 PM »
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: change active layout in autocad R14
« Reply #3 on: October 22, 2010, 04:40:41 PM »
I know I'm going to hell but I laughed hard.  :-D
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

yaque

  • Guest
Re: change active layout in autocad R14
« Reply #4 on: October 22, 2010, 04:56:33 PM »
That's my problem, "ctab" is a variable in Autocad 2000 and up, not in Autocad R14  :cry:
When opening a drawing from A2000 and up in Acad14, the last edited layout is opened, and the others are not accessible
in Acad14.

So I have to go into the dictionaries with plain lisp, get the list of layout names,
and set one of them as being the "last edited" layout, so that the Acad14 user can get to it when going to "paperspace".
I know, awkward  :? .

My real question is, how is the "last edited" layout stored? in a dictionary?
How does Autocad remember which layout to switch to when "tilemode" is set to "0"?
 

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: change active layout in autocad R14
« Reply #5 on: October 22, 2010, 04:59:30 PM »
Code: [Select]
(command "_.layout" "_set"....)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

yaque

  • Guest
Re: change active layout in autocad R14
« Reply #6 on: October 22, 2010, 05:04:23 PM »
alanjit:
    :-D
I know, you're right, but my boss hates the Autodesk treadmill, and for most purposes, R14 is adequate.
I'm trying to persuade him to get on the Bricscad treadmill (version 11 just came out)
which is a lot more bearable.

And I like Bcad. 8-)

yaque

  • Guest
Re: change active layout in autocad R14
« Reply #7 on: October 22, 2010, 05:05:13 PM »
Sorry, "layout" isn't a command in Autocad R14 either  :-(

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: change active layout in autocad R14
« Reply #8 on: October 22, 2010, 05:11:10 PM »
That's my problem, "ctab" is a variable in Autocad 2000 and up, not in Autocad R14  :cry:
When opening a drawing from A2000 and up in Acad14, the last edited layout is opened, and the others are not accessible
in Acad14.

So I have to go into the dictionaries with plain lisp, get the list of layout names,
and set one of them as being the "last edited" layout, so that the Acad14 user can get to it when going to "paperspace".
I know, awkward  :? .

My real question is, how is the "last edited" layout stored? in a dictionary?
How does Autocad remember which layout to switch to when "tilemode" is set to "0"?
 
r14 didn't have layouts. It only had Paper and Model. If I remember correctly, if the drawing is saved (from newer to r14) and has multiple layouts, the active layout (if a paperspace one) will become Paperspace and the rest are lost. Am I way off? It's been a while since I had to deal with that.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

yaque

  • Guest
Re: change active layout in autocad R14
« Reply #9 on: October 22, 2010, 05:16:38 PM »
No, they aren't lost. They survive the round trip okay, It's just that Acad14 can't normally get to them.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: change active layout in autocad R14
« Reply #10 on: October 22, 2010, 05:18:03 PM »
No, they aren't lost. They survive the round trip okay, It's just that Acad14 can't normally get to them.
Hmph, interesting.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

T.Willey

  • Needs a day job
  • Posts: 5251
Re: change active layout in autocad R14
« Reply #11 on: October 22, 2010, 05:19:03 PM »
I wouldn't even know where to start looking.  The layout are in a dictionary within the named object dictionary.

Command: (PEDATA (dictsearch (namedobjdict) "ACAD_LAYOUT"))

(-1 . <Entity name: -4af8d330>)
(0 . "DICTIONARY")
(5 . "1A")
(102 . "{ACAD_REACTORS")
(330 . <Entity name: -4af8d3a0>)
(102 . "}")
(330 . <Entity name: -4af8d3a0>)
(100 . "AcDbDictionary")
(280 . 0)
(281 . 1)
(3 . "Layout1")
(350 . <Entity name: -4af8d2b8>)
(3 . "Layout2")
(350 . <Entity name: -4af8d290>)
(3 . "Model")
(350 . <Entity name: -4af8d2f0>)

Maybe that helps.
Tim

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

Please think about donating if this post helped you.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: change active layout in autocad R14
« Reply #12 on: October 22, 2010, 05:21:04 PM »
I'm curious how you are going to see them with r14 CAD (relying on you having found the objects in a dictionary or something). Multiple sheets in r14 consisted of lots of viewports in the one and only paperspace.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

T.Willey

  • Needs a day job
  • Posts: 5251
Re: change active layout in autocad R14
« Reply #13 on: October 22, 2010, 05:24:07 PM »
Maybe it can only read the first layout.  Not sure how that would be told unless by handles, or it just knows the last active layout, and keeps that one, as the one R14 should see.
Tim

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

Please think about donating if this post helped you.

yaque

  • Guest
Re: change active layout in autocad R14
« Reply #14 on: October 22, 2010, 05:39:33 PM »
Right,
(dictsearch (namedobjdict) "ACAD_LAYOUT")
returns
((-1 . <Entity name: 4671c18>)
  (0 . "DICTIONARY")
  (5 . "DF50B")
  (102 .  "{ACAD_XDICTIONARY")
  (360 . <Entity name: 4750510>)
  (102 . "}")
  (102 . "{ACAD_REACTORS")
  (330 . <Entity name: 3820460>)
  (102 . "}")
  (100 . "AcDbDictionary")
  (280 . 0)
  (3 . "B")
  (350 . <Entity name: 4671c30>)
  (3 . "MODEL")
  (350 . <Entity name: 4671c28>)
  (3 . "P")
  (350 . <Entity name: 47015f8>)
)
  in an Autocad R14 session in a file with two layouts named "P" and "B".
So, when "tilemode" is set to "0", Autocad R14 goes to layout "P"

When I save the file with layout "B" as the "active" layout I get

((-1 . <Entity name: 4651c18>)
 (0 . "DICTIONARY")
 (5 . "DF50B")
 (102 . "{ACAD_XDICTIONARY")
 (360 . <Entity name: 4730530>)
 (102 . "}")
 (102 . "{ACAD_REACTORS")
 (330 . <Entity name: 45d0460>)
 (102 . "}")
 (100 . "AcDbDictionary")
 (280 . 0)
 (3 . "B")
 (350 . <Entity name: 4651c30>)
 (3 . "MODEL")
 (350 . <Entity name: 4651c28>)
 (3 . "P")
 (350 . <Entity name: 46e15f8>)
)
and when "tilemode" is set to "0", Autocad R14 goes to layout "B"


Damn they look the same, I think?

yaque

  • Guest
Re: change active layout in autocad R14
« Reply #15 on: October 22, 2010, 05:44:50 PM »
alanjt:
yes, when opening a file from a higher acad saved in format R14 with multiple layouts,
the last accessed layout is shown as "paperspace" when "tilemode" is set to "0" in Autocad R14.

The other layouts aren't accessible, but are okay when the file is reopened in the higher Autocad version.

My problem is, where does Autocad store "the last accessed layout"?

T.Willey

  • Needs a day job
  • Posts: 5251
Re: change active layout in autocad R14
« Reply #16 on: October 22, 2010, 05:47:47 PM »
You will have to look at the dxf code for the layouts ' P ' and ' B '.

(foreach i (dictsearch (namedobjdict) "ACAD_LAYOUT")
(if (equal (car i) 3)
(print (cdr i))
)
(if (equal (car i) 350 )
(foreach j (entget (cdr i) '("*"))
(print j)
)
)
)

This should print to the command line all the layout's dxf codes with the layout name before it.
Tim

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

Please think about donating if this post helped you.

yaque

  • Guest
Re: change active layout in autocad R14
« Reply #17 on: October 22, 2010, 05:48:27 PM »
Oh, and if I can find the "the last accessed layout" variable in a dictionary or someplace,
I can then change it, and then Autocad will then display that layout as paperspace.

Voila! multiple layout support in Autocad R14!

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: change active layout in autocad R14
« Reply #18 on: October 22, 2010, 05:48:48 PM »
Really shows you how spoiled new version users are.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

ronjonp

  • Needs a day job
  • Posts: 7526
Re: change active layout in autocad R14
« Reply #19 on: October 22, 2010, 05:51:18 PM »
Man ... I remember installing R14 off a stack of floppies  I sure miss those days  NOT  :-D   second thought that was r12  :oops:

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: change active layout in autocad R14
« Reply #20 on: October 22, 2010, 05:54:02 PM »
Man ... I remember installing R14 off a stack of floppies  I sure miss those days  NOT  :-D   second thought that was r12  :oops:
LoL
Just thinking about printing 50 sheet documents by window plots and having to activate the viewports in groups made me sick to my stomach.


Really, floppy discs? We had r14 on CD-ROM.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

yaque

  • Guest
Re: change active layout in autocad R14
« Reply #21 on: October 22, 2010, 05:55:30 PM »
T. Willey:
Hm, I get
"B"
(-1 . <Entity name: 4651c30>)
(0 . "ACAD_PROXY_OBJECT")
(5 . "DF50E")
(102 . "{ACAD_REACTORS")
(330 . <Entity name: 4651c18>)
(102 . "}")
"MODEL"
(-1 . <Entity name: 4651c28>)
(0 . "ACAD_PROXY_OBJECT")
(5 . "DF50D")
(102 . "{ACAD_REACTORS")
(330 . <Entity name: 4651c18>)
(102 . "}")
"P"
(-1 . <Entity name: 46e15f8>)
(0 . "ACAD_PROXY_OBJECT")
(5 . "111CF7")
(102 . "{ACAD_REACTORS")
(330 . <Entity name: 4651c18>)
(102 . "}") (102 . "}")

in the "B" layout file, and ... the same in the "P" layout file. Damn.
It isn't here.

yaque

  • Guest
Re: change active layout in autocad R14
« Reply #22 on: October 22, 2010, 05:59:07 PM »
Yeah, I remember R12 too. That was actually a great version, very solid.
So's R14.
And I run 100+ page A4 plots in the same file in R14 using numbered views and a lisp.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: change active layout in autocad R14
« Reply #23 on: October 22, 2010, 06:00:27 PM »
That is what I was scared of.  I can't even think how one would know which paper space layout it would switch to if you just changed the tilemode system variable in the later version of acad, with straight lisp.  I'll see if I can find anything out here.
Tim

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

Please think about donating if this post helped you.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: change active layout in autocad R14
« Reply #24 on: October 22, 2010, 06:00:32 PM »
Yeah, I remember R12 too. That was actually a great version, very solid.
So's R14.
And I run 100+ page A4 plots in the same file in R14 using numbered views and a lisp.

Sadly, at that time, the only customization I knew was typing and clicking really fast.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

yaque

  • Guest
Re: change active layout in autocad R14
« Reply #25 on: October 22, 2010, 06:01:36 PM »
And I still use a modified version of that lisp to batch plot multiple sheets in Bricscad.

yaque

  • Guest
Re: change active layout in autocad R14
« Reply #26 on: October 22, 2010, 06:03:51 PM »
Heh, my boss sent me to a short Autolisp course.
Best investment he ever made.
Now I have about a megabyte of lisps in about 140 files, mostly mine.

yaque

  • Guest
Re: change active layout in autocad R14
« Reply #27 on: October 22, 2010, 06:07:30 PM »
T, Willey
 Thanks! No rush.

I'm really not very familiar with the "AcDbDictionary" jungle.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: change active layout in autocad R14
« Reply #28 on: October 22, 2010, 06:10:32 PM »
Me either.  I know enough to know I don't know enough.  The help, and here, are my friends when I go digging into dictionary items.

You're welcome Yaque.
Tim

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

Please think about donating if this post helped you.

yaque

  • Guest
Re: change active layout in autocad R14
« Reply #29 on: October 22, 2010, 06:13:48 PM »
Goodnight! (yeah it's midnight here) I'll check in tomorrow. and thanks again!

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: change active layout in autocad R14
« Reply #30 on: October 22, 2010, 08:33:34 PM »
I'm not at my pc right now but I'm guessing that AutoCAD 14 isn't reading the "ActiveLayout" but instead just displaying the first layout in the collection. Could be/probably wrong, but it was my immediate thought.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

yaque

  • Guest
Re: change active layout in autocad R14
« Reply #31 on: October 23, 2010, 06:24:08 AM »
Autocad R14, like higher Autocad versions, opens a file at the last view shown, either in modelspace or in the last shown layout.
If opened in modelspace, in all versions, when the "TILEMODE" variable is set to "0", Autocad switches to the last edited layout.

I have a  file with 2 layouts, one called "P" and one called "B".
As an experiment, I saved the file in R14 format from a higher version twice.
One when layout "P" was last accessed, and one with "B" last accessed.

I then opened each in Autocad R14 and then set the "TILEMODE" variable to "0"
(which is the only way for Autocad R14 to switch to paperspace from modelspace).
In each file I arrived at the appropriate layout - "P" in the first file and "B" in the second file.

(When reopened in Autocad 2000, etc. both layouts are normally accessible
Autocad R14 doesn't trash the existing dictionary structure, it just doesn't read some of it).

Layouts are stored in a dictionary structure,
and I can access and change dictionary objects in Autocad R14 without Visual Lisp.
I can get the dxf list of each layout and modify it with (entmod ...)

My problem is where is "the last accessed layout name" stored in the dwg file structure?
If it's somewhere in the dictionary structure, I can change it from inside Autocad R14 using plain autolisp.

I thank you all for your attention and patience with my obscure problem on an obsolete version.  :-)
 

David Bethel

  • Swamp Rat
  • Posts: 656
Re: change active layout in autocad R14
« Reply #32 on: October 23, 2010, 07:11:45 AM »
yaque,

I use R14 (and r12 ) on a regular basis.  I've never been able to find what your looking for.  Hopefully it is accessible, but I doubt it.  -David
R12 Dos - A2K

hermanm

  • Guest
Re: change active layout in autocad R14
« Reply #33 on: October 23, 2010, 10:33:59 AM »
Look in the block table.
There is always a block called *MODEL_SPACE
In R14, there is (or can be) one block called *PAPER_SPACE
In R2000 & up, there can also be other blocks called *PAPER_SPACE nnn
When you switch "Layout" AutoCAD renames the blocks, so the current layout always corresponds to the block named *PAPER_SPACE.
This is how round trip to R14 is accomplished.
The *PAPER_SPACE nnn blocks are still there, but R14 knows nothing about them.

Can you switch layouts by renaming the blocks via LISP, in any version?
I don't know.

yaque

  • Guest
Re: change active layout in autocad R14
« Reply #34 on: October 23, 2010, 11:02:52 AM »
Mucho Gracias!
Beautiful!
Boy, backwards compatibility is a PITA.

I'll mess around with renaming the *PAPERSPACE blocks and see what blows up.

If you see a mushroom cloud off to the east,
that'll be me and acad14  :-o