Author Topic: External LayoutManager Instance  (Read 2289 times)

0 Members and 1 Guest are viewing this topic.

TJK44

  • Guest
External LayoutManager Instance
« on: January 23, 2014, 08:51:43 AM »
I am trying to get the LayoutManager for a newly created database, but can't seem to find it. Documentation says it is a member of Autodesk.AutoCAD.DatabaseServices.

Code - Visual Basic: [Select]
  1. Using db As New Database(False, False)
  2.      Dim layoutMgr As LayoutManager = db.LayoutManager '<------- Not a valid property, where would it be located?
  3. End Using
  4.  

Thanks,

Ted
« Last Edit: January 23, 2014, 08:55:57 AM by TJK44 »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: External LayoutManager Instance
« Reply #1 on: January 23, 2014, 02:54:23 PM »

Can't make time to play, bu have you tried something like

LayoutManager.Current.CurrentLayout
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

n.yuan

  • Bull Frog
  • Posts: 348
Re: External LayoutManager Instance
« Reply #3 on: January 23, 2014, 04:38:43 PM »
Which document says Database has a property "LayoutManager"? I do not see Database has such a property up to AutoCAD 2014. It is true that "LayoutManager is a member if "Autodesk.AutoCAD.DatabaseServices" (namespace!), but it is not a member (property or method) of "Autodesk.AutoCAD.DatabaseServices.Database" (a class!).

LayoutManager is an class that can only be instantiated by Autodesk.AutoCAD.ApplicationServices.Application behind scene automatically based on current active document (MdiActiveDocument). That is why it can only be accessed by LayoutManager.Current.

Since you just create a side database without document, there is no LayoutManager available in terms of that database, I think.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: External LayoutManager Instance
« Reply #4 on: January 23, 2014, 04:49:42 PM »

I think you're correct Norman.
I missed the 'side' database ramifications.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

TJK44

  • Guest
Re: External LayoutManager Instance
« Reply #5 on: January 23, 2014, 05:37:47 PM »
Thanks Norman for clarifying. I think I will have to approach differently if LayoutManager is only accessible through the active document.

MickD

  • King Gator
  • Posts: 3657
  • (x-in)->[process]->(y-out) ... simples!
Re: External LayoutManager Instance
« Reply #6 on: January 23, 2014, 05:55:35 PM »
I think you would only use layout manager to say switch/add/delete tabs to the currently open document, that is, it's more to do with the tabs on the screen UI. Only guessing here of course but looking at the members it seems of limited use for editing (as n.yuan alluded to).

However, if you are after the layouts to add or edit entities you are better off with the LayoutTable and get a LayoutTableRecord, this you can get from any database read into memory (i.e. in the background, not just the current doc).
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Jeff H

  • Needs a day job
  • Posts: 6151
Re: External LayoutManager Instance
« Reply #7 on: January 23, 2014, 06:42:32 PM »
Quote from: docs
There is one instance of a layout manager per application. The layout manager always operates on the current layout.