private void ResetState() { planeBase = cylinderBase1 = cylinderBase2 = null; planeLocator = prismLocator1 = prismLocator2 = null; corpus = null; shaft = null; horizont = null; }
private bool Initalize() { helper = Helper.Initialize(solidWorks.IGetMathUtility()); corpus = new Locator(solidWorks.IGetMathUtility()); shaft = new Locator(solidWorks.IGetMathUtility()); planeLocator = new Locator(solidWorks.IGetMathUtility()); prismLocator1 = new Locator(solidWorks.IGetMathUtility()); prismLocator2 = new Locator(solidWorks.IGetMathUtility()); document = solidWorks.ActiveDoc as IModelDoc2; assembly = document as IAssemblyDoc; if (assembly == null) { ShowMessage("Please, open document with assembly"); return false; } horizont = assembly.IFeatureByName(TOP_PLANE_NAME_EN); horizont = horizont == null ? assembly.IFeatureByName(TOP_PLANE_NAME_RU) : horizont; loader = Loader.Initialize(solidWorks, assembly); mounter = Mounter.Initialize(document); Debug.WriteLine("loading of assembly ... done!"); object[] components = assembly.GetComponents(true); foreach(IComponent2 component in components) { if (component.Name2.Contains(configuration[Property.MAIN_DETAIL_NAME])) { shaft.Component = component; Debug.WriteLine("shaft search ... done!"); break; } } if (shaft.Component == null) { ShowMessage("Please, add shaft to assembly or enter other/correct name"); return false; } return true; }