private void btnStart_Click(object sender, EventArgs e) { activeIndex = 0; activeNote = noteList[activeIndex]; haveNextNote = true; // this.Visible = false; swApp = Comm.ConnectToSolidWorks(); swModel = (ModelDoc2)swApp.ActiveDoc; swModelDocExt = swModel.Extension; swModelView = (ModelView)swModel.GetFirstModelView(); TheMouse = swModelView.GetMouse(); mouseClass mouseClass = new mouseClass(this); Frame swFrame = (Frame)swApp.Frame(); swFrame.SetStatusBarText("Next Click to insert " + activeNote); TheMouse.MouseSelectNotify += mouseClass.ms_MouseSelectNotify; Debug.Print("done"); }
/// <summary> /// uses a hashtable field called openModelViews and iterates through modelViews of this document ///if the hashtable openModelViews does not have a modelView ///creates a DocumentView object and adds EventHandlers (OnDestroyNotify and OnRepaintNotify) to it and then ///adds the modelView and documentView to the hashtable /// </summary> /// <returns>true</returns> public bool ConnectModelViews() { IModelView modelView; modelView = (IModelView)document.GetFirstModelView(); while (modelView != null) { if (!openModelViews.Contains(modelView)) { ModelViewHelper modelViewHelper = new ModelViewHelper(userAddin, modelView, this); modelViewHelper.AttachEventHandlers(); openModelViews.Add(modelView, modelViewHelper); } modelView = (IModelView)modelView.GetNext(); } return true; }
public bool ConnectModelViews() { IModelView mView; mView = (IModelView)document.GetFirstModelView(); while (mView != null) { if (!openModelViews.Contains(mView)) { DocView dView = new DocView(userAddin, mView, this); dView.AttachEventHandlers(); openModelViews.Add(mView, dView); } mView = (IModelView)mView.GetNext(); } return(true); }
public void RunMacro() { swModelDoc = (ModelDoc2)swApp.ActiveDoc; swModelDocExtn = swModelDoc.Extension; //ViewMgr = swModelDoc.ModelViewManager; //ViewMgr.ViewportDisplay = (int)swViewportDisplay_e.swViewportFourView; swModelDoc.GetModelViewCount(); swModelView = (ModelView)swModelDoc.GetFirstModelView(); while (((swModelView != null))) { Viewcallout = swModelView.CreateCallout(1, handle); Viewcallout.set_Label2(0, "TEST"); Viewcallout.SkipColon = false; Viewcallout.set_ValueInactive(0, true); Viewcallout.SetTargetPoint(0, 0.0, 0.0, 0.0); Viewcallout.Display(true); System.Diagnostics.Debugger.Break(); swModelView = (ModelView)swModelView.GetNext(); } }