private void getModelDoc() { swDoc = ((ModelDoc2)(swApp.ActiveDoc)); if (swDoc.GetType() == (int)swDocumentTypes_e.swDocASSEMBLY) { swAssembly = ((AssemblyDoc)(swDoc)); } swSelectionMgr = ((SelectionMgr)(swDoc.SelectionManager)); swConfMgr = ((ConfigurationManager)swDoc.ConfigurationManager); swConf = ((Configuration)swConfMgr.ActiveConfiguration); swSketchMgr = ((ISketchManager)swDoc.SketchManager); measure = swDoc.Extension.CreateMeasure(); measure.ArcOption = 1; // minimum distance mathUtils = swApp.IGetMathUtility(); swFeatureMgr = ((FeatureManager)swDoc.FeatureManager); mainBody = findComponent(swConf.GetRootComponent3(true), "body"); if (mainBody == null) { mainBody = findComponent(swConf.GetRootComponent3(true), "base"); if (mainBody == null) { Utilities.alert("we need a component with 'body' in its name to be the main body"); } } allSolidComponents = getAllComponents(); ourComponents = getAllOurComponents(); if (generatedMirrorExtrusions == null) { generatedMirrorExtrusions = new List <IFeature>(); } swAssembly.EditAssembly(); InstructionsGenerator.swApp = swApp; InstructionsGenerator.swDoc = swDoc; InstructionsGenerator.swAssembly = swAssembly; InstructionsGenerator.swSelectionMgr = swSelectionMgr; RayTracer.swApp = swApp; RayTracer.swDoc = swDoc; RayTracer.swAssembly = swAssembly; RayTracer.swSelectionMgr = swSelectionMgr; RayTracer.swSketchMgr = swSketchMgr; RayTracer.mathUtils = mathUtils; RayTracer.visualize = visualize.Checked; RayTracer.ourComponents = ourComponents; RayTracer.camera = camera; Simulator.swApp = swApp; Simulator.swDoc = swDoc; Simulator.swAssembly = swAssembly; Simulator.swFeatureMgr = swFeatureMgr; Simulator.mainBody = mainBody; Simulator.ourComponents = ourComponents; Utilities.swApp = swApp; Utilities.swDoc = swDoc; Utilities.swAssembly = swAssembly; Utilities.swSelectionMgr = swSelectionMgr; Utilities.swConfMgr = swConfMgr; Utilities.swConf = swConf; Utilities.swFeatureMgr = swFeatureMgr; Utilities.swSketchMgr = swSketchMgr; Utilities.measure = measure; Utilities.mathUtils = mathUtils; }