{"id":791,"date":"2009-07-26T08:38:58","date_gmt":"2009-07-25T23:38:58","guid":{"rendered":"https:\/\/www.iss.ai\/?p=791"},"modified":"2009-07-26T08:38:58","modified_gmt":"2009-07-25T23:38:58","slug":"solidworks-api%e3%81%ab%e9%96%a2%e3%81%99%e3%82%8b%e6%a4%9c%e8%a8%8e%e3%80%80%e3%81%9d%e3%81%ae%ef%bc%92","status":"publish","type":"post","link":"https:\/\/www.iss.ai\/?p=791","title":{"rendered":"SolidWorks API\u306b\u95a2\u3059\u308b\u691c\u8a0e\u3000\u305d\u306e\uff12"},"content":{"rendered":"\t\t\t\t<p>\u25a0Solid Works API\u3000\u305d\u306e\uff12\u3000\uff13\u6b21\u5143\u30c7\u30fc\u30bf\u306e\u53d6\u5f97<\/p>\n\t\t\t\t<p>\u30fb\uff13\u6b21\u5143\u30c7\u30fc\u30bf\u306e\u53d6\u5f97<\/p>\n\t\t\t\t<p>\u305b\u3063\u304b\u304f\u30e2\u30c7\u30eb\u3092\u4f5c\u6210\u3057\u305f\u306e\u3060\u304b\u3089\u3001\u4f55\u304b\u306b\u4f7f\u3048\u306a\u3044\u304b\u3068\u601d\u3063\u305f\u306e\u3060\u304c\u3001<br \/>\n\t\t\t\tSolid Works\u304c\u4fdd\u5b58\u3067\u304d\u308b\u30d5\u30a1\u30a4\u30eb\u5f62\u5f0f\u306f\u3069\u308c\u3082\u518d\u5229\u7528\u304c\u96e3\u3057\u3044\u3002<br \/>\n\t\t\t\t\u3067\u3001\u3044\u3063\u305d\uff13\u6b21\u5143\u30c7\u30fc\u30bf\u3092\u81ea\u5206\u3067\u53d6\u5f97\u3001\u30d5\u30a1\u30a4\u30eb\u4fdd\u5b58\u3059\u308c\u3070\u3088\u3044\u3067\u306f\u306a\u3044\u304b\u3001\u3068\u3002<br \/>\n\t\t\t\t\u305d\u3053\u3067\u3001\u518d\u3073\u30de\u30af\u30ed\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u306b\u306a\u3063\u305f\u3002<\/p>\n\t\t\t\t<p>&#8212;VBA-Macro&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n\t\t\t\t<p>\u307e\u305a\u304a\u7d04\u675f\u306e<br \/>\n\t\t\t\tDim swApp\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 As SldWorks.SldWorks<br \/>\n\t\t\t\tDim swModel\u00a0\u00a0\u00a0\u00a0\u00a0 As SldWorks.ModelDoc2<br \/>\n\t\t\t\tSet swApp = Application.SldWorks<br \/>\n\t\t\t\tSet swModel = swApp.ActiveDoc<\/p>\n\t\t\t\t<p>\u8272\u60c5\u5831\u3082\u4fdd\u5b58\u3059\u308b\u306e\u3067<br \/>\n\t\t\t\tDim vbaseColor As Variant<br \/>\n\t\t\t\tvbaseColor = swModel.MaterialPropertyValues<br \/>\n\t\t\t\t\u30e2\u30c7\u30eb\u306e\u8272\u60c5\u5831\u3092\u53d6\u5f97\u3002<\/p>\n\t\t\t\t<p>\u4eca\u56de\u306f\u30bd\u30ea\u30c3\u30c9\u30dc\u30c7\u30a3\u6bce\u306b\u30c7\u30fc\u30bf\u3092\u6271\u3046\u3002<br \/>\n\t\t\t\t\u30bd\u30ea\u30c3\u30c9\u30dc\u30c7\u30a3\u306e\u30c7\u30fc\u30bf\u306fBodyFolder\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u3042\u308b\u3089\u3057\u3044\u3002<br \/>\n\t\t\t\tDim swBodyFolder As BodyFolder<br \/>\n\t\t\t\t\u3067BodyFolder\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5b9a\u7fa9\u3002<\/p>\n\t\t\t\t<p>Dim nFeatNum As Long<br \/>\n\t\t\t\tnFeatNum = swModel.GetFeatureCount<br \/>\n\t\t\t\tDim feat As Feature<br \/>\n\t\t\t\tSet feat = swModel.FirstFeature<br \/>\n\t\t\t\t\u30d5\u30a3\u30fc\u30c1\u30e3\u30fc\u306e\u6570\u3001\u6700\u521d\u306e\u30d5\u30a3\u30fc\u30c1\u30e3\u30fc\u3092\u53d6\u5f97\u3002<\/p>\n\t\t\t\t<p>For i = 0 To nFeatNum &#8211; 1 Step 1<br \/>\n\t\t\t\tIf feat.GetTypeName = &#8220;SolidBodyFolder&#8221; Then<br \/>\n\t\t\t\tSet swBodyFolder = feat.GetSpecificFeature2<br \/>\n\t\t\t\tIsBodyFolder = True<br \/>\n\t\t\t\tEnd If<br \/>\n\t\t\t\tSet feat = feat.GetNextFeature<br \/>\n\t\t\t\tNext i<br \/>\n\t\t\t\t\u30d5\u30a3\u30fc\u30c1\u30e3\u30fc\u3092\u8d70\u67fb\u3057\u306a\u304c\u3089\u30bf\u30a4\u30d7\u30cd\u30fc\u30e0\u304c&#8221;SolidBodyFolder&#8221;\u306e\u3082\u306e\u3092\u63a2\u3059\u3002<br \/>\n\t\t\t\t\u3067\u3001GetSpecificFeature2\u3067BodyFolder\u304c\u53d6\u5f97\u3067\u304d\u308b\u3089\u3057\u3044\u3002<\/p>\n\t\t\t\t<p>Dim nBodyCount As Long<br \/>\n\t\t\t\tDim vBodies As Variant<br \/>\n\t\t\t\tnBodyCount = swBodyFolder.GetBodyCount<br \/>\n\t\t\t\tvBodies = swBodyFolder.GetBodies<br \/>\n\t\t\t\tBodyFolder\u304b\u3089\u30bd\u30ea\u30c3\u30c9\u30dc\u30c7\u30a3\u306e\u6570\u3068\u30dc\u30c7\u30a3\u30c7\u30fc\u30bf\u3092\u3054\u3063\u305d\u308a\u53d6\u5f97\u3002<\/p>\n\t\t\t\t<p>Dim fileNo As Integer<br \/>\n\t\t\t\tfileNo = FreeFile<br \/>\n\t\t\t\tOpen \u201cSaveFile\u201d &amp; &#8220;.i3d&#8221; For Output As #fileNo<br \/>\n\t\t\t\t\u6b21\u306b\u4fdd\u5b58\u7528\u30d5\u30a1\u30a4\u30eb\u306e\u6e96\u5099\u3002\u72ec\u81ea\u5f62\u5f0f\u201d.i3d\u201d\u62e1\u5f35\u5b50\u3067\u30d5\u30a1\u30a4\u30eb\u3092\u30aa\u30fc\u30d7\u30f3\u3059\u308b\u3002<\/p>\n\t\t\t\t<p>Dim vBody As Variant<br \/>\n\t\t\t\tDim swBody As Body2<br \/>\n\t\t\t\tBody2\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5b9a\u7fa9\u3002<\/p>\n\t\t\t\t<p>For Each vBody In vBodies<br \/>\n\t\t\t\tSet swBody = vBody<br \/>\n\t\t\t\tDim nFaceCount As Long<br \/>\n\t\t\t\tnFaceCount = swBody.GetFaceCount<br \/>\n\t\t\t\tDim swFace As Face2<br \/>\n\t\t\t\tSet swFace = swBody.GetFirstFace<\/p>\n\t\t\t\t<p>\u5168\u30dc\u30c7\u30a3\u3092\u8d70\u67fb\u3057\u3064\u3064\u3001\u5404\u30dc\u30c7\u30a3\u306e\u30d5\u30a7\u30a4\u30b9\u3092\u53d6\u5f97\u3002<\/p>\n\t\t\t\t<p>Dim faceColor As Variant<br \/>\n\t\t\t\tFor i = 0 To nFaceCount &#8211; 1 Step 1<br \/>\n\t\t\t\tfaceColor = swFace.MaterialPropertyValues<br \/>\n\t\t\t\t\u30d5\u30a7\u30a4\u30b9\u306e\u8272\u60c5\u5831\u3092\u53d6\u5f97\u3002\u3053\u306e\u5f8c\u8272\u60c5\u5831\u3092\u6301\u3063\u3066\u3044\u305f\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u3001<br \/>\n\t\t\t\t\u306a\u304b\u3063\u305f\u3089\u30d5\u30a7\u30a4\u30b9\u304c\u5c5e\u3059\u308b\u30d5\u30a3\u30fc\u30c1\u30e3\u30fc\u306e\u8272\u3001\u305d\u308c\u3082\u306a\u304b\u3063\u305f\u3089\u30dc\u30c7\u30a3\u306e\u8272\u3001<br \/>\n\t\t\t\t\u3055\u3089\u306b\u306a\u304b\u3063\u305f\u3089\u5192\u982d\u3067\u53d6\u5f97\u3057\u305f\u3001\u30e2\u30c7\u30eb\u306e\u8272\u3092\u4f7f\u7528\u3059\u308b\u51e6\u7406\u3092\u884c\u3046\u3002\u304c\u3001\u7701\u7565\u3002<\/p>\n\t\t\t\t<p>Print #fileNo, &#8220;MATERIAL &#8220;;<br \/>\n\t\t\t\tFor j = 0 To 8 Step 1<br \/>\n\t\t\t\tPrint #fileNo, faceColor(j);<br \/>\n\t\t\t\tIf j &lt;&gt; 8 Then<br \/>\n\t\t\t\tPrint #fileNo, &#8220;,&#8221;;<br \/>\n\t\t\t\tEnd If<br \/>\n\t\t\t\tNext<br \/>\n\t\t\t\tPrint #fileNo, &#8220;&#8221;<br \/>\n\t\t\t\t\u8272\u60c5\u5831\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u3053\u307f\u3002<\/p>\n\t\t\t\t<p>Dim vTri As Variant<br \/>\n\t\t\t\tvTri = swFace.GetTessTriangles(False)<br \/>\n\t\t\t\tDim vNorm As Variant<br \/>\n\t\t\t\tvNorm = swFace.GetTessNorms<br \/>\n\t\t\t\tGetTessTriangles\u3067\u5404\u9762\u306e\u9802\u70b9\u5ea7\u6a19\u3092\u3001GetTessNorms\u3067\u6cd5\u7dda\u3092\u53d6\u5f97\u3067\u304d\u308b\u3002<br \/>\n\t\t\t\t\u4e0a\u8a18\u8272\u60c5\u5831\u540c\u69d8\u3053\u308c\u3089\u3082\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u3053\u3080\u3002<\/p>\n\t\t\t\t<p>Set swFace = swFace.GetNextFace<br \/>\n\t\t\t\t\u6b21\u306e\u30d5\u30a7\u30a4\u30b9\u3092\u53d6\u5f97\u3057\u3066\u30eb\u30fc\u30d7\u5148\u982d\u3078\u3002<\/p>\n\t\t\t\t<p>\u3053\u3093\u306a\u8abf\u5b50\u3067\u5168\u30d5\u30a7\u30a4\u30b9\u5206\u306e\u8272\u60c5\u5831\u3001\u9802\u70b9\u5ea7\u6a19\u3001\u6cd5\u7dda\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3001<br \/>\n\t\t\t\t\u30d5\u30a1\u30a4\u30eb\u66f8\u304d\u8fbc\u307f\u3092\u884c\u3044\u3001\u30e2\u30c7\u30eb\u30c7\u30fc\u30bf\u306e\u72ec\u81ea\u5f62\u5f0f\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n\t\t\t\t<p>Close #fileNo<br \/>\n\t\t\t\t\u6700\u5f8c\u306b\u30d5\u30a1\u30a4\u30eb\u3092\u9589\u3058\u308b\u3002<\/p>\n\t\t\t\t<p>\u3042\u3068\u306f\u3069\u3046\u3068\u3067\u3082\u518d\u5229\u7528\u3067\u304d\u308b\u3002<\/p>\n\t\t\t\t<p>\u4ee5\u4e0a\u3002<br \/>\n\t\t\t\t<img decoding=\"async\" src=\"https:\/\/www.iss.ai\/wp-content\/uploads\/2009\/07\/missile_r.jpg\" alt=\"\u30df\u30b5\u30a4\u30eb\uff08SolidWorks\u753b\u9762\u30ad\u30e3\u30d7\u30c1\u30e3\uff09\" width=\"300\" \/><br \/>\n\t\t\t\t<img decoding=\"async\" src=\"https:\/\/www.iss.ai\/wp-content\/uploads\/2009\/07\/4missile_pod_r.jpg\" alt=\"\u30df\u30b5\u30a4\u30eb\u30dd\u30c3\u30c9\uff08SolidWorks\u753b\u9762\u30ad\u30e3\u30d7\u30c1\u30e3\uff09\" width=\"300\" \/><br \/>\n\t\t\t\t\u4e0a\u56f3\u306eSolidWorks\u30e2\u30c7\u30eb\u304c\u3001<br \/>\n\t\t\t\t\u3053\u3046\u306a\u3063\u305f\u3002<\/p>\n\t\t\t\t<p><object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=\"400\" height=\"264\" codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=6,0,40,0\"><param name=\"src\" value=\"https:\/\/www.iss.ai\/wp-content\/uploads\/2009\/07\/missile.swf\" \/><embed type=\"application\/x-shockwave-flash\" width=\"400\" height=\"264\" src=\"https:\/\/www.iss.ai\/wp-content\/uploads\/2009\/07\/missile.swf\"><\/embed><\/object><\/p>\n\t\t\t\t<p>\u3061\u306a\u307f\u306b\u30d3\u30e5\u30fc\u30a2\u306f\u5f0a\u793e\u306e\u732b\u597d\u304d\u306a\u30d7\u30ed\u30b0\u30e9\u30de\u304c<br \/>\n\t\t\t\t\u4f5c\u6210\u3057\u305f\u3002<\/p>\n\t\t\t\t<p>\u304a\u307e\u3051<br \/>\n\t\t\t\t\u4e0a\u8a18\u3068\u540c\u3058\u624b\u9806\u3067\u3001\u4e16\u9593\u3067\u308f\u308a\u3068\u4f7f\u308f\u308c\u3066\u3044\u308bobj\u30d5\u30a1\u30a4\u30eb\u306a\u308b\u3082\u306e\u3092\u4f5c\u6210\u3057\u3066\u307f\u305f\u3002<br \/>\n\t\t\t\t\u304b\u3076\u3063\u3066\u308b\u9762\u3068\u304b\u5b8c\u5168\u7121\u8996\u3067\u8a18\u8ff0\u3057\u305f\u306e\u3067\u3001\u7121\u99c4\u306a\u30c7\u30fc\u30bf\u304c\u304b\u306a\u308a\u3042\u308b\u304c\u3001\u4e00\u5fdc\u4e00\u822c\u306e\u30d3\u30e5\u30fc\u30a2\u7b49\u3067\u8868\u793a\u3067\u304d\u308b\u3002<\/p>\n\t\t\t\t<p><a href=\"https:\/\/www.iss.ai\/wp-content\/uploads\/2009\/07\/missile.zip\">&lt;download&gt;missile<\/a><br \/>\n\t\t\t\t<a href=\"https:\/\/www.iss.ai\/wp-content\/uploads\/2009\/07\/4missile_pod.zip\">&lt;download&gt;4missile_pod<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u25a0Solid Works API\u3000\u305d\u306e\uff12\u3000\uff13\u6b21\u5143\u30c7\u30fc\u30bf\u306e\u53d6\u5f97 \u30fb\uff13\u6b21\u5143\u30c7\u30fc\u30bf\u306e\u53d6\u5f97 \u305b\u3063\u304b\u304f\u30e2\u30c7\u30eb\u3092\u4f5c\u6210\u3057\u305f\u306e\u3060\u304b\u3089\u3001\u4f55\u304b\u306b\u4f7f\u3048\u306a\u3044\u304b\u3068\u601d\u3063\u305f\u306e\u3060\u304c\u3001 Solid Works\u304c\u4fdd\u5b58\u3067\u304d\u308b\u30d5\u30a1\u30a4\u30eb\u5f62\u5f0f\u306f\u3069\u308c\u3082\u518d\u5229\u7528\u304c\u96e3\u3057\u3044 [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[13],"class_list":["post-791","post","type-post","status-publish","format-standard","hentry","category-tech","tag-solidworks"],"_links":{"self":[{"href":"https:\/\/www.iss.ai\/index.php?rest_route=\/wp\/v2\/posts\/791","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.iss.ai\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.iss.ai\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.iss.ai\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.iss.ai\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=791"}],"version-history":[{"count":68,"href":"https:\/\/www.iss.ai\/index.php?rest_route=\/wp\/v2\/posts\/791\/revisions"}],"predecessor-version":[{"id":915,"href":"https:\/\/www.iss.ai\/index.php?rest_route=\/wp\/v2\/posts\/791\/revisions\/915"}],"wp:attachment":[{"href":"https:\/\/www.iss.ai\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=791"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iss.ai\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=791"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iss.ai\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=791"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}