.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get instantiated plugin class?

1 REPLY 1
SOLVED
Reply
Message 1 of 2
nshupeFMPE3
337 Views, 1 Reply

How to get instantiated plugin class?

In the plugin that is generated for learning to write AutoCAD plugins, this is written in the "main" class

 

// This class is instantiated by AutoCAD once and kept alive for the 
    // duration of the session. If you don't do any one time initialization 
    // then you should remove this class.

 

Is it possible to access this instance in order to get at a property that is set up during the Initialize() method? 

Labels (4)
1 REPLY 1
Message 2 of 2
_gile
in reply to: nshupeFMPE3

Hi,

You can define a static property in the class which implements IExtensionApplication:

 

    public class Initialization : IExtensionApplication
    {
        public static int MeaningOfLife { get; private set; }

        public void Initialize()
        {
            MeaningOfLife = 42;
        }

        public void Terminate()
        { }
    }

 

 

and get its value form other classes with: Initialization.MeaningOfLife



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report