{"id":627,"date":"2019-10-22T14:32:00","date_gmt":"2019-10-22T06:32:00","guid":{"rendered":"http:\/\/localhost:8080\/?p=627"},"modified":"2019-10-22T14:32:00","modified_gmt":"2019-10-22T06:32:00","slug":"c-solidworks-%e4%ba%8c%e6%ac%a1%e5%bc%80%e5%8f%91-api-%e5%88%9b%e5%bb%bapane%e9%a1%b5%e9%9d%a2%e9%a2%84%e8%a7%88bom","status":"publish","type":"post","link":"https:\/\/blog.ke-zhi.com\/?p=627","title":{"rendered":"C# SolidWorks \u4e8c\u6b21\u5f00\u53d1 API &#8212; \u521b\u5efaPane\u9875\u9762(\u9884\u89c8BOM)"},"content":{"rendered":"<h1> <a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/p\/12897463.html\" target=\"_blank\" rel=\"nofollow noopener\"> <span>C# SolidWorks \u4e8c\u6b21\u5f00\u53d1 API &#8212; \u521b\u5efaPane\u9875\u9762(\u9884\u89c8BOM)<\/span> <\/a> <\/h1>\n<p>\u4eca\u5929\u8bb2\u4e00\u4e0b\u600e\u4e48\u5728Solidworks\u754c\u9762\u4e2d\u663e\u793a\u51fa\u7a97\u4f53\u754c\u9762\u3002<\/p>\n<p>\u4eca\u5929\u7684\u529f\u80fd\u662f\u5728\u53f3\u8fb9\u63d0\u524d\u9884\u89c8BOM \u6e05\u5355\uff0c\u529f\u80fd\u6bd4\u8f83\u7b80\u5355\u3002\u9884\u89c8\u56fe\u5982\u4e0b:<\/p>\n<p>\u7531\u4e8e\u4e0d\u662f\u63d2\u4ef6\u7684\u5f62\u52bf\uff0c\u6240\u4ee5\u6548\u7387\u4e0d\u662f\u592a\u9ad8\uff0c\u5982\u679c\u5927\u5bb6\u60f3\u901f\u5ea6\u5feb\uff0c\u8bf7\u81ea\u5df1\u6539\u6210\u63d2\u4ef6\u5f62\u5f0f\uff0c\u5176\u5b9e\u66f4\u597d\u7684\u65b9\u6cd5\u662f\u505a\u6210\u63d2\u4ef6\uff0c\u53ef\u4ee5\u5728\u6253\u5f00\u88c5\u914d\u4f53\u4e4b\u540e\u81ea\u52a8\u9884\u89c8BOM, \u65f6\u95f4\u5173\u7cfb\uff0c\u8fd9\u91cc\u4ec5\u4f5c\u4e3a\u793a\u4f8b\u3002<\/p>\n<p>\u8fd9\u91cc\u9762\u6d89\u53ca\u5230\u7684\u529f\u80fd\u5927\u6982\u6709\uff0c\u904d\u5386\u88c5\u914d\u4f53\uff0c\u904d\u5386\u96f6\u4ef6\u5c5e\u6027\uff0c\u7ec4\u7ec7\u5c42\u7ea7\u7ed3\u6784\u7b49\u7b49\u3002<\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/img-blog.csdnimg.cn\/20191022141711606.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3plbmdxaDAzMTQ=,size_16,color_FFFFFF,t_70\"><\/p>\n<p>\u5b8c\u6210\u540e\u6548\u679c\u5982\u4e0b\u56fe\uff1a<\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/img-blog.csdnimg.cn\/2019102214310089.png?x-oss-process=image\/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3plbmdxaDAzMTQ=,size_16,color_FFFFFF,t_70\"><\/p>\n<p>\u4e0b\u9762\u53ea\u663e\u793a\u4e86\u5173\u952e\u7684\u9875\u9762\u52a0\u8f7d\u4ee3\u7801\uff0c\u5b9e\u9645\u7684\u4ee3\u7801\u8bf7\u53c2\u8003\u6e90\u7801\uff1a&nbsp;<\/p>\n<p><a href=\"https:\/\/gitee.com\/painezeng\/CSharpAndSolidWorks\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/gitee.com\/painezeng\/CSharpAndSolidWorks<\/a><\/p>\n<pre><code> private void btn_Pane_Click(object sender, EventArgs e)\n        {\n            \/\/\u6ce8\u610f: \u8fd9\u91cc\u53ea\u662f\u663e\u793a\u81ea\u5df1\u7684\u7a97\u4f53\u5230solidworks\u4e2d,\u76ee\u524d\u8fd8\u662f\u8d70\u7684exe\u7684\u65b9\u5f0f .\n            \/\/\u771f\u6b63\u5f00\u53d1\u7684\u65f6\u5019\u5e94\u8be5\u5728DLL\u4e2d\u52a0\u5165,\u8fd9\u6837\u901f\u5ea6\u4f1a\u5feb\u5f88\u591a.  exe\u8bfbbom\u9700\u898140s dll \u53ea\u9700\u89813\u79d2\u5de6\u53f3.\n            \/\/\u83b7\u53d6\u5f53\u524d\u7a0b\u5e8f\u6240\u5728\u8def\u5f84\n            string Dllpath = Path.GetDirectoryName(typeof(MyPane).Assembly.CodeBase).Replace(@\"file:\\\", string.Empty);\n\n            var imagePath = Path.Combine(Dllpath, \"bomlist.bmp\");\n\n            ISldWorks swApp = Utility.ConnectToSolidWorks();\n\n            string toolTip;\n\n            toolTip = \"BOM List\";\n\n            \/\/\u521b\u5efa\u9875\u9762\n            if (taskpaneView != null)\n            {\n                taskpaneView.DeleteView();\n                Marshal.FinalReleaseComObject(taskpaneView);\n                taskpaneView = null;\n            }\n\n            taskpaneView = swApp.CreateTaskpaneView2(imagePath, toolTip);\n\n            MyPane myPane = new MyPane(swApp);\n\n            myPane.Dock = DockStyle.Fill;\n            \/\/ myPane.Show();\n\n            \/\/\u5728\u9875\u9762\u4e2d\u663e\u793a\u7a97\u4f53(\u5d4c\u5165)\n\n            taskpaneView.DisplayWindowFromHandlex64(myPane.Handle.ToInt64());\n        }<\/code><\/pre>\n<p>\u5982\u679c\u5927\u5bb6\u6709\u4ec0\u4e48\u95ee\u9898\uff0c\u53ef\u4ee5\u7559\u8a00\u7ed9\u6211\u3002<\/p>\n<p>          posted @<br \/>\n<span>2019-10-22 14:32<\/span>&nbsp;<br \/>\n<a href=\"https:\/\/www.cnblogs.com\/solidworksapi\/\" target=\"_blank\" rel=\"nofollow noopener\">painezeng<\/a>&nbsp; \u9605\u8bfb(<br \/>\n<span>163<\/span>)&nbsp; \u8bc4\u8bba(<br \/>\n<span>0<\/span>)&nbsp;<br \/>\n<a href=\"https:\/\/i.cnblogs.com\/EditPosts.aspx?postid=12897463\" 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; \u521b\u5efaPane\u9875\u9762(\u9884\u89c8BOM) \u4eca\u5929\u8bb2\u4e00\u4e0b\u600e\u4e48\u5728 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":628,"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-627","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-solidworks-","category-solidworks","tag-api","tag-solidworks","tag-8"],"views":229,"_links":{"self":[{"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=\/wp\/v2\/posts\/627","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=627"}],"version-history":[{"count":0,"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=\/wp\/v2\/posts\/627\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=\/wp\/v2\/media\/628"}],"wp:attachment":[{"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=627"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=627"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/blog.ke-zhi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fseries&post=627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}