Author Topic: VIEWCTR reactor  (Read 12495 times)

0 Members and 1 Guest are viewing this topic.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: VIEWCTR reactor
« Reply #15 on: April 18, 2012, 08:23:46 AM »
  • The module could then post each command registered with the specific event to the document session.
You might try this idea: http://www.theswamp.org/index.php?topic=39931.15

Everything before 2011 would use the acedEvaluateLisp function by PInvoking it from the unmanaged acad.exe file (as if it's a normal dll file). Since 2011 you get Application.Invoke (as Gile's stated in that thread).
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Xander

  • Guest
Re: VIEWCTR reactor
« Reply #16 on: April 18, 2012, 08:44:03 AM »
http://exchange.autodesk.com/autocad/enu/online-help/browse#WS1a9193826455f5ff-e569a0121d1945c08-2d26.htm

Might be capable of detecting the VIEWCTR reactor.

And a simple SendStringToExeccute for testing to call the registered lisp method. Which was available in the 2007 library. Might work. If the LISP method is incorrect or not found, it should be capable of being handled by LISP.

Xander

  • Guest
Re: VIEWCTR reactor
« Reply #17 on: April 19, 2012, 01:40:48 AM »
I've done my tinkering and discovered the following:
Code: [Select]
SystemVariableChangedEventHandler(appSysVarChanged)will not recognise a VIEWCTR change.

However you can use the current active document ViewChanged Event:




Code - C#: [Select]
  1. using System;
  2. using Autodesk.AutoCAD.ApplicationServices;
  3. using Autodesk.AutoCAD.DatabaseServices;
  4. using Autodesk.AutoCAD.Runtime;
  5. using Application = Autodesk.AutoCAD.ApplicationServices.Core.Application;
  6.  
  7. namespace ReactorTest
  8. {
  9.     public class Command
  10.     {
  11.         /// <summary>
  12.         /// Invoke method through AutoCAD using 'NetViewTest'
  13.         /// </summary>
  14.         [CommandMethod("NetViewTest")]
  15.         public void NetViewTest()
  16.         {
  17.             Document doc = Application.DocumentManager.MdiActiveDocument;
  18.             using (Transaction trx = doc.Database.TransactionManager.StartTransaction())
  19.             {
  20.                 doc.ViewChanged += DocViewChanged;
  21.                 trx.Commit();
  22.             }
  23.         }
  24.  
  25.         /// <summary>
  26.         /// Handles a custom document view changed event
  27.         /// </summary>
  28.         /// <param name="sender"></param>
  29.         /// <param name="e"></param>
  30.         private void DocViewChanged(object sender, EventArgs e)
  31.         {
  32.             Application.DocumentManager.MdiActiveDocument.SendStringToExecute(
  33.                 "(reactor:grdisplaytest) ", //String to execute.
  34.                 true, //Activate
  35.                 false, //Wrap Up Inactive Document
  36.                 true); //Echo Command
  37.         }
  38.     }
  39. }
  40.