{"id":542,"date":"2021-10-05T10:18:00","date_gmt":"2021-10-05T02:18:00","guid":{"rendered":"http:\/\/localhost:8080\/?p=542"},"modified":"2021-10-05T10:18:00","modified_gmt":"2021-10-05T02:18:00","slug":"solidworks-%e4%ba%8c%e6%ac%a1%e5%bc%80%e5%8f%91-selectionmanager%e7%9a%84%e5%ad%a6%e4%b9%a0%e4%bb%a5%e5%8f%8a%e5%a6%99%e7%94%a8","status":"publish","type":"post","link":"https:\/\/blog.ke-zhi.com\/?p=542","title":{"rendered":"SolidWorks \u4e8c\u6b21\u5f00\u53d1&#8212;SelectionManager\u7684\u5b66\u4e60\u4ee5\u53ca\u5999\u7528"},"content":{"rendered":"<h1> <a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/17369396.html\" target=\"_blank\" rel=\"nofollow noopener\"> <span>SolidWorks \u4e8c\u6b21\u5f00\u53d1&#8212;SelectionManager\u7684\u5b66\u4e60\u4ee5\u53ca\u5999\u7528<\/span> <\/a> <\/h1>\n<\/p>\n<h3>SelectionManager\u7684\u5999\u7528<\/h3>\n<ul>\n<li><a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/17369396.html#SelectionManager_6\" target=\"_blank\" rel=\"nofollow noopener\">SelectionManager\u7684\u4ecb\u7ecd<\/a><\/li>\n<li><a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/17369396.html#_20\" target=\"_blank\" rel=\"nofollow noopener\">\u5c5e\u6027\u548c\u65b9\u6cd5:<\/a><\/li>\n<li><a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/17369396.html#_25\" target=\"_blank\" rel=\"nofollow noopener\">\u5e38\u7528\u5c5e\u6027\u548c\u65b9\u6cd5:<\/a><\/li>\n<li>\n<ul>\n<li><a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/17369396.html#EnableContourSelectionhttphelpsolidworkscom2018englishapisldworksapiSolidWorksInteropsldworksSolidWorksInteropsldworksISelectionMgrEnableContourSelectionhtml_26\" target=\"_blank\" rel=\"nofollow noopener\">EnableContourSelection<\/a><\/li>\n<li><a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/17369396.html#EnableSelectionhttphelpsolidworkscom2018englishapisldworksapiSolidWorksInteropsldworksSolidWorksInteropsldworksISelectionMgrEnableSelectionhtml_29\" target=\"_blank\" rel=\"nofollow noopener\">EnableSelection<\/a><\/li>\n<li><a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/17369396.html#SelectionColorhttphelpsolidworkscom2018englishapisldworksapiSolidWorksInteropsldworksSolidWorksInteropsldworksISelectionMgrSelectionColorhtml_33\" target=\"_blank\" rel=\"nofollow noopener\">SelectionColor<\/a><\/li>\n<li><a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/17369396.html#GetSelectedObject6httphelpsolidworkscom2018englishapisldworksapisolidworksinteropsldworkssolidworksinteropsldworksiselectionmgrgetselectedobject6htmlint_Index_int_Mark_38\" target=\"_blank\" rel=\"nofollow noopener\">GetSelectedObject6\uff08int Index, int Mark)<\/a><\/li>\n<li><a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/17369396.html#GetSelectedObjectCount2httphelpsolidworkscom2018englishapisldworksapiSolidWorksInteropsldworksSolidWorksInteropsldworksISelectionMgrGetSelectedObjectCount2html_46\" target=\"_blank\" rel=\"nofollow noopener\">GetSelectedObjectCount2<\/a><\/li>\n<li><a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/17369396.html#GetSelectedObjectsComponent4httphelpsolidworkscom2018englishapisldworksapiSolidWorksInteropsldworksSolidWorksInteropsldworksISelectionMgrGetSelectedObjectsComponent4html_50\" target=\"_blank\" rel=\"nofollow noopener\">GetSelectedObjectsComponent4<\/a><\/li>\n<li><a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/17369396.html#GetSelectedObjectType3httphelpsolidworkscom2018englishapisldworksapiSolidWorksInteropsldworksSolidWorksInteropsldworksISelectionMgrGetSelectedObjectType3html_54\" target=\"_blank\" rel=\"nofollow noopener\">GetSelectedObjectType3<\/a><\/li>\n<li><a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/17369396.html#GetSelectionPoint2httphelpsolidworkscom2018englishapisldworksapiSolidWorksInteropsldworksSolidWorksInteropsldworksISelectionMgrGetSelectionPoint2html_57\" target=\"_blank\" rel=\"nofollow noopener\">GetSelectionPoint2<\/a><\/li>\n<li><a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/17369396.html#GetSelectionPointInSketchSpace2httphelpsolidworkscom2018englishapisldworksapiSolidWorksInteropsldworksSolidWorksInteropsldworksISelectionMgrGetSelectionPointInSketchSpace2html_62\" target=\"_blank\" rel=\"nofollow noopener\">GetSelectionPointInSketchSpace2<\/a><\/li>\n<li><a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/17369396.html#IsInEditTarget2httphelpsolidworkscom2018englishapisldworksapiSolidWorksInteropsldworksSolidWorksInteropsldworksISelectionMgrIsInEditTarget2html_66\" target=\"_blank\" rel=\"nofollow noopener\">IsInEditTarget2<\/a><\/li>\n<li><a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/17369396.html#SetSelectedObjectMarkhttphelpsolidworkscom2018englishapisldworksapiSolidWorksInteropsldworksSolidWorksInteropsldworksISelectionMgrSetSelectedObjectMarkhtml_70\" target=\"_blank\" rel=\"nofollow noopener\">SetSelectedObjectMark<\/a><\/li>\n<li><a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/17369396.html#SetSelectionPoint2httphelpsolidworkscom2018englishapisldworksapiSolidWorksInteropsldworksSolidWorksInteropsldworksISelectionMgrSetSelectionPoint2html_74\" target=\"_blank\" rel=\"nofollow noopener\">SetSelectionPoint2<\/a><\/li>\n<li><a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/17369396.html#SuspendSelectionListhttphelpsolidworkscom2018englishapisldworksapiSolidWorksInteropsldworksSolidWorksInteropsldworksISelectionMgrSuspendSelectionListhtml______ResumeSelectionListhttphelpsolidworkscom2018englishapisldworksapiSolidWorksInteropsldworksSolidWorksInteropsldworksISelectionMgrResumeSelectionListhtml_78\" target=\"_blank\" rel=\"nofollow noopener\">SuspendSelectionList \/ [ResumeSelectionList](http:\/\/help.solidworks.com\/2018\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISelectionMgr~ResumeSelectionList.html)<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/17369396.html#_85\" target=\"_blank\" rel=\"nofollow noopener\">\u601d\u8003\u9898<\/a><\/li>\n<li><a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/17369396.html#_89\" target=\"_blank\" rel=\"nofollow noopener\">\u5e38\u7528\u65b9\u6848<\/a><\/li>\n<li><a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/17369396.html#_92\" target=\"_blank\" rel=\"nofollow noopener\">\u6b63\u786e\u7b54\u6848<\/a><\/li>\n<li><a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/17369396.html#_148\" target=\"_blank\" rel=\"nofollow noopener\">\u603b\u7ed3<\/a><\/li>\n<\/ul>\n<hr>\n<h1><a rel=\"nofollow\"><\/a>SelectionManager\u7684\u4ecb\u7ecd<\/h1>\n<p><font>\u5b98\u65b9API\u76f8\u5173\u89e3\u91ca:<br \/> ISelectionMgr Interface: Allows you to get information about selected objects, obtain API objects representing the selected item, and get your selection coordinates interpreted in model or sketch space.<br \/> \u5141\u8bb8\u60a8\u83b7\u53d6\u6709\u5173\u6240\u9009\u5bf9\u8c61\u7684\u4fe1\u606f\uff0c\u83b7\u53d6\u8868\u793a\u6240\u9009\u9879\u76ee\u7684 API \u5bf9\u8c61\uff0c\u5e76\u5728\u6a21\u578b\u6216\u8349\u56fe\u7a7a\u95f4\u4e2d\u89e3\u91ca\u60a8\u7684\u9009\u62e9\u5750\u6807\u3002<\/font><\/p>\n<hr>\n<p> SelectionManager Property (IModelDoc2):Gets the ISelectionMgr object for this document, which makes the currently selected object available. \u83b7\u53d6\u6b64\u6587\u6863\u7684ISelectionMgr\u5bf9\u8c61\uff0c\u8fd9\u4f7f\u5f53\u524d\u9009\u5b9a\u7684\u5bf9\u8c61\u53ef\u7528\u3002 <\/p>\n<hr>\n<p><font>Remarks:<br \/> ISelectionMgr objects are transient because they are invalid as soon as another selection is made. So, do not hold on to these pointers for any length of time.<br \/> \u5907\u6ce8:ISelectionMgr\u5bf9\u8c61\u662f\u6682\u65f6\u7684\uff0c\u56e0\u4e3a\u4e00\u65e6\u505a\u51fa\u53e6\u4e00\u4e2a\u9009\u62e9\uff0c\u5b83\u4eec\u5c31\u65e0\u6548\u3002\u56e0\u6b64\uff0c\u4e0d\u8981\u957f\u65f6\u95f4\u6301\u6709\u8fd9\u4e9b\u6307\u9488\u3002<\/font><\/p>\n<h1><a rel=\"nofollow\"><\/a>\u5c5e\u6027\u548c\u65b9\u6cd5:<\/h1>\n<p><a href=\"http:\/\/help.solidworks.com\/2018\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISelectionMgr_members.html\" target=\"_blank\" rel=\"nofollow noopener\">http:\/\/help.solidworks.com\/2018\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISelectionMgr_members.html<\/a><br \/> <img decoding=\"async\" src=\"https:\/\/img-blog.csdnimg.cn\/c9154d32e19e4c47954f88f40f82d9c7.png?x-oss-process=image\/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAUGFpbmUgWmVuZw==,size_20,color_FFFFFF,t_70,g_se,x_16\" class=\"aligncenter\"><\/p>\n<h1><a rel=\"nofollow\"><\/a>\u5e38\u7528\u5c5e\u6027\u548c\u65b9\u6cd5:<\/h1>\n<h2><a rel=\"nofollow\"><\/a><a href=\"http:\/\/help.solidworks.com\/2018\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISelectionMgr~EnableContourSelection.html\" target=\"_blank\" rel=\"nofollow noopener\">EnableContourSelection<\/a><\/h2>\n<pre><code>\t\t\u542f\u7528\u6216\u8005\u7981\u7528\u8f6e\u5ed3\u9009\u62e9\n\t\tEnables and disables contour selection.  \n<\/code><\/pre>\n<h2><a rel=\"nofollow\"><\/a><a href=\"http:\/\/help.solidworks.com\/2018\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISelectionMgr~EnableSelection.html\" target=\"_blank\" rel=\"nofollow noopener\">EnableSelection<\/a><\/h2>\n<pre><code>\t\t\u542f\u7528\u6216\u8005\u7981\u7528\u9009\u62e9\n\t\tEnables or disables selection.  \n<\/code><\/pre>\n<h2><a rel=\"nofollow\"><\/a><a href=\"http:\/\/help.solidworks.com\/2018\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISelectionMgr~SelectionColor.html\" target=\"_blank\" rel=\"nofollow noopener\">SelectionColor<\/a><\/h2>\n<pre><code>\t    \u83b7\u53d6\u6216\u8bbe\u7f6e\u9009\u62e9\u989c\u8272\n\t    Gets or sets the selection color.  \n<\/code><\/pre>\n<h2><a rel=\"nofollow\"><\/a><a href=\"http:\/\/help.solidworks.com\/2018\/english\/api\/sldworksapi\/solidworks.interop.sldworks~solidworks.interop.sldworks.iselectionmgr~getselectedobject6.html\" target=\"_blank\" rel=\"nofollow noopener\">GetSelectedObject6<\/a>\uff08int Index, int Mark)<\/h2>\n<p>(http:\/\/help.solidworks.com\/2018\/english\/api\/sldworksapi\/solidworks.interop.sldworks<sub>solidworks.interop.sldworks.iselectionmgr<\/sub>getselectedobject6.html)<br \/> \u8fd9\u4e2a\u65b9\u6cd5\u662f\u83b7\u53d6\u5f53\u524d\u9009\u4e2d\u7684\u5bf9\u8c61\uff0c\u53ef\u4ee5\u901a\u8fc7swSelectType_e\u8fd9\u4e2a\u5bf9\u8c61\u7c7b\u578b\u6765\u5224\u65ad\u5177\u4f53\u7684\u9009\u62e9\u3002<br \/> \u6ce8\u610f: Index\u662f\u4ece1\u5f00\u59cb\uff0c\u53ef\u4ee5\u6307\u5b9a\u83b7\u53d6\u5230\u7b2c\u51e0\u4e2a\u3002<br \/> Mark\u662f\u53ef\u4ee5\u6307\u5b9a\u6807\u8bb0\u503c\u3002\u53ef\u7528\u4e8e\u8fc7\u6ee4\uff0c0 \u8868\u793a\u6ca1\u6709\u6807\u8bb0\u7684\u5bf9\u8c61\u3002<\/p>\n<pre><code>\t\u5b98\u65b9api\u793a\u4f8b: [Get Areas of MidSurface Faces (C#)](http:\/\/help.solidworks.com\/2018\/english\/api\/sldworksapi\/Get_Areas_of_MidSurface_Faces_Example_CSharp.htm)\n<\/code><\/pre>\n<h2><a rel=\"nofollow\"><\/a><a href=\"http:\/\/help.solidworks.com\/2018\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISelectionMgr~GetSelectedObjectCount2.html\" target=\"_blank\" rel=\"nofollow noopener\">GetSelectedObjectCount2<\/a><\/h2>\n<pre><code>\u8fd9\u4e2a\u4e00\u822c\u7528\u4e8e\u914d\u5408\u4e0a\u9762\u7684\u65b9\u6cd5\u4e00\u8d77\u4f7f\u7528\uff0c\u7528\u4e8e\u83b7\u53d6\u5bf9\u8c61\u6570\u91cf\u3002\n<\/code><\/pre>\n<h2><a rel=\"nofollow\"><\/a><a href=\"http:\/\/help.solidworks.com\/2018\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISelectionMgr~GetSelectedObjectsComponent4.html\" target=\"_blank\" rel=\"nofollow noopener\">GetSelectedObjectsComponent4<\/a><\/h2>\n<pre><code>\u8fd9\u4e2a\u6211\u4eec\u4e4b\u524d\u7684\u4f8b\u5b50\u4e2d\u6709\u8bb2\u8fc7\uff0c\u83b7\u53d6\u9009\u4e2d\u5bf9\u8c61\u6240\u5c5e\u7684\u7ec4\u4ef6\u5b9e\u4f8b(\u9002\u7528\u4e8e\u88c5\u914d\u4f53\u548c\u5de5\u7a0b\u56fe\u4e2d)\u3002\nGets the selected component in an assembly or drawing.  \n<\/code><\/pre>\n<h2><a rel=\"nofollow\"><\/a><a href=\"http:\/\/help.solidworks.com\/2018\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISelectionMgr~GetSelectedObjectType3.html\" target=\"_blank\" rel=\"nofollow noopener\">GetSelectedObjectType3<\/a><\/h2>\n<pre><code>\u8fd9\u4e2a\u5c31\u662f\u83b7\u53d6\u9009\u4e2d\u5bf9\u8c61\u7684\u7c7b\u578b\u3002\n\tGets the type of object selected.  \n<\/code><\/pre>\n<h2><a rel=\"nofollow\"><\/a><a href=\"http:\/\/help.solidworks.com\/2018\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISelectionMgr~GetSelectionPoint2.html\" target=\"_blank\" rel=\"nofollow noopener\">GetSelectionPoint2<\/a><\/h2>\n<pre><code>\u8fd9\u4e2a\u53ef\u4ee5\u76f4\u63a5\u83b7\u53d6\u9f20\u6807\u70b9\u51fb\u7684\u90a3\u4e2a\u70b9\u7684\u5750\u6807\u3002(\u5168\u5c40\u7684)\nGets the selected point in model space coordinates from the currently selected object.  \n![\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0](https:\/\/img-blog.csdnimg.cn\/2b172b282761407bb0dfea65e8f200cc.png?x-oss-process=image\/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAUGFpbmUgWmVuZw==,size_10,color_FFFFFF,t_70,g_se,x_16)\n<\/code><\/pre>\n<h2><a rel=\"nofollow\"><\/a><a href=\"http:\/\/help.solidworks.com\/2018\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISelectionMgr~GetSelectionPointInSketchSpace2.html\" target=\"_blank\" rel=\"nofollow noopener\">GetSelectionPointInSketchSpace2<\/a><\/h2>\n<pre><code>\u8fd9\u4e2a\u8fd4\u56de\u8349\u56fe\u7a7a\u95f4\u7684\u9009\u4e2d\u70b9\u5750\u6807\u3002\nGets the selection point projected on to the active sketch and returned in sketch space. \n<\/code><\/pre>\n<h2><a rel=\"nofollow\"><\/a><a href=\"http:\/\/help.solidworks.com\/2018\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISelectionMgr~IsInEditTarget2.html\" target=\"_blank\" rel=\"nofollow noopener\">IsInEditTarget2<\/a><\/h2>\n<pre><code>\u83b7\u53d6\u9009\u4e2d\u7684\u5bf9\u8c61\u662f\u5426\u5c5e\u4e8e\u6b63\u5728\u7f16\u8f91\u7684\u5bf9\u8c61\u3002\nGets whether the selected object is in the edit target.  \n<\/code><\/pre>\n<h2><a rel=\"nofollow\"><\/a><a href=\"http:\/\/help.solidworks.com\/2018\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISelectionMgr~SetSelectedObjectMark.html\" target=\"_blank\" rel=\"nofollow noopener\">SetSelectedObjectMark<\/a><\/h2>\n<pre><code>\u8bbe\u7f6eMark\u503c\u7ed9\u6307\u5b9a\u7684\u9009\u62e9\u5bf9\u8c61\nSets the mark value for the specified selection.  \n<\/code><\/pre>\n<h2><a rel=\"nofollow\"><\/a><a href=\"http:\/\/help.solidworks.com\/2018\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISelectionMgr~SetSelectionPoint2.html\" target=\"_blank\" rel=\"nofollow noopener\">SetSelectionPoint2<\/a><\/h2>\n<pre><code>\u8bbe\u7f6e\u9009\u62e9\u7684\u70b9\u5728\u6a21\u578b\u7a7a\u95f4\u4e2d\nSets the selection point in model space.\n<\/code><\/pre>\n<h2><a rel=\"nofollow\"><\/a><a href=\"http:\/\/help.solidworks.com\/2018\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISelectionMgr~SuspendSelectionList.html\" target=\"_blank\" rel=\"nofollow noopener\">SuspendSelectionList<\/a> \/ <a href=\"http:\/\/help.solidworks.com\/2018\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISelectionMgr~ResumeSelectionList.html\" target=\"_blank\" rel=\"nofollow noopener\">ResumeSelectionList<\/a><\/h2>\n<pre><code>\tSuspends the current selection list.   \/  Reinstates the previously suspended selection list.  \n\t\u6682\u505c\u5f53\u524d\u200b\u200b\u9009\u62e9\u5217\u8868\u3002  \/   \t\u6062\u590d\u5148\u524d\u6682\u505c\u7684\u9009\u62e9\u5217\u8868\u3002 \n\t \n\t\u8fd9\u4e24\u4e2a\u65b9\u6cd5\u624d\u662f\u6211\u4eec\u4eca\u5929\u8981\u8bb2\u7684\u4e3b\u89d2\u3002\n<\/code><\/pre>\n<h1><a rel=\"nofollow\"><\/a>\u601d\u8003\u9898<\/h1>\n<p><font>\u5728\u4e4b\u524d \uff0c\u5982\u679c\u4f60\u8ba9\u7528\u6237\u9009\u62e9\u4e865\u4e2a\u5bf9\u8c61\uff0c\u4f60\u8981\u9488\u5bf9\u6bcf\u4e00\u4e2a\u5bf9\u8c61\u8fdb\u884c\u5904\u7406\uff0c\u800c\u4e14\u4e2d\u95f4\u8fd8\u8981\u8fdb\u884c\u4e00\u4e9b\u5bf9\u8c61\u7684\u9009\u62e9\u7684\u65f6\u5019\u3002\u4f60\u662f\u600e\u4e48\u505a\u7684\uff1f<\/font><\/p>\n<h1><a rel=\"nofollow\"><\/a>\u5e38\u7528\u65b9\u6848<\/h1>\n<p>\u4e4b\u524d\u6211\u7684\u505a\u6cd5\u662f\u628a\u6bcf\u4e00\u4e2a\u5bf9\u8c61\u4fdd\u5b58\u8d77\u6765\uff0c\u5229\u7528\u6301\u4e45id\u6216\u8005\u5bf9\u8c61 \u6765\u4e00\u4e2a\u4e00\u4e2a\u8fdb\u884c\u5904\u7406\uff0c\u4f46\u662f\u8fd9\u6837\u6bd4\u8f83\u9ebb\u70e6\u3002<\/p>\n<h1><a rel=\"nofollow\"><\/a>\u6b63\u786e\u7b54\u6848<\/h1>\n<p>\u5148\u770b\u4e0b\u8fd9\u4e00\u5bf9\u65b9\u6cd5\u7684\u89e3\u91ca:<br \/> <img decoding=\"async\" src=\"https:\/\/img-blog.csdnimg.cn\/e9b34ad5e2404bcfa745b9639ffb784e.png\" class=\"aligncenter\"><br \/> <img decoding=\"async\" src=\"https:\/\/img-blog.csdnimg.cn\/47cbd37faafd4e7ba8963f9c5fc9649e.png\" class=\"aligncenter\"><\/p>\n<p>\u611f\u89c9\u5c31\u662f\u4f60\u53ef\u4ee5\u628a\u5f53\u524d\u9009\u62e9\u7684\u6240\u6709\u5bf9\u8c61\u6682\u5b58\uff0c\u4f60\u53ef\u4ee5\u8fdb\u884c\u4e00\u4e9b\u64cd\u4f5c\uff0c\u6bd4\u5982\u91cd\u65b0\u9009\u62e9\u5bf9\u8c61\u3002 \u7528\u5b8c\u4e4b\u540e\u518d\u628a\u4e4b\u524d\u6682\u5b58\u7684\u9009\u62e9\u96c6\u6062\u590d\u51fa\u6765\uff0c\u5c31\u8fd8\u662f\u539f\u6765\u548c\u72b6\u6001\u3002 \u8fd9\u6837\u4f60\u8fd8\u53ef\u4ee5\u7ee7\u7eed\u8fdb\u884c\u4e0b\u4e00\u4e2a\u5bf9\u8c61\u7684\u5904\u7406\u3002<\/p>\n<p>\u5177\u4f53\u53ef\u4ee5\u770b\u8fd9\u4e2a\u5b98\u65b9\u7684\u793a\u4f8b:<\/p>\n<p><a href=\"http:\/\/help.solidworks.com\/2018\/english\/api\/sldworksapi\/Add_Objects_to_Selection_List_Example_CSharp.htm\" target=\"_blank\" rel=\"nofollow noopener\">Add Objects to Selection List Example (C#)<\/a><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img-blog.csdnimg.cn\/260916436adf460fafbee383ee0b202f.png?x-oss-process=image\/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAUGFpbmUgWmVuZw==,size_20,color_FFFFFF,t_70,g_se,x_16\" class=\"aligncenter\"><br \/> \u5173\u952e\u4ee3\u7801\u533a\u57df:<\/p>\n<pre><code>\t\t\t\t<span>\/\/ Start a new selection list<\/span>\n\n\t            ret <span>=<\/span> selMgr<span>.<\/span><span>SuspendSelectionList<\/span><span>(<\/span><span>)<\/span><span>;<\/span>    \n\n\t            Debug<span>.<\/span><span>Print<\/span><span>(<\/span><span>\"The current selection list with \"<\/span> <span>+<\/span> ret <span>+<\/span> <span>\" object (Sketch1) is suspended.\"<\/span><span>)<\/span><span>;<\/span>\n\n\t            <span>\/\/ Add two objects to the new selection list<\/span>\n\n\t            numAdded <span>=<\/span> selMgr<span>.<\/span><span>AddSelectionListObjects<\/span><span>(<\/span><span>(<\/span>arrObjIn<span>)<\/span><span>,<\/span> selData<span>)<\/span><span>;<\/span>\n\n\t            Debug<span>.<\/span><span>Print<\/span><span>(<\/span><span>\"A new selection list is started.\"<\/span><span>)<\/span><span>;<\/span>\n\n\n\t            <span>\/\/ Get number of objects in the new selection list (should be 2)<\/span>\n\n\t            count <span>=<\/span> selMgr<span>.<\/span><span>GetSelectedObjectCount<\/span><span>(<\/span><span>)<\/span><span>;<\/span>\n\n\t            Debug<span>.<\/span><span>Print<\/span><span>(<\/span><span>\"The selection list now contains \"<\/span> <span>+<\/span> count <span>+<\/span> <span>\" objects.\"<\/span><span>)<\/span><span>;<\/span>\n\n\n\t            <span>\/\/ Get the last object in the new selection list<\/span>\n\n\t            selobj <span>=<\/span> selMgr<span>.<\/span><span>GetSelectedObject6<\/span><span>(<\/span>count<span>,<\/span> \t<span>-<\/span><span>1<\/span><span>)<\/span><span>;<\/span>\n\n\t            Debug<span>.<\/span><span>Print<\/span><span>(<\/span><span>\"The last object in the selection list is of swSelectType_e = \"<\/span> <span>+<\/span> selMgr<span>.<\/span><span>GetSelectedObjectType3<\/span><span>(<\/span>count<span>,<\/span> <span>-<\/span><span>1<\/span><span>)<\/span> <span>+<\/span> <span>\".\"<\/span><span>)<\/span><span>;<\/span>\n\n\n\t            <span>\/\/ Go back to the previous selection list<\/span>\n\n\t            selMgr<span>.<\/span><span>ResumeSelectionList<\/span><span>(<\/span><span>)<\/span><span>;<\/span>\n\n\t            Debug<span>.<\/span><span>Print<\/span><span>(<\/span><span>\"The previous selection list is resumed.\"<\/span><span>)<\/span><span>;<\/span>\n\n\n\t            <span>\/\/ Get the number of objects in the selection list (should be 1)<\/span>\n\n\t            count <span>=<\/span> selMgr<span>.<\/span><span>GetSelectedObjectCount<\/span><span>(<\/span><span>)<\/span><span>;<\/span>\n\n\t            Debug<span>.<\/span><span>Print<\/span><span>(<\/span><span>\"The selection list now contains \"<\/span> <span>+<\/span> count <span>+<\/span> <span>\" object (Sketch1).\"<\/span><span>)<\/span><span>;<\/span>\n<\/code><\/pre>\n<h1><a rel=\"nofollow\"><\/a>\u603b\u7ed3<\/h1>\n<pre><code>\u50cf\u8fd9\u79cd\u65b9\u6cd5\uff0c\u5982\u679c\u53ea\u662f\u9760\u5b8f\u5f55\u5236\uff0c\u4f60\u6c38\u8fdc\u4e5f\u4e0d\u4f1a\u77e5\u9053\u8fd8\u6709\u8fd9\u79cd\u64cd\u4f5c\uff0c\u6240\u4ee5\u8fd8\u662f\u8981\u5b66\u4f1a\u5e38\u67e5API\uff0c\u7ffb\u4e00\u7ffb\uff0c\u770b\u4e00\u770b\uff0c\u5c31\u4f1a\u6709\u65b0\u7684\u6536\u83b7 \u3002\n\n\u5982\u679c\u8fd9\u7bc7\u6587\u7ae0\u5bf9\u4f60\u6709\u5e2e\u52a9\uff0c\u5c31\u70b9\u4e2a\u8d5e\u5457\u3002\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/img-blog.csdnimg.cn\/063c0228f674432abb57c79aa6fb5705.png\" class=\"aligncenter\"><\/p>\n<p>\u6700\u540e\u5047\u671f\u4f59\u989d\u5df2\u4e0d\u8db3\uff0c\u795d\u5927\u5bb6\u8282\u65e5\u5feb\u4e50\u3002<\/p>\n<p>          posted @<br \/>\n<span>2021-10-05 10:18<\/span>&nbsp;<br \/>\n<a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/\" target=\"_blank\" rel=\"nofollow noopener\">painezeng<\/a>&nbsp; \u9605\u8bfb(<br \/>\n<span>0<\/span>)&nbsp; \u8bc4\u8bba(<br \/>\n<span>0<\/span>)&nbsp;<br \/>\n<a href=\"https:\/\/i.cnblogs.com\/EditPosts.aspx?postid=17369396\" rel=\"nofollow noopener\" target=\"_blank\">\u7f16\u8f91<\/a>&nbsp;<br \/>\n<a href=\"\" target=\"_blank\" rel=\"nofollow noopener\">\u6536\u85cf<\/a>&nbsp;<br \/>\n<a href=\"\" target=\"_blank\" rel=\"nofollow noopener\">\u4e3e\u62a5<\/a> &nbsp;<br \/>\n<a href=\"\" target=\"_blank\" rel=\"nofollow noopener\">\u6765\u6e90<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>SolidWorks \u4e8c\u6b21\u5f00\u53d1&#8212;SelectionManager\u7684\u5b66\u4e60\u4ee5\u53ca\u5999\u7528 Selection [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":543,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[4,5],"tags":[7,6,8],"series":[],"class_list":["post-542","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-solidworks-","category-solidworks","tag-api","tag-solidworks","tag-8"],"views":202,"_links":{"self":[{"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=\/wp\/v2\/posts\/542","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=542"}],"version-history":[{"count":0,"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=\/wp\/v2\/posts\/542\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=\/wp\/v2\/media\/543"}],"wp:attachment":[{"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=542"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=542"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=542"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fseries&post=542"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}