Author Topic: LayoutManager.Current.LayoutSwitched Event  (Read 1327 times)

0 Members and 1 Guest are viewing this topic.

GumbyCAD

  • Newt
  • Posts: 84
LayoutManager.Current.LayoutSwitched Event
« on: August 28, 2014, 03:08:38 AM »
Hi All,

I am trying to use the said Event to controls my ltscale.

i.e. When I switch from ModelSpace to Paperspace set it and the reverse when switching back.
(LayoutManager.Current.LayoutSwitched)

It seam to be that the Layout Manager is global for all files that get opened.

Does anyone have any experience with this?


Also if I use:

Code - Visual Basic: [Select]
  1. RemoveHandler LayoutManager.Current.LayoutSwitched, AddressOf P3.CalculateNewProposedLtAndDimScales
  2.  

I get a warning.

The 'AddressOf' expression has no effect in this context because the method argument to 'AddressOf' requires a relaxed conversion to the delegate type of the event. Assign the 'AddressOf' expression to a variable, and use the variable to add or remove the method as the handler.

Any ideas?




Keith Brown

  • Swamp Rat
  • Posts: 601
Re: LayoutManager.Current.LayoutSwitched Event
« Reply #1 on: August 28, 2014, 11:47:03 AM »
Maybe you can instead monitor the Application.SystemVariableChanged event and look for "Ctab".  This will give you the name of the current layout.  Store the current value and then when the variable changes compare it to the current variable and see if it changed.  If so then update the current variable and then do your processing.  The CTAB variable is per document so it should solve your problems in theory.
Keith Brown | AutoCAD MEP Blog | RSS Feed
AutoCAD MEP 2014 / Revit MEP 2014 / EastCoast CAD/CAM addon / Visual Studio 2013