{"id":651,"date":"2019-09-27T22:50:00","date_gmt":"2019-09-27T14:50:00","guid":{"rendered":"http:\/\/localhost:8080\/?p=651"},"modified":"2019-09-27T22:50:00","modified_gmt":"2019-09-27T14:50:00","slug":"c-solidworks-%e4%ba%8c%e6%ac%a1%e5%bc%80%e5%8f%91-api-%e5%88%a0%e9%99%a4%e8%8d%89%e5%9b%be%e4%b8%ad%e7%9a%84%e7%ba%a6%e6%9d%9f%e5%85%b3%e7%b3%bb","status":"publish","type":"post","link":"https:\/\/blog.ke-zhi.com\/?p=651","title":{"rendered":"C# SolidWorks \u4e8c\u6b21\u5f00\u53d1 API&#8212;\u5220\u9664\u8349\u56fe\u4e2d\u7684\u7ea6\u675f\u5173\u7cfb"},"content":{"rendered":"<h1> <a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/12897475.html\" target=\"_blank\" rel=\"nofollow noopener\"> <span>C# SolidWorks \u4e8c\u6b21\u5f00\u53d1 API&#8212;\u5220\u9664\u8349\u56fe\u4e2d\u7684\u7ea6\u675f\u5173\u7cfb<\/span> <\/a> <\/h1>\n<p><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/img-blog.csdnimg.cn\/20190927224532796.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3plbmdxaDAzMTQ=,size_16,color_FFFFFF,t_70\"><\/p>\n<p>\u8fd9\u4e00\u4e2a\u6bd4\u8f83\u7b80\u5355,\u5176\u5b9e\u5c31\u662f\u904d\u5386\u4e00\u4e0b\u8349\u56fe\u4e2d\u7684\u5bf9\u8c61,\u7136\u540e\u83b7\u53d6\u5173\u7cfb,\u5220\u9664.<\/p>\n<p>\u4ee3\u7801:<\/p>\n<pre><code> private void btn_DeleteConstraints_Click(object sender, EventArgs e)\n        {\n            \/\/\u8bf7\u5148\u6253\u5f00clamp1\u8fd9\u4e2a\u96f6\u4ef6\n\n            ISldWorks swApp = Utility.ConnectToSolidWorks();\n            ModelDoc2 swModel = swApp.ActiveDoc;\n            SelectionMgr swSelMgr = swModel.SelectionManager;\n\n            \/\/\u9009\u62e9\u8349\u56fe\n            swModel.Extension.SelectByID2(\"Sketch2\", \"SKETCH\", 0, 0, 0, false, 4, null, 0);\n\n            \/\/\u8fdb\u5165\u7f16\u8f91\u8349\u56fe\n            swModel.EditSketch();\n\n            \/\/\u83b7\u53d6\u5f53\u524d\u8349\u56fe\u5bf9\u8c61\n            Sketch swSketch = swModel.GetActiveSketch2();\n\n            \/\/\u83b7\u53d6\u8be5\u8349\u56fe\u4e2d\u7684\u6240\u6709\u7ebf\n            object[] vSketchSeg = swSketch.GetSketchSegments();\n\n            \/\/\u5b9a\u4e49\u9009\u62e9\n            SelectData swSelData = swSelMgr.CreateSelectData();\n\n            SketchSegment swSketchSeg;\n            \/\/\u904d\u5386\u7ebf\n            for (int i = 0; i &lt; vSketchSeg.Length; i++)\n            {\n                swSketchSeg = (SketchSegment)vSketchSeg[i];\n                swSketchSeg.Select4(false, swSelData);\n                \/\/\u5220\u9664\u5173\u7cfb\n                swModel.SketchConstraintsDelAll();\n            }\n\n\n            object[] vSketchPt = (SketchPoint[])swSketch.GetSketchPoints2();\n            SketchPoint swSketchPt;\n            \/\/\u904d\u5386\u70b9\n            for (int i = 0; i &lt; vSketchPt.Length; i++)\n            {\n                swSketchPt = (SketchPoint)vSketchPt[i];\n                swSketchPt.Select4(false, swSelData);\n                swModel.SketchConstraintsDelAll();\n            }\n            \/\/\u9000\u51fa\u7f16\u8f91\u8349\u56fe\n            swModel.InsertSketch2(true);\n\n            swModel.ClearSelection2(true);\n        }<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>          posted @<br \/>\n<span>2019-09-27 22:50<\/span>&nbsp;<br \/>\n<a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/\" target=\"_blank\" rel=\"nofollow noopener\">painezeng<\/a>&nbsp; \u9605\u8bfb(<br \/>\n<span>237<\/span>)&nbsp; \u8bc4\u8bba(<br \/>\n<span>0<\/span>)&nbsp;<br \/>\n<a href=\"https:\/\/i.cnblogs.com\/EditPosts.aspx?postid=12897475\" 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><\/p>\n","protected":false},"excerpt":{"rendered":"<p>C# SolidWorks \u4e8c\u6b21\u5f00\u53d1 API&#8212;\u5220\u9664\u8349\u56fe\u4e2d\u7684\u7ea6\u675f\u5173\u7cfb \u8fd9\u4e00\u4e2a\u6bd4\u8f83\u7b80\u5355,\u5176\u5b9e\u5c31\u662f\u904d\u5386\u4e00 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":652,"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-651","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-solidworks-","category-solidworks","tag-api","tag-solidworks","tag-8"],"views":194,"_links":{"self":[{"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=\/wp\/v2\/posts\/651","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=651"}],"version-history":[{"count":0,"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=\/wp\/v2\/posts\/651\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=\/wp\/v2\/media\/652"}],"wp:attachment":[{"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=651"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=651"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=651"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fseries&post=651"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}