public AddFeature(ISldWorks _swApp) { swApp = _swApp; Doc = swApp.ActiveDoc; BitmapHandler iBmp = new BitmapHandler(); Assembly thisAssembly; thisAssembly = System.Reflection.Assembly.GetAssembly(this.GetType()); var sbm = iBmp.CreateFileFromResourceBitmap("qwe.ToolbarSmall.bmp", thisAssembly); var lbm = iBmp.CreateFileFromResourceBitmap("qwe.ToolbarLarge.bmp", thisAssembly); Doc.InsertLibraryFeature("Dave's LibFeatPartNameIn"); var tpv = swApp.CreateTaskpaneView2(lbm, "DoesIt"); tpv.AddStandardButton(0, "HERE!"); swApp.ActivateTaskPane(1); //tpv.AddStandardButton(1, "tooltip!"); //var toolbar = swApp.AddToolbar4( //var SelMan = Doc.SelectionManager; //string[] Methods = new string[9]; //int Names = 0; //int Types = 0; //int Values = 0; //int vEditBodies = 0; //long options = 0; //int dimTypes = 0; //int dimValue = 0; //string[] icons = new string[3]; //var ThisFile = "C:/Analytics"; //Methods[0] = ThisFile; //Methods[1] = "FeatureModule"; //Methods[2] = "swmRebuild"; //Methods[3] = ThisFile; //Methods[4] = "FeatureModule"; //Methods[5] = "swmEditDefinition"; //Methods[6] = ""; //Methods[7] = ""; //Methods[8] = ""; //A security routine is optional; //var pathname = ThisFile; //icons[0] = pathname + "/FeatureIcon.bmp"; //icons[1] = pathname + "/FeatureIcon.bmp"; //icons[2] = pathname + "/FeatureIcon.bmp"; //options = (long)swMacroFeatureOptions_e.swMacroFeatureByDefault; //Feature selFeat = SelMan.GetSelectedObject6(1, -1); //IFeatureManager swFeatMgr = Doc.FeatureManager; //swFeatMgr.InsertMacroFeature3("EmptyFeature", "", (object)Methods, (object)Names, (object)Types, (object)Values, (object)dimTypes, (object)dimValue, (object)vEditBodies, (object)icons, (int)options); //var boolstatus = feat.MakeSubFeature(selFeat); }
public void AddTaskPane() { tpv = iSwApp.CreateTaskpaneView2("", "FTL VAME Explorer"); tpv.ShowView(); tph = tpv.AddControl("TestPane", ""); tph.getSwApp(iSwApp); tph.getSwAddin(this); }
public void WinFormInTaskPane() { ITaskpaneView pTaskPanView; pTaskPanView = iSwApp.CreateTaskpaneView2("", "C# .NET Control"); TaskPanWinFormControl = new Form1(); pTaskPanView.DisplayWindowFromHandle(TaskPanWinFormControl.Handle.ToInt64()); TaskPanUserControl = (UserControl1)pTaskPanView.GetControl(); Debug.Print(TaskPanUserControl.Name); }
private void AddTaskPanel() { ITaskpaneView pTaskPanView; pTaskPanView = iSwApp.CreateTaskpaneView2("gltf.bmp", "将Solidworks文件转换为glTF"); if (TaskPanelControl == null) { SwAddin.TaskPanelControl = new ConvertPanel(SwApp); eleHost.Child = TaskPanelControl; } pTaskPanView.DisplayWindowFromHandlex64(eleHost.Handle.ToInt64()); }
private void CreateTaskPane(ISldWorks pSldWorks) { var thisAssembly = Assembly.GetAssembly(GetType()); var bmp = new BitmapHandler(); var icon = bmp.CreateFileFromResourceBitmap("RobotWare.SolidWorks.robot_16x18.bmp", thisAssembly); var view = pSldWorks.CreateTaskpaneView2(icon, @"RobotWare for SolidWorks"); var ctrl = (ManagerCtrlX)view.AddControl(@"RobotWare.ActiveXUserControl", @""); var root = new RobotWareWrapper("RobotWare for SolidWorks", pSldWorks); var mgrCtl = new ManagerCtl(root) { Dock = DockStyle.Fill }; ctrl.Controls.Add(mgrCtl); }
private void btnComfirm_Click(object sender, EventArgs e) { var routings = from p in rcontext.ProcessFileRoutinges where p.ProcessFileName == GlobalCache.Instance.ComponetName && p.RoutingId == cbxProcessLine.SelectedValue.ToString() select p; if (routings.Count() > 0) { MessageBox.Show("该零件已和选中的工艺路线进行了关联!"); return; } ProcessFileRouting processFileRouting = new ProcessFileRouting(); processFileRouting.RoutingId = cbxProcessLine.SelectedValue.ToString(); processFileRouting.ProcessFileRoutingId = Guid.NewGuid().ToString(); processFileRouting.ProcessFileName = _processFilePath; processFileRouting.ProcessFilePath = _processFilePath; processFileRouting.OperId = ""; try { rcontext.ProcessFileRoutinges.InsertOnSubmit(processFileRouting); rcontext.SubmitChanges(); MessageBox.Show("关联零件到工艺路线成功!"); ITaskpaneView pTaskPanView = null; if (GlobalCache.Instance.PTaskPanView == null) { pTaskPanView = _swApp.CreateTaskpaneView2("", "关联工艺路线"); GlobalCache.Instance.PTaskPanView = pTaskPanView; } else { pTaskPanView = GlobalCache.Instance.PTaskPanView; } ProcessLine frm = null; if (ProcessLine.CurrentProcessLine == null) { frm = new ProcessLine( _doc, _swApp, new List <string>() { processFileRouting.RoutingId }); pTaskPanView.DisplayWindowFromHandle(frm.Handle.ToInt32()); } else { ///show in task plane ProcessLine.CurrentProcessLine.AddProcessLine( null, new RoutingEventArgs() { RoutingId = processFileRouting.RoutingId, RoutingName = ((Routing)cbxProcessLine.SelectedItem).Name }); } } catch { MessageBox.Show("关联零件到工艺路线出错!"); } this.Dispose(); GC.Collect(); }