/// <summary>
        /// Default constructor
        /// </summary>
        public SolidWorksApplication(SldWorks solidWorks, int cookie) : base(solidWorks)
        {
            // Set preferences
            Preferences = new SolidWorksPreferences();

            // Store cookie Id
            mSwCookie = cookie;

            //
            //   NOTE: As we are in our own AppDomain, the callback is registered in the main SolidWorks AppDomain
            //         We then pass that into our domain
            //
            // Setup callback info
            // var ok = mBaseObject.SetAddinCallbackInfo2(0, this, cookie);

            // Hook into main events
            mBaseObject.ActiveModelDocChangeNotify += ActiveModelChanged;
            mBaseObject.FileOpenPreNotify          += FileOpenPreNotify;
            mBaseObject.FileOpenPostNotify         += FileOpenPostNotify;

            // Get command manager
            CommandManager = new CommandManager(UnsafeObject.GetCommandManager(mSwCookie));

            // Get whatever the current model is on load
            ReloadActiveModelInformation();
        }
Exemple #2
0
 /// <summary>
 /// Recurses the model for all of it's features and sub-features
 /// </summary>
 /// <param name="featureAction">The callback action that is called for each feature in the model</param>
 public void Features(Action <ModelFeature, int> featureAction)
 {
     RecurseFeatures(featureAction, UnsafeObject.FirstFeature() as Feature);
 }