public ObjectSelection(object @object, swSelectType_e type, int mark, int index) { Object = @object; Index = index; Type = type; Mark = mark; }
private bool OnSelection(DocumentHandler docHandler, swSelectType_e selType, SelectionState_e state) { switch (state) { case SelectionState_e.UserPreSelect: if (!Filter?.Contains(selType) == true) { return(false); } break; case SelectionState_e.UserPostSelect: var sel = FindLastObjectByMark(Mark); if (sel == Selection) { sel = null; } Selection = sel; break; case SelectionState_e.ClearSelection: Selection = null; break; } return(true); }
/// <inheritdoc/> /// <exception cref="GroupIdAlreadyExistsException"/> /// <exception cref="InvalidMenuToolbarOptionsException"/> /// <exception cref="ArgumentException"/> /// <exception cref="CallbackNotSpecifiedException"/> public CommandGroup AddContextMenu <TCmdEnum>(Action <TCmdEnum> callback, swSelectType_e contextMenuSelectType = swSelectType_e.swSelEVERYTHING, EnableMethodDelegate <TCmdEnum> enable = null) where TCmdEnum : IComparable, IFormattable, IConvertible { return(AddCommandGroupOrContextMenu(callback, enable, true, contextMenuSelectType)); }
public static object GetReferenceEntityEx(this ISketch ske, out swSelectType_e entityType) { int entityType_int = 0; var obj = ske.GetReferenceEntity(ref entityType_int); entityType = entityType_int.CastObj <swSelectType_e>(); return(obj); }
/// <summary> /// .ctor /// </summary> /// <param name="object">对象</param> /// <param name="type">类型</param> /// <param name="mark">标记</param> /// <param name="index">序号</param> /// <param name="selecMgr">管理器</param> public ObjectSelection(object @object, swSelectType_e type, int mark, int index, ref ISelectionMgr selecMgr) { Object = @object; Index = index; Type = type; Mark = mark; _selecMgr = selecMgr; }
/// <inheritdoc/> /// <exception cref="GroupIdAlreadyExistsException"/> /// <exception cref="InvalidMenuToolbarOptionsException"/> /// <exception cref="ArgumentException"/> /// <exception cref="CallbackNotSpecifiedException"/> public CommandGroup AddContextMenu <TCmdEnum>(Action <TCmdEnum> callback, swSelectType_e contextMenuSelectType = swSelectType_e.swSelEVERYTHING, EnableMethodDelegate <TCmdEnum> enable = null) where TCmdEnum : IComparable, IFormattable, IConvertible { return(AddContextMenu( new EnumCommandGroupSpec <TCmdEnum>(App, callback, enable, GetNextAvailableGroupId(), m_CommandGroups.Keys), contextMenuSelectType)); }
private bool OnSelection(DocumentHandler docHandler, swSelectType_e selType, SelectionState_e state) { if (state == SelectionState_e.NewSelection) { InvokeTrigger(Triggers_e.NewSelection); } return(true); }
//Only allows components to be selected for the PMPage selection box void setComponentFilters() { swSelectType_e[] filters = new swSelectType_e[1]; filters[0] = swSelectType_e.swSelCOMPONENTS; object filterObj = null; filterObj = filters; pm_Selection.SetSelectionFilters(filterObj); }
protected IDisposable CreateSelectionBox <TModel>( IPropertyManagerPageGroup @group, string tip, string caption, swSelectType_e selectType, TModel model, Expression <Func <TModel, SelectionData> > propertyExpr, Action <IPropertyManagerPageSelectionbox> config) { return(CreateSelectionBox(@group, tip, caption, new[] { selectType }, model, propertyExpr, config, () => { })); }
bool ISelectionCustomFilter.Filter(IPropertyManagerPageControlEx selBox, object selection, swSelectType_e selType, ref string itemText) { if (selection is TSelection) { return(Filter(selBox, (TSelection)selection, selType, ref itemText)); } else { throw new InvalidCastException($"Selection type of {selBox.Id} doesn't match the '{typeof(TSelection)}' type"); } }
/// <summary> /// 获取选中对象 /// </summary> /// <param name="selMgr"></param> /// <returns></returns> public static IEnumerable <ObjectSelection> GetObjectSelections(this ISelectionMgr selMgr) { var count = selMgr.GetSelectedObjectCount(); for (int i = 1; i < count + 1; i++) { int selMark = selMgr.GetSelectedObjectMark(i); swSelectType_e swSelectType_E = (swSelectType_e)selMgr.GetSelectedObjectType3(i, AnyMark); object obj = selMgr.GetSelectedObject6(i, AnyMark); yield return(new ObjectSelection(obj, swSelectType_E, selMark, i, ref selMgr)); } }
/// <summary> /// 获取所有的选择对象 /// </summary> /// <param name="selMgr"></param> /// <param name="Mark"></param> /// <returns></returns> public static List <ObjectSelection> GetAllSelectedObjectsEx(this ISelectionMgr selMgr) { var count = selMgr.GetSelectedObjectCount(); List <ObjectSelection> objList = new List <ObjectSelection>(); for (int i = 1; i < count + 1; i++) { int selMark = selMgr.GetSelectedObjectMark(i); swSelectType_e swSelectType_E = (swSelectType_e)selMgr.GetSelectedObjectType3(i, AnyMark); object obj = selMgr.GetSelectedObject6(i, AnyMark); objList.Add(new ObjectSelection(obj, swSelectType_E, selMark, i)); } return(objList); }
public static void GetFace(ModelDoc2 Doc) { ModelDocExtension DocEx = Doc.Extension; SelectionMgr SwSelMrg = Doc.SelectionManager; DocEx.SelectByID2("", "FACE", -100 / 1000.0, 60 / 1000.0, 15 / 1000.0, false, -1, null, 0); System.Windows.MessageBox.Show("模拟选中面"); string selcount = SwSelMrg.GetSelectedObjectCount2(-1).ToString(); swSelectType_e seltype = (swSelectType_e)SwSelMrg.GetSelectedObjectType3(1, -1); if (seltype == swSelectType_e.swSelFACES) { Face2 SwFace = SwSelMrg.GetSelectedObject6(1, -1); System.Windows.MessageBox.Show("选中数:" + selcount + "\r\n选中类型:" + seltype.ToString() + "\r\n选中面面积:" + SwFace.GetArea().ToString()); } }
public static void GetEdge(ModelDoc2 Doc) { ModelDocExtension DocEx = Doc.Extension; SelectionMgr SwSelMrg = Doc.SelectionManager; DocEx.SelectByID2("", "EDGE", 0 / 1000.0, 30 / 1000.0, 75 / 1000.0, false, -1, null, 0); System.Windows.MessageBox.Show("模拟选中边线"); string selcount = SwSelMrg.GetSelectedObjectCount2(-1).ToString(); swSelectType_e seltype = (swSelectType_e)SwSelMrg.GetSelectedObjectType3(1, -1); if (seltype == swSelectType_e.swSelEDGES) { Edge SwEdge = SwSelMrg.GetSelectedObject6(1, -1); SwEdge.Display(1, 1, 0, 0, true);//true变色开,false关闭变色 System.Windows.MessageBox.Show("选中数:" + selcount + "\r\n选中类型:" + seltype.ToString() + "\r\n选中边已变色"); } }
private bool OnSelection(DocumentHandler docHandler, swSelectType_e selType, SelectionState_e type) { if (m_ShowSelectionEvents) { if (type != SelectionState_e.UserPreSelect)//dynamic selection { return(App.SendMsgToUser2($"'{docHandler.Model.GetTitle()}' selection ({type}) of {selType}. Cancel?", (int)swMessageBoxIcon_e.swMbQuestion, (int)swMessageBoxBtn_e.swMbYesNo) == (int)swMessageBoxResult_e.swMbHitNo); } else { return(selType != swSelectType_e.swSelFACES); } } else { return(true); } }
internal SwCommandGroup AddCommandGroupOrContextMenu(CommandGroupSpec cmdBar, bool isContextMenu, swSelectType_e contextMenuSelectType) { m_Logger.Log($"Creating command group: {cmdBar.Id}"); if (m_CommandBars.FirstOrDefault(b => b.Spec.Id == cmdBar.Id) != null) { throw new GroupIdAlreadyExistsException(cmdBar); } var title = GetMenuPath(cmdBar); var cmdGroup = CreateCommandGroup(cmdBar.Id, title, cmdBar.Tooltip, cmdBar.Commands.Select(c => c.UserId).ToArray(), isContextMenu, contextMenuSelectType); var bar = new SwCommandGroup(m_App, cmdBar, cmdGroup); m_CommandBars.Add(bar); using (var iconsConv = new IconsConverter()) { CreateIcons(cmdGroup, cmdBar, iconsConv); var createdCmds = CreateCommandItems(bar, cmdBar.Id, cmdBar.Commands); var tabGroup = GetRootCommandGroup(cmdBar); try { CreateCommandTabBox(tabGroup, createdCmds); } catch (Exception ex) { m_Logger.Log(ex); //not critical error - continue operation } } return(bar); }
private CommandGroup CreateCommandGroup(int groupId, string title, string toolTip, Enum[] cmds, bool isContextMenu, swSelectType_e contextMenuSelectType) { int cmdGroupErr = 0; bool ignorePrevious = false; object registryIDs; bool getDataResult = m_CmdMgr.GetGroupDataFromRegistry(groupId, out registryIDs); var knownIDs = new int[cmds.Length]; for (int i = 0; i < cmds.Length; i++) { knownIDs[i] = (int)cmds.GetValue(i); } if (getDataResult) { ignorePrevious = !CompareIDs(registryIDs as int[], knownIDs); } CommandGroup cmdGroup; if (isContextMenu) { cmdGroup = m_CmdMgr.AddContextMenu(groupId, title); cmdGroup.SelectType = (int)contextMenuSelectType; } else { cmdGroup = m_CmdMgr.CreateCommandGroup2(groupId, title, toolTip, toolTip, -1, ignorePrevious, ref cmdGroupErr); } return(cmdGroup); }
public static void GetSelectList(ModelDoc2 Doc) { ModelDocExtension DocEx = Doc.Extension; SelectionMgr SwSelMrg = Doc.SelectionManager; DocEx.SelectByID2("", "FACE", -100 / 1000.0, 60 / 1000.0, 15 / 1000.0, false, -1, null, 0); DocEx.SelectByID2("", "EDGE", 0 / 1000.0, 30 / 1000.0, 75 / 1000.0, true, -1, null, 0); System.Windows.MessageBox.Show("模拟选中多个元素完成"); StringBuilder Sb = new StringBuilder("选择集合信息:\r\n"); int selcount = SwSelMrg.GetSelectedObjectCount2(-1); Sb.Append("选择总数:" + selcount.ToString() + "\r\n"); Sb.Append("-----------------\r\n"); for (int i = 1; i <= selcount; i++) { Sb.Append("index参数为" + i.ToString() + "的对象\r\n"); swSelectType_e seltype = (swSelectType_e)SwSelMrg.GetSelectedObjectType3(i, -1); Sb.Append("类型:" + seltype.ToString().Trim() + "\r\n"); Sb.Append("-----------------\r\n"); } System.Windows.MessageBox.Show(Sb.ToString()); }
// This removes the component only filters so that the export tool can select sketches, sketch items etc while the PMPage is active // and items are added to the selection box. // Because the PMPage closes before selections need to occur, this method is no longer used. void setGeneralFilters() { swSelectType_e[] filters = new swSelectType_e[15]; filters[0] = swSelectType_e.swSelCOMPONENTS; filters[1] = swSelectType_e.swSelEXTSKETCHPOINTS; filters[2] = swSelectType_e.swSelEXTSKETCHSEGS; filters[3] = swSelectType_e.swSelSKETCHES; filters[4] = swSelectType_e.swSelSKETCHPOINTS; filters[5] = swSelectType_e.swSelSKETCHSEGS; filters[6] = swSelectType_e.swSelCOORDSYS; filters[7] = swSelectType_e.swSelDATUMAXES; filters[8] = swSelectType_e.swSelDATUMPOINTS; filters[9] = swSelectType_e.swSelCONNECTIONPOINTS; filters[10] = swSelectType_e.swSelFRAMEPOINT; filters[11] = swSelectType_e.swSelMIDPOINTS; filters[12] = swSelectType_e.swSelROUTEPOINTS; filters[13] = swSelectType_e.swSelSKETCHPOINTFEAT; filters[14] = swSelectType_e.swSelVERTICES; object filterObj = null; filterObj = filters; pm_Selection.SetSelectionFilters(filterObj); }
/// <summary> /// 获取选中的对象 /// </summary> private void GetSelectedObjectClick() { //if (swApp == null ) //{ //swApp = (SldWorks)Du.Core.DuSolidWorks.GetActiveswApp(); //} if (swApp != null) { ModelDoc2 swModel = swApp.ActiveDoc; if (swModel != null) { int Count = swModel.ISelectionManager.GetSelectedObjectCount(); if (Count == 0) { Xceed.Wpf.Toolkit.MessageBox.Show("当前未有选中的SolidWorks对象"); } swSelectType_e swSeleType = (swSelectType_e)swModel.ISelectionManager.GetSelectedObjectType3(1, -1); SelectedText = "SolidWorks.Interop.swconst.swSelectType_e." + swSeleType.ToString(); object swObj = swModel.ISelectionManager.GetSelectedObject6(1, -1); if (swObj != null) { switch (swSeleType) { case swSelectType_e.swSelNOTHING: break; #region 几何信息 case swSelectType_e.swSelEDGES: break; case swSelectType_e.swSelFACES: break; case swSelectType_e.swSelVERTICES: break; #endregion #region 参考几何体 case swSelectType_e.swSelDATUMPLANES: break; case swSelectType_e.swSelDATUMAXES: break; case swSelectType_e.swSelDATUMPOINTS: break; case swSelectType_e.swSelOLEITEMS: break; case swSelectType_e.swSelATTRIBUTES: break; case swSelectType_e.swSelBODYFEATURES: break; case swSelectType_e.swSelREFCURVES: break; case swSelectType_e.swSelHELIX: break; //case swSelectType_e.swSelREFERENCECURVES: // break; case swSelectType_e.swSelREFSURFACES: break; case swSelectType_e.swSelCENTERMARKS: break; case swSelectType_e.swSelINCONTEXTFEAT: break; #endregion #region 草图几何体 case swSelectType_e.swSelSKETCHES: break; case swSelectType_e.swSelSKETCHSEGS: break; case swSelectType_e.swSelSKETCHPOINTS: break; case swSelectType_e.swSelEXTSKETCHSEGS: break; case swSelectType_e.swSelEXTSKETCHPOINTS: break; case swSelectType_e.swSelBREAKLINES: break; case swSelectType_e.swSelINCONTEXTFEATS: break; case swSelectType_e.swSelSKETCHTEXT: break; #endregion #region 工程图和标注对象 case swSelectType_e.swSelDRAWINGVIEWS: break; case swSelectType_e.swSelGTOLS: break; case swSelectType_e.swSelDIMENSIONS: break; case swSelectType_e.swSelNOTES: break; case swSelectType_e.swSelSECTIONLINES: break; case swSelectType_e.swSelDETAILCIRCLES: break; case swSelectType_e.swSelSECTIONTEXT: break; case swSelectType_e.swSelSHEETS: break; case swSelectType_e.swSelSFSYMBOLS: break; case swSelectType_e.swSelDATUMTAGS: break; #endregion #region 零件和配合对象 case swSelectType_e.swSelCOMPONENTS: break; case swSelectType_e.swSelMATES: break; case swSelectType_e.swSelMATEGROUP: break; case swSelectType_e.swSelMATEGROUPS: break; #endregion #region 特征对象 case swSelectType_e.swSelCOMPPATTERN: break; #endregion case swSelectType_e.swSelWELDS: break; case swSelectType_e.swSelCTHREADS: break; case swSelectType_e.swSelDTMTARGS: break; case swSelectType_e.swSelPOINTREFS: break; case swSelectType_e.swSelDCABINETS: break; case swSelectType_e.swSelEXPLVIEWS: break; case swSelectType_e.swSelEXPLSTEPS: break; case swSelectType_e.swSelEXPLLINES: break; case swSelectType_e.swSelSILHOUETTES: break; case swSelectType_e.swSelCONFIGURATIONS: break; case swSelectType_e.swSelOBJHANDLES: break; case swSelectType_e.swSelARROWS: break; case swSelectType_e.swSelZONES: break; case swSelectType_e.swSelREFEDGES: break; case swSelectType_e.swSelREFFACES: break; case swSelectType_e.swSelREFSILHOUETTE: break; case swSelectType_e.swSelBOMS: break; case swSelectType_e.swSelEQNFOLDER: break; case swSelectType_e.swSelSKETCHHATCH: break; case swSelectType_e.swSelIMPORTFOLDER: break; case swSelectType_e.swSelVIEWERHYPERLINK: break; case swSelectType_e.swSelMIDPOINTS: break; case swSelectType_e.swSelCUSTOMSYMBOLS: break; case swSelectType_e.swSelCOORDSYS: break; case swSelectType_e.swSelDATUMLINES: break; case swSelectType_e.swSelROUTECURVES: break; case swSelectType_e.swSelBOMTEMPS: break; case swSelectType_e.swSelROUTEPOINTS: break; case swSelectType_e.swSelCONNECTIONPOINTS: break; case swSelectType_e.swSelROUTESWEEPS: break; case swSelectType_e.swSelPOSGROUP: break; case swSelectType_e.swSelBROWSERITEM: break; case swSelectType_e.swSelFABRICATEDROUTE: break; case swSelectType_e.swSelSKETCHPOINTFEAT: break; case swSelectType_e.swSelEMPTYSPACE: break; //case swSelectType_e.swSelCOMPSDONTOVERRIDE: // break; case swSelectType_e.swSelLIGHTS: break; case swSelectType_e.swSelWIREBODIES: break; case swSelectType_e.swSelSURFACEBODIES: break; case swSelectType_e.swSelSOLIDBODIES: break; case swSelectType_e.swSelFRAMEPOINT: break; case swSelectType_e.swSelSURFBODIESFIRST: break; case swSelectType_e.swSelMANIPULATORS: break; case swSelectType_e.swSelPICTUREBODIES: break; case swSelectType_e.swSelSOLIDBODIESFIRST: break; case swSelectType_e.swSelHOLESERIES: break; case swSelectType_e.swSelLEADERS: break; case swSelectType_e.swSelSKETCHBITMAP: break; case swSelectType_e.swSelDOWELSYMS: break; case swSelectType_e.swSelEXTSKETCHTEXT: break; case swSelectType_e.swSelBLOCKINST: break; case swSelectType_e.swSelFTRFOLDER: break; case swSelectType_e.swSelSKETCHREGION: break; case swSelectType_e.swSelSKETCHCONTOUR: break; case swSelectType_e.swSelBOMFEATURES: break; case swSelectType_e.swSelANNOTATIONTABLES: break; case swSelectType_e.swSelBLOCKDEF: break; case swSelectType_e.swSelCENTERMARKSYMS: break; case swSelectType_e.swSelSIMULATION: break; case swSelectType_e.swSelSIMELEMENT: break; case swSelectType_e.swSelCENTERLINES: break; case swSelectType_e.swSelHOLETABLEFEATS: break; case swSelectType_e.swSelHOLETABLEAXES: break; case swSelectType_e.swSelWELDMENT: break; case swSelectType_e.swSelSUBWELDFOLDER: break; case swSelectType_e.swSelEXCLUDEMANIPULATORS: break; case swSelectType_e.swSelREVISIONTABLE: break; case swSelectType_e.swSelSUBSKETCHINST: break; case swSelectType_e.swSelWELDMENTTABLEFEATS: break; case swSelectType_e.swSelBODYFOLDER: break; case swSelectType_e.swSelREVISIONTABLEFEAT: break; case swSelectType_e.swSelSUBATOMFOLDER: break; case swSelectType_e.swSelWELDBEADS: break; case swSelectType_e.swSelEMBEDLINKDOC: break; case swSelectType_e.swSelJOURNAL: break; case swSelectType_e.swSelDOCSFOLDER: break; case swSelectType_e.swSelCOMMENTSFOLDER: break; case swSelectType_e.swSelCOMMENT: break; case swSelectType_e.swSelSWIFTANNOTATIONS: break; case swSelectType_e.swSelSWIFTFEATURES: break; case swSelectType_e.swSelCAMERAS: break; case swSelectType_e.swSelMATESUPPLEMENT: break; case swSelectType_e.swSelANNOTATIONVIEW: break; case swSelectType_e.swSelGENERALTABLEFEAT: break; case swSelectType_e.swSelDISPLAYSTATE: break; case swSelectType_e.swSelSUBSKETCHDEF: break; case swSelectType_e.swSelSWIFTSCHEMA: break; case swSelectType_e.swSelTITLEBLOCK: break; case swSelectType_e.swSelTITLEBLOCKTABLEFEAT: break; case swSelectType_e.swSelOBJGROUP: break; case swSelectType_e.swSelPLANESECTIONS: break; case swSelectType_e.swSelCOSMETICWELDS: break; case swSelectType_e.SwSelMAGNETICLINES: break; case swSelectType_e.swSelPUNCHTABLEFEATS: break; case swSelectType_e.swSelREVISIONCLOUDS: break; case swSelectType_e.swSelBorder: break; case swSelectType_e.swSelSELECTIONSETFOLDER: break; case swSelectType_e.swSelSELECTIONSETNODE: break; case swSelectType_e.swSelEVERYTHING: break; case swSelectType_e.swSelLOCATIONS: break; case swSelectType_e.swSelUNSUPPORTED: break; default: break; } SelectedSoliWorksObj = swObj; } } else { Xceed.Wpf.Toolkit.MessageBox.Show("当前未有打开的SolidWorks文档"); } } else { Xceed.Wpf.Toolkit.MessageBox.Show("当前未有打开的SolidWorks"); } }
/// <summary> /// 获取匹配的选择框 /// </summary> /// <param name="selectionBoxes"></param> /// <param name="swSelType"><see cref="swSelectType_e"/></param> /// <returns></returns> internal static IEnumerable <SldSelectionBox> GetFitSelectionBox(this IEnumerable <SldSelectionBox> selectionBoxes, swSelectType_e swSelType) { foreach (var box in selectionBoxes) { yield return(box); } }
private CommandGroup CreateCommandGroup(int groupId, string title, string toolTip, int[] knownCmdIDs, bool isContextMenu, swSelectType_e contextMenuSelectType) { int cmdGroupErr = 0; object registryIDs; var isChanged = true; if (CmdMgr.GetGroupDataFromRegistry(groupId, out registryIDs)) { isChanged = !CompareIDs(registryIDs as int[], knownCmdIDs); } Logger.Log($"Command ids changed: {isChanged}"); CommandGroup cmdGroup; if (isContextMenu) { cmdGroup = CmdMgr.AddContextMenu(groupId, title); cmdGroup.SelectType = (int)contextMenuSelectType; } else { cmdGroup = CmdMgr.CreateCommandGroup2(groupId, title, toolTip, toolTip, -1, isChanged, ref cmdGroupErr); Logger.Log($"Command group creation result: {(swCreateCommandGroupErrors)cmdGroupErr}"); Debug.Assert(cmdGroupErr == (int)swCreateCommandGroupErrors.swCreateCommandGroup_Success); } return(cmdGroup); }
//A method that sets up the Property Manager Page private void setupPropertyManagerPage(ref string caption, ref string tip, ref long options, ref int controlType, ref int alignment) { //Begin adding the controls to the page //Create the group box caption = "Configure and Organize Links"; options = (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Visible + (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded; pm_Group = (PropertyManagerPageGroup)pm_Page.AddGroupBox(GroupID, caption, (int)options); //Create the parent link label (static) controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label; caption = "Parent Link"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge; options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled; pm_Label_ParentLinkLabel = (PropertyManagerPageLabel)pm_Group.AddControl(Label_LinkName_ID, (short)controlType, caption, (short)alignment, (int)options, ""); //Create the parent link name label, the one that is updated controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label; caption = ""; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent; options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled; pm_Label_ParentLink = (PropertyManagerPageLabel)pm_Group.AddControl(Label_LinkName_ID, (short)controlType, caption, (short)alignment, (int)options, ""); //Create the link name text box label controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label; caption = "Link Name"; tip = "Enter the name of the link"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge; options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled; pm_Label_LinkName = (PropertyManagerPageLabel)pm_Group.AddControl(Label_LinkName_ID, (short)controlType, caption, (short)alignment, (int)options, tip); //Create the link name text box controlType = (int)swPropertyManagerPageControlType_e.swControlType_Textbox; caption = "base_link"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent; tip = "Enter the name of the link"; options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled; pm_TextBox_LinkName = (PropertyManagerPageTextbox)pm_Group.AddControl(TextBox_LinkNameID, (short)(controlType), caption, (short)alignment, (int)options, tip); //Create the joint name text box label controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label; caption = "Joint Name"; tip = "Enter the name of the joint"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge; options = (int)swAddControlOptions_e.swControlOptions_Visible; pm_Label_JointName = (PropertyManagerPageLabel)pm_Group.AddControl(Label_JointName_ID, (short)controlType, caption, (short)alignment, (int)options, tip); //Create the joint name text box controlType = (int)swPropertyManagerPageControlType_e.swControlType_Textbox; caption = ""; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent; tip = "Enter the name of the joint"; options = (int)swAddControlOptions_e.swControlOptions_Visible; pm_TextBox_JointName = (PropertyManagerPageTextbox)pm_Group.AddControl(TextBox_LinkNameID, (short)(controlType), caption, (short)alignment, (int)options, tip); //Create the global origin coordinate sys label controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label; caption = "Global Origin Coordinate System"; tip = "Select the reference coordinate system for the global origin"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge; options = (int)swAddControlOptions_e.swControlOptions_Visible; pm_Label_GlobalCoordsys = (PropertyManagerPageLabel)pm_Group.AddControl(ID_Label_GlobalCoordsys, (short)controlType, caption, (short)alignment, (int)options, tip); // Create pull down menu for Coordinate systems controlType = (int)swPropertyManagerPageControlType_e.swControlType_Combobox; caption = "Global Origin Coordinate System Name"; tip = "Select the reference coordinate system for the global origin"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent; options = (int)swAddControlOptions_e.swControlOptions_Visible; pm_ComboBox_GlobalCoordsys = (PropertyManagerPageCombobox)pm_Group.AddControl(ID_GlobalCoordsys, (short)controlType, caption, (short)alignment, (int)options, tip); pm_ComboBox_GlobalCoordsys.Style = (int)swPropMgrPageComboBoxStyle_e.swPropMgrPageComboBoxStyle_EditBoxReadOnly; //Create the ref coordinate sys label controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label; caption = "Reference Coordinate System"; tip = "Select the reference coordinate system for the joint origin"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge; options = 0; pm_Label_CoordSys = (PropertyManagerPageLabel)pm_Group.AddControl(Label_CoordSys_ID, (short)controlType, caption, (short)alignment, (int)options, tip); // Create pull down menu for Coordinate systems controlType = (int)swPropertyManagerPageControlType_e.swControlType_Combobox; caption = "Reference Coordinate System Name"; tip = "Select the reference coordinate system for the joint origin"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent; options = 0; pm_ComboBox_CoordSys = (PropertyManagerPageCombobox)pm_Group.AddControl(ComboBox_CoordSys_ID, (short)controlType, caption, (short)alignment, (int)options, tip); pm_ComboBox_CoordSys.Style = (int)swPropMgrPageComboBoxStyle_e.swPropMgrPageComboBoxStyle_EditBoxReadOnly; //Create the ref axis label controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label; caption = "Reference Axis"; tip = "Select the reference axis for the joint"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge; options = (int)swAddControlOptions_e.swControlOptions_Visible; pm_Label_Axes = (PropertyManagerPageLabel)pm_Group.AddControl(Label_Axes_ID, (short)controlType, caption, (short)alignment, (int)options, tip); // Create pull down menu for axes controlType = (int)swPropertyManagerPageControlType_e.swControlType_Combobox; caption = "Reference Axis Name"; tip = "Select the reference axis for the joint"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent; options = (int)swAddControlOptions_e.swControlOptions_Visible; pm_ComboBox_Axes = (PropertyManagerPageCombobox)pm_Group.AddControl(ComboBox_CoordSys_ID, (short)controlType, caption, (short)alignment, (int)options, tip); pm_ComboBox_Axes.Style = (int)swPropMgrPageComboBoxStyle_e.swPropMgrPageComboBoxStyle_EditBoxReadOnly; //Create the joint type label controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label; caption = "Joint Type"; tip = "Select the joint type"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge; options = (int)swAddControlOptions_e.swControlOptions_Visible; pm_Label_JointType = (PropertyManagerPageLabel)pm_Group.AddControl(Label_Axes_ID, (short)controlType, caption, (short)alignment, (int)options, tip); // Create pull down menu for joint type controlType = (int)swPropertyManagerPageControlType_e.swControlType_Combobox; caption = "Joint type"; tip = "Select the joint type"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent; options = (int)swAddControlOptions_e.swControlOptions_Visible; pm_ComboBox_JointType = (PropertyManagerPageCombobox)pm_Group.AddControl(ComboBox_CoordSys_ID, (short)controlType, caption, (short)alignment, (int)options, tip); pm_ComboBox_JointType.Style = (int)swPropMgrPageComboBoxStyle_e.swPropMgrPageComboBoxStyle_EditBoxReadOnly; pm_ComboBox_JointType.AddItems(new string[] { "Automatically Detect", "continuous", "revolute", "prismatic", "fixed" }); //Create the selection box label controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label; caption = "Link Components"; tip = "Select components associated with this link"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge; options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled; pm_Label_Selection = (PropertyManagerPageLabel)pm_Group.AddControl(Label_LinkName_ID, (short)controlType, caption, (short)alignment, (int)options, tip); //Create selection box controlType = (int)swPropertyManagerPageControlType_e.swControlType_Selectionbox; caption = "Link Components"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent; options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled; tip = "Select components associated with this link"; pm_Selection = (PropertyManagerPageSelectionbox)pm_Group.AddControl(SelectionID, (short)controlType, caption, (short)alignment, (int)options, tip); swSelectType_e[] filters = new swSelectType_e[1]; filters[0] = swSelectType_e.swSelCOMPONENTS; object filterObj = null; filterObj = filters; pm_Selection.AllowSelectInMultipleBoxes = true; pm_Selection.SingleEntityOnly = false; pm_Selection.AllowMultipleSelectOfSameEntity = false; pm_Selection.Height = 50; pm_Selection.SetSelectionFilters(filterObj); //Create the number box label //Create the link name text box label controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label; caption = "Number of child links"; tip = "Enter the number of child links and they will be automatically added"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge; options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled; pm_Label_ChildCount = (PropertyManagerPageLabel)pm_Group.AddControl(Label_LinkName_ID, (short)controlType, caption, (short)alignment, (int)options, tip); //Create the number box controlType = (int)swPropertyManagerPageControlType_e.swControlType_Numberbox; caption = ""; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent; tip = "Enter the number of child links and they will be automatically added"; options = (int)swAddControlOptions_e.swControlOptions_Enabled + (int)swAddControlOptions_e.swControlOptions_Visible; pm_NumberBox_ChildCount = pm_Group.AddControl(NumBox_ChildCount_ID, (short)controlType, caption, (short)alignment, (int)options, tip); pm_NumberBox_ChildCount.SetRange2((int)swNumberboxUnitType_e.swNumberBox_UnitlessInteger, 0, int.MaxValue, true, 1, 1, 1); pm_NumberBox_ChildCount.Value = 0; //pm_Button_save = pm_Group.AddControl(Button_save_ID, (short)swPropertyManagerPageControlType_e.swControlType_Button, "Build Link", 0, (int)options, ""); pm_Button_export = pm_Group.AddControl(Button_export_ID, (short)swPropertyManagerPageControlType_e.swControlType_Button, "Preview and Export...", 0, (int)options, ""); controlType = (int)swPropertyManagerPageControlType_e.swControlType_WindowFromHandle; caption = "Link Tree"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge; options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled; pm_tree = pm_Page.AddControl(dotNet_tree, (short)swPropertyManagerPageControlType_e.swControlType_WindowFromHandle, caption, 0, (int)options, ""); pm_tree.Height = 163; tree = new TreeView(); tree.Height = 163; tree.Visible = true; tree.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(tree_AfterSelect); tree.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(tree_NodeMouseClick); tree.KeyDown += new System.Windows.Forms.KeyEventHandler(tree_KeyDown); tree.DragDrop += new DragEventHandler(tree_DragDrop); tree.DragOver += new DragEventHandler(tree_DragOver); tree.DragEnter += new DragEventHandler(tree_DragEnter); tree.ItemDrag += new ItemDragEventHandler(tree_ItemDrag); tree.AllowDrop = true; pm_tree.SetWindowHandlex64(tree.Handle.ToInt64()); ToolStripMenuItem addChild = new ToolStripMenuItem(); ToolStripMenuItem removeChild = new ToolStripMenuItem(); //ToolStripMenuItem renameChild = new ToolStripMenuItem(); addChild.Text = "Add Child Link"; addChild.Click += new System.EventHandler(this.addChild_Click); removeChild.Text = "Remove"; removeChild.Click += new System.EventHandler(this.removeChild_Click); //renameChild.Text = "Rename"; //renameChild.Click += new System.EventHandler(this.renameChild_Click); //docMenu.Items.AddRange(new ToolStripMenuItem[] { addChild, removeChild, renameChild }); docMenu.Items.AddRange(new ToolStripMenuItem[] { addChild, removeChild }); LinkNode node = createEmptyNode(null); node.ContextMenuStrip = docMenu; tree.Nodes.Add(node); tree.SelectedNode = tree.Nodes[0]; pm_Selection.SetSelectionFocus(); pm_Page.SetFocus(dotNet_tree); //updateNodeNames(tree); }
public CommandGroup AddContextMenu(ICommandGroupSpec cmdBar, swSelectType_e contextMenuSelectType = swSelectType_e.swSelEVERYTHING) { return(AddCommandGroupOrContextMenu( cmdBar, true, contextMenuSelectType)); }
//A method that sets up the Property Manager Page private void setupPropertyManagerPage(ref string caption, ref string tip, ref long options, ref int controlType, ref int alignment) { //Begin adding the controls to the page //Create the group box caption = "Configure and Organize Links"; options = (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Visible + (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded; pm_Group = (PropertyManagerPageGroup)pm_Page.AddGroupBox(GroupID, caption, (int)options); //Create the parent link label (static) controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label; caption = "Parent Link"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge; options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled; pm_Label_ParentLinkLabel = (PropertyManagerPageLabel)pm_Group.AddControl(Label_LinkName_ID, (short)controlType, caption, (short)alignment, (int)options, ""); //Create the parent link name label, the one that is updated controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label; caption = ""; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent; options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled; pm_Label_ParentLink = (PropertyManagerPageLabel)pm_Group.AddControl(Label_LinkName_ID, (short)controlType, caption, (short)alignment, (int)options, ""); //Create the link name text box label controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label; caption = "Link Name"; tip = "Enter the name of the link"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge; options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled; pm_Label_LinkName = (PropertyManagerPageLabel)pm_Group.AddControl(Label_LinkName_ID, (short)controlType, caption, (short)alignment, (int)options, tip); //Create the link name text box controlType = (int)swPropertyManagerPageControlType_e.swControlType_Textbox; caption = "base_link"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent; tip = "Enter the name of the link"; options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled; pm_TextBox_LinkName = (PropertyManagerPageTextbox)pm_Group.AddControl(TextBox_LinkNameID, (short)(controlType), caption, (short)alignment, (int)options, tip); //Create the joint name text box label controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label; caption = "Joint Name"; tip = "Enter the name of the joint"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge; options = (int)swAddControlOptions_e.swControlOptions_Visible; pm_Label_JointName = (PropertyManagerPageLabel)pm_Group.AddControl(Label_JointName_ID, (short)controlType, caption, (short)alignment, (int)options, tip); //Create the joint name text box controlType = (int)swPropertyManagerPageControlType_e.swControlType_Textbox; caption = ""; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent; tip = "Enter the name of the joint"; options = (int)swAddControlOptions_e.swControlOptions_Visible; pm_TextBox_JointName = (PropertyManagerPageTextbox)pm_Group.AddControl(TextBox_LinkNameID, (short)(controlType), caption, (short)alignment, (int)options, tip); //Create the global origin coordinate sys label controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label; caption = "Global Origin Coordinate System"; tip = "Select the reference coordinate system for the global origin"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge; options = (int)swAddControlOptions_e.swControlOptions_Visible; pm_Label_GlobalCoordsys = (PropertyManagerPageLabel)pm_Group.AddControl(ID_Label_GlobalCoordsys, (short)controlType, caption, (short)alignment, (int)options, tip); // Create pull down menu for Coordinate systems controlType = (int)swPropertyManagerPageControlType_e.swControlType_Combobox; caption = "Global Origin Coordinate System Name"; tip = "Select the reference coordinate system for the global origin"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent; options = (int)swAddControlOptions_e.swControlOptions_Visible; pm_ComboBox_GlobalCoordsys = (PropertyManagerPageCombobox)pm_Group.AddControl(ID_GlobalCoordsys, (short)controlType, caption, (short)alignment, (int)options, tip); pm_ComboBox_GlobalCoordsys.Style = (int)swPropMgrPageComboBoxStyle_e.swPropMgrPageComboBoxStyle_EditBoxReadOnly; //Create the ref coordinate sys label controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label; caption = "Reference Coordinate System"; tip = "Select the reference coordinate system for the joint origin"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge; options = 0; pm_Label_CoordSys = (PropertyManagerPageLabel)pm_Group.AddControl(Label_CoordSys_ID, (short)controlType, caption, (short)alignment, (int)options, tip); // Create pull down menu for Coordinate systems controlType = (int)swPropertyManagerPageControlType_e.swControlType_Combobox; caption = "Reference Coordinate System Name"; tip = "Select the reference coordinate system for the joint origin"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent; options = 0; pm_ComboBox_CoordSys = (PropertyManagerPageCombobox)pm_Group.AddControl(ComboBox_CoordSys_ID, (short)controlType, caption, (short)alignment, (int)options, tip); pm_ComboBox_CoordSys.Style = (int)swPropMgrPageComboBoxStyle_e.swPropMgrPageComboBoxStyle_EditBoxReadOnly; //Create the ref axis label controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label; caption = "Reference Axis"; tip = "Select the reference axis for the joint"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge; options = (int)swAddControlOptions_e.swControlOptions_Visible; pm_Label_Axes = (PropertyManagerPageLabel)pm_Group.AddControl(Label_Axes_ID, (short)controlType, caption, (short)alignment, (int)options, tip); // Create pull down menu for axes controlType = (int)swPropertyManagerPageControlType_e.swControlType_Combobox; caption = "Reference Axis Name"; tip = "Select the reference axis for the joint"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent; options = (int)swAddControlOptions_e.swControlOptions_Visible; pm_ComboBox_Axes = (PropertyManagerPageCombobox)pm_Group.AddControl(ComboBox_CoordSys_ID, (short)controlType, caption, (short)alignment, (int)options, tip); pm_ComboBox_Axes.Style = (int)swPropMgrPageComboBoxStyle_e.swPropMgrPageComboBoxStyle_EditBoxReadOnly; //Create the joint type label controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label; caption = "Joint Type"; tip = "Select the joint type"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge; options = (int)swAddControlOptions_e.swControlOptions_Visible; pm_Label_JointType = (PropertyManagerPageLabel)pm_Group.AddControl(Label_Axes_ID, (short)controlType, caption, (short)alignment, (int)options, tip); // Create pull down menu for joint type controlType = (int)swPropertyManagerPageControlType_e.swControlType_Combobox; caption = "Joint type"; tip = "Select the joint type"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent; options = (int)swAddControlOptions_e.swControlOptions_Visible; pm_ComboBox_JointType = (PropertyManagerPageCombobox)pm_Group.AddControl(ComboBox_CoordSys_ID, (short)controlType, caption, (short)alignment, (int)options, tip); pm_ComboBox_JointType.Style = (int)swPropMgrPageComboBoxStyle_e.swPropMgrPageComboBoxStyle_EditBoxReadOnly; pm_ComboBox_JointType.AddItems(new string[] { "Automatically Detect", "continuous", "revolute", "prismatic", "fixed" }); //Create the selection box label controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label; caption = "Link Components"; tip = "Select components associated with this link"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge; options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled; pm_Label_Selection = (PropertyManagerPageLabel)pm_Group.AddControl(Label_LinkName_ID, (short)controlType, caption, (short)alignment, (int)options, tip); //Create selection box controlType = (int)swPropertyManagerPageControlType_e.swControlType_Selectionbox; caption = "Link Components"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent; options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled; tip = "Select components associated with this link"; pm_Selection = (PropertyManagerPageSelectionbox)pm_Group.AddControl(SelectionID, (short)controlType, caption, (short)alignment, (int)options, tip); swSelectType_e[] filters = new swSelectType_e[1]; filters[0] = swSelectType_e.swSelCOMPONENTS; object filterObj = null; filterObj = filters; pm_Selection.AllowSelectInMultipleBoxes = true; pm_Selection.SingleEntityOnly = false; pm_Selection.AllowMultipleSelectOfSameEntity = false; pm_Selection.Height = 50; pm_Selection.SetSelectionFilters(filterObj); //Create the number box label //Create the link name text box label controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label; caption = "Number of child links"; tip = "Enter the number of child links and they will be automatically added"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge; options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled; pm_Label_ChildCount = (PropertyManagerPageLabel)pm_Group.AddControl(Label_LinkName_ID, (short)controlType, caption, (short)alignment, (int)options, tip); //Create the number box controlType = (int)swPropertyManagerPageControlType_e.swControlType_Numberbox; caption = ""; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent; tip = "Enter the number of child links and they will be automatically added"; options = (int)swAddControlOptions_e.swControlOptions_Enabled + (int)swAddControlOptions_e.swControlOptions_Visible; pm_NumberBox_ChildCount = pm_Group.AddControl(NumBox_ChildCount_ID, (short)controlType, caption, (short)alignment, (int)options, tip); pm_NumberBox_ChildCount.SetRange2((int)swNumberboxUnitType_e.swNumberBox_UnitlessInteger, 0, int.MaxValue, true, 1, 1, 1); pm_NumberBox_ChildCount.Value = 0; //pm_Button_save = pm_Group.AddControl(Button_save_ID, (short)swPropertyManagerPageControlType_e.swControlType_Button, "Build Link", 0, (int)options, ""); pm_Button_export = pm_Group.AddControl(Button_export_ID, (short)swPropertyManagerPageControlType_e.swControlType_Button, "Preview and Export...", 0, (int)options, ""); controlType = (int)swPropertyManagerPageControlType_e.swControlType_WindowFromHandle; caption = "Link Tree"; alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge; options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled; pm_tree = pm_Page.AddControl(dotNet_tree, (short)swPropertyManagerPageControlType_e.swControlType_WindowFromHandle, caption, 0, (int)options, ""); pm_tree.Height = 163; tree = new TreeView(); tree.Height = 163; tree.Visible = true; tree.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(tree_AfterSelect); tree.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(tree_NodeMouseClick); tree.KeyDown += new System.Windows.Forms.KeyEventHandler(tree_KeyDown); tree.DragDrop += new DragEventHandler(tree_DragDrop); tree.DragOver += new DragEventHandler(tree_DragOver); tree.DragEnter += new DragEventHandler(tree_DragEnter); tree.ItemDrag += new ItemDragEventHandler(tree_ItemDrag); tree.AllowDrop = true; pm_tree.SetWindowHandlex64(tree.Handle.ToInt64()); ToolStripMenuItem addChild = new ToolStripMenuItem(); ToolStripMenuItem removeChild = new ToolStripMenuItem(); //ToolStripMenuItem renameChild = new ToolStripMenuItem(); addChild.Text = "Add Child Link"; addChild.Click += new System.EventHandler(this.addChild_Click); removeChild.Text = "Remove"; removeChild.Click += new System.EventHandler(this.removeChild_Click); //renameChild.Text = "Rename"; //renameChild.Click += new System.EventHandler(this.renameChild_Click); //docMenu.Items.AddRange(new ToolStripMenuItem[] { addChild, removeChild, renameChild }); docMenu.Items.AddRange(new ToolStripMenuItem[] { addChild, removeChild}); LinkNode node = createEmptyNode(null); node.ContextMenuStrip = docMenu; tree.Nodes.Add(node); tree.SelectedNode = tree.Nodes[0]; pm_Selection.SetSelectionFocus(); pm_Page.SetFocus(dotNet_tree); //updateNodeNames(tree); }
protected override bool Filter(IPropertyManagerPageControlEx selBox, IFace2 selection, swSelectType_e selType, ref string itemText) { itemText = "Planar Face"; return(selection.IGetSurface().IsPlane()); //validating the selection and only allowing planar face }
///<inheritdoc cref="Filter(TSelection)"/> /> /// <param name="selBox">Pointer to the selection box control</param> /// <param name="selType">Type of the selecting object as defined in <see href="http://help.solidworks.com/2014/english/api/swconst/solidworks.interop.swconst~solidworks.interop.swconst.swselecttype_e.html">swSelectType_e Enumeration</see></param> /// <param name="itemText">Text to be displayed in the selection box</param> protected virtual bool Filter(IPropertyManagerPageControlEx selBox, TSelection selection, swSelectType_e selType, ref string itemText) { return(Filter(selection)); }
/// <summary> /// Fonction interne, renvoi la liste des objets sélectionnés. /// </summary> /// <param name="TypeObjet"></param> /// <param name="Marque"></param> /// <returns></returns> public ArrayList ListeDesObjetsSelectionnes(swSelectType_e TypeObjet, int Marque = -1) { Log.Methode(cNOMCLASSE); ArrayList pListeObjets = new ArrayList(); if (NbObjetsSelectionnes() > 0) { for (int i = 1; i <= _SwGestDeSelection.GetSelectedObjectCount2(Marque); i++) { if (this.TypeObjet(i, Marque) == TypeObjet) { dynamic pObjet = Objet(i, Marque); if (pObjet != null) pListeObjets.Add(pObjet); } } } return pListeObjets; }
private CommandGroup AddCommandGroupOrContextMenu <TCmdEnum>(Action <TCmdEnum> callback, EnableMethodDelegate <TCmdEnum> enable, bool isContextMenu, swSelectType_e contextMenuSelectType) where TCmdEnum : IComparable, IFormattable, IConvertible { if (!(typeof(TCmdEnum).IsEnum)) { throw new ArgumentException($"{typeof(TCmdEnum)} must be an Enum"); } if (callback == null) { throw new CallbackNotSpecifiedException(); } var cmdGroupType = typeof(TCmdEnum); int groupId; string title; string toolTip; GetCommandGroupAttribution(cmdGroupType, out groupId, out title, out toolTip); var cmds = Enum.GetValues(cmdGroupType).Cast <Enum>().ToArray(); var cmdGroup = CreateCommandGroup(groupId, title, toolTip, cmds, isContextMenu, contextMenuSelectType); using (var iconsConv = new IconsConverter()) { CreateIcons(cmdGroup, cmdGroupType, cmds, iconsConv); CreateCommandItems(cmdGroup, groupId, cmds, callback, enable); cmdGroup.HasToolbar = true; cmdGroup.HasMenu = true; cmdGroup.Activate(); } return(cmdGroup); }
protected virtual bool OnSubmitSelection(int id, object selection, swSelectType_e selType, ref string itemText) { return(true); }
/// <summary> /// Méthode interne. /// Initialiser l'objet eObjet. /// </summary> /// <param name="Modele"></param> /// <param name="SwObjet"></param> /// <param name="TypeDeObjet"></param> /// <returns></returns> internal Boolean Init(eModele Modele, dynamic SwObjet, swSelectType_e TypeDeObjet) { Log.Methode(cNOMCLASSE); if ((SwObjet != null) && (Modele != null) && Modele.EstInitialise) { _Modele = Modele; _TypeObjet = TypeDeObjet; _SwObjet = SwObjet; _EstInitialise = true; } else { Log.Message("!!!!! Erreur d'initialisation"); } return _EstInitialise; }
protected override bool Filter(IPropertyManagerPageControlEx selBox, IEntity selection, swSelectType_e selType, ref string itemText) { if (selType == swSelectType_e.swSelFACES) { if (selType == swSelectType_e.swSelFACES) { var face = selection as IFace2; if (!face.IGetSurface().IsPlane()) { return(false); } } } return(true); }
/// <summary> /// 通过类型获取类型名 <see cref="swSelectType_e.swSelEDGES"/> => "EDGE" /// </summary> /// <remarks> /// 并未实现完全 /// </remarks> /// <param name="swSelectType"></param> /// <returns></returns> public string GetSelectedTypeName(swSelectType_e swSelectType) { string value = string.Empty; switch (swSelectType) { case swSelectType_e.swSelNOTHING: break; case swSelectType_e.swSelEDGES: value = swSelEDGES; break; case swSelectType_e.swSelFACES: value = swSelFACES; break; case swSelectType_e.swSelVERTICES: value = swSelVERTICES; break; case swSelectType_e.swSelDATUMPLANES: value = swSelDATUMPLANES; break; case swSelectType_e.swSelDATUMAXES: value = swSelDATUMAXES; break; case swSelectType_e.swSelDATUMPOINTS: value = swSelDATUMPOINTS; break; case swSelectType_e.swSelOLEITEMS: value = swSelOLEITEMS; break; case swSelectType_e.swSelATTRIBUTES: value = swSelATTRIBUTES; break; case swSelectType_e.swSelSKETCHES: value = swSelSKETCHES; break; case swSelectType_e.swSelSKETCHSEGS: value = swSelSKETCHSEGS; break; case swSelectType_e.swSelSKETCHPOINTS: value = swSelSKETCHPOINTS; break; case swSelectType_e.swSelDRAWINGVIEWS: value = swSelDRAWINGVIEWS; break; case swSelectType_e.swSelGTOLS: value = swSelGTOLS; break; case swSelectType_e.swSelDIMENSIONS: value = swSelDIMENSIONS; break; case swSelectType_e.swSelNOTES: value = swSelNOTES; break; case swSelectType_e.swSelSECTIONLINES: value = swSelSECTIONLINES; break; case swSelectType_e.swSelDETAILCIRCLES: value = swSelDETAILCIRCLES; break; case swSelectType_e.swSelSECTIONTEXT: value = swSelSECTIONTEXT; break; case swSelectType_e.swSelSHEETS: value = swSelSHEETS; break; case swSelectType_e.swSelCOMPONENTS: value = swSelCOMPONENTS; break; case swSelectType_e.swSelMATES: value = swSelMATES; break; case swSelectType_e.swSelBODYFEATURES: value = swSelBODYFEATURES; break; case swSelectType_e.swSelREFCURVES: value = swSelREFCURVES; break; case swSelectType_e.swSelEXTSKETCHSEGS: value = swSelEXTSKETCHSEGS; break; case swSelectType_e.swSelEXTSKETCHPOINTS: value = swSelEXTSKETCHPOINTS; break; case swSelectType_e.swSelHELIX: value = swSelHELIX; break; //case swSelectType_e.swSelREFERENCECURVES: // break; case swSelectType_e.swSelREFSURFACES: value = swSelREFSURFACES; break; case swSelectType_e.swSelCENTERMARKS: value = swSelCENTERMARKS; break; case swSelectType_e.swSelINCONTEXTFEAT: value = swSelINCONTEXTFEAT; break; case swSelectType_e.swSelMATEGROUP: value = swSelMATEGROUP; break; case swSelectType_e.swSelBREAKLINES: value = swSelBREAKLINES; break; case swSelectType_e.swSelINCONTEXTFEATS: value = swSelINCONTEXTFEATS; break; case swSelectType_e.swSelMATEGROUPS: value = swSelMATEGROUPS; break; case swSelectType_e.swSelSKETCHTEXT: value = swSelSKETCHTEXT; break; case swSelectType_e.swSelSFSYMBOLS: value = swSelSFSYMBOLS; break; case swSelectType_e.swSelDATUMTAGS: value = swSelDATUMTAGS; break; case swSelectType_e.swSelCOMPPATTERN: value = swSelCOMPPATTERN; break; case swSelectType_e.swSelWELDS: value = swSelWELDS; break; case swSelectType_e.swSelCTHREADS: value = swSelCTHREADS; break; case swSelectType_e.swSelDTMTARGS: value = swSelDTMTARGS; break; case swSelectType_e.swSelPOINTREFS: value = swSelPOINTREFS; break; case swSelectType_e.swSelDCABINETS: value = swSelDCABINETS; break; //case swSelectType_e.swSelEXPLVIEWS: // value = swSelEXPLVIEWS; // break; case swSelectType_e.swSelEXPLSTEPS: value = swSelEXPLSTEPS; break; case swSelectType_e.swSelEXPLLINES: //value = swSelEXPLLINES; break; case swSelectType_e.swSelSILHOUETTES: break; case swSelectType_e.swSelCONFIGURATIONS: break; case swSelectType_e.swSelOBJHANDLES: break; case swSelectType_e.swSelARROWS: break; case swSelectType_e.swSelZONES: break; case swSelectType_e.swSelREFEDGES: break; case swSelectType_e.swSelREFFACES: break; case swSelectType_e.swSelREFSILHOUETTE: break; case swSelectType_e.swSelBOMS: break; case swSelectType_e.swSelEQNFOLDER: break; case swSelectType_e.swSelSKETCHHATCH: break; case swSelectType_e.swSelIMPORTFOLDER: break; case swSelectType_e.swSelVIEWERHYPERLINK: break; case swSelectType_e.swSelMIDPOINTS: break; case swSelectType_e.swSelCUSTOMSYMBOLS: break; case swSelectType_e.swSelCOORDSYS: break; case swSelectType_e.swSelDATUMLINES: break; case swSelectType_e.swSelROUTECURVES: break; case swSelectType_e.swSelBOMTEMPS: break; case swSelectType_e.swSelROUTEPOINTS: break; case swSelectType_e.swSelCONNECTIONPOINTS: break; case swSelectType_e.swSelROUTESWEEPS: break; case swSelectType_e.swSelPOSGROUP: break; case swSelectType_e.swSelBROWSERITEM: break; case swSelectType_e.swSelFABRICATEDROUTE: break; case swSelectType_e.swSelSKETCHPOINTFEAT: break; case swSelectType_e.swSelEMPTYSPACE: break; //case swSelectType_e.swSelCOMPSDONTOVERRIDE: // break; case swSelectType_e.swSelLIGHTS: break; case swSelectType_e.swSelWIREBODIES: break; case swSelectType_e.swSelSURFACEBODIES: break; case swSelectType_e.swSelSOLIDBODIES: break; case swSelectType_e.swSelFRAMEPOINT: break; case swSelectType_e.swSelSURFBODIESFIRST: break; case swSelectType_e.swSelMANIPULATORS: break; case swSelectType_e.swSelPICTUREBODIES: break; case swSelectType_e.swSelSOLIDBODIESFIRST: break; //case swSelectType_e.swSelHOLESERIES: // break; case swSelectType_e.swSelLEADERS: break; case swSelectType_e.swSelSKETCHBITMAP: break; case swSelectType_e.swSelDOWELSYMS: break; case swSelectType_e.swSelEXTSKETCHTEXT: break; case swSelectType_e.swSelBLOCKINST: break; case swSelectType_e.swSelFTRFOLDER: break; case swSelectType_e.swSelSKETCHREGION: break; case swSelectType_e.swSelSKETCHCONTOUR: break; case swSelectType_e.swSelBOMFEATURES: break; case swSelectType_e.swSelANNOTATIONTABLES: break; case swSelectType_e.swSelBLOCKDEF: break; case swSelectType_e.swSelCENTERMARKSYMS: break; case swSelectType_e.swSelSIMULATION: break; case swSelectType_e.swSelSIMELEMENT: break; case swSelectType_e.swSelCENTERLINES: break; case swSelectType_e.swSelHOLETABLEFEATS: break; case swSelectType_e.swSelHOLETABLEAXES: break; case swSelectType_e.swSelWELDMENT: break; case swSelectType_e.swSelSUBWELDFOLDER: break; case swSelectType_e.swSelEXCLUDEMANIPULATORS: break; case swSelectType_e.swSelREVISIONTABLE: break; case swSelectType_e.swSelSUBSKETCHINST: break; case swSelectType_e.swSelWELDMENTTABLEFEATS: break; case swSelectType_e.swSelBODYFOLDER: break; case swSelectType_e.swSelREVISIONTABLEFEAT: break; case swSelectType_e.swSelSUBATOMFOLDER: break; case swSelectType_e.swSelWELDBEADS: break; case swSelectType_e.swSelEMBEDLINKDOC: break; case swSelectType_e.swSelJOURNAL: break; case swSelectType_e.swSelDOCSFOLDER: break; case swSelectType_e.swSelCOMMENTSFOLDER: break; case swSelectType_e.swSelCOMMENT: break; case swSelectType_e.swSelSWIFTANNOTATIONS: break; case swSelectType_e.swSelSWIFTFEATURES: break; case swSelectType_e.swSelCAMERAS: break; case swSelectType_e.swSelMATESUPPLEMENT: break; case swSelectType_e.swSelANNOTATIONVIEW: break; case swSelectType_e.swSelGENERALTABLEFEAT: break; case swSelectType_e.swSelDISPLAYSTATE: break; case swSelectType_e.swSelSUBSKETCHDEF: break; case swSelectType_e.swSelSWIFTSCHEMA: break; case swSelectType_e.swSelTITLEBLOCK: break; case swSelectType_e.swSelTITLEBLOCKTABLEFEAT: break; case swSelectType_e.swSelOBJGROUP: break; case swSelectType_e.swSelPLANESECTIONS: break; case swSelectType_e.swSelCOSMETICWELDS: break; case swSelectType_e.SwSelMAGNETICLINES: break; //case swSelectType_e.swSelPUNCHTABLEFEATS: // break; case swSelectType_e.swSelREVISIONCLOUDS: break; case swSelectType_e.swSelBorder: break; //case swSelectType_e.swSelSELECTIONSETFOLDER: // break; //case swSelectType_e.swSelSELECTIONSETNODE: // break; case swSelectType_e.swSelEVERYTHING: break; case swSelectType_e.swSelLOCATIONS: break; case swSelectType_e.swSelUNSUPPORTED: break; default: throw new InvalidOperationException($"not support type :{swSelectType.ToString()}"); } return(value); }