{"id":954,"date":"2024-06-29T08:28:09","date_gmt":"2024-06-29T00:28:09","guid":{"rendered":"http:\/\/www.wyrcad.com\/?p=954"},"modified":"2024-07-02T11:40:47","modified_gmt":"2024-07-02T03:40:47","slug":"autocad-%e5%88%a4%e6%96%ad%e5%9b%be%e5%85%83%e4%ba%a4%e7%82%b9","status":"publish","type":"post","link":"https:\/\/www.wyrcad.com\/?p=954","title":{"rendered":"AutoCAD \u5224\u65ad\u56fe\u5143\u4ea4\u53c9"},"content":{"rendered":"\n<p>&#8216;\u672c\u4f8b\u6f14\u793a\u5224\u65ad\u4e24\u4e2a\u56fe\u5143\u662f\u5426\u4ea4\u53c9\uff1f\u6709\u51e0\u4e2a\u4ea4\u70b9\uff1f\u4ea4\u70b9\u5750\u6807\u5206\u522b\u662f\u4ec0\u4e48\uff1f<\/p>\n\n\n\n<p>&#8216;\u7ed1\u5b9a AutoCAD<br>Dim I As Integer, J As Integer<br>Dim oAutoCAD As Object<br>Call <a href=\"https:\/\/www.wyrcad.com\/?p=618\">BindAutoCAD<\/a>(True)<\/p>\n\n\n\n<p>&#8216;\u6253\u5f00\u5e76\u7ed1\u5b9a\u6587\u4ef6 D:\/Test.dwg<br>Dim oDraw As Object \u2018AutoCAD \u591a\u6587\u6863\u4e4b\u4e00<br>Set oDraw = oAutoCAD.Application.Documents.Open(&#8220;D:\/Test.dwg&#8221;)<\/p>\n\n\n\n<p>&#8216;\u5efa\u7acb\u9009\u62e9\u96c6<br>Dim oSelset As Object, oItem As Object<br>Dim TempName As String<br>TempName = SelName(8)<br>If <a href=\"https:\/\/www.wyrcad.com\/?p=907\">SetExist<\/a>(oDraw, TempName) Then oDraw.SelectionSets.Item(TempName).Delete<br>Set oSelset = oDraw.SelectionSets.Add(TempName)<br>oDraw.Activate<\/p>\n\n\n\n<p>&#8216;\u5c4f\u5e55\u9009\u62e9\u591a\u4e2a\u56fe\u5143\u586b\u5165\u9009\u62e9\u96c6\uff0c\u5217\u51fa\u524d\u4e24\u4e2a\u56fe\u5143\u4e4b\u95f4\u4ea4\u70b9\u7684\u5750\u6807<br>Dim IntersectPoint As Variant<br>oSelset.SelectOnScreen<br>&#8216;Debug.Print &#8220;oSelSet.Count&#8221; &amp; Space$(1) &amp;&#8221;=&#8221; &amp; Space$(1) &amp; oSelSet.Count<br>If oSelset.Count &gt; 1 Then &#8216;\u6700\u5c11\u4e24\u4e2a,\u4f46\u53ea\u8ba4\u524d\u4e24\u4e2a<br>&#8216; Find the intersection points between the oSelSet(0) and the oSelSet(1)<br>IntersectPoint = oSelset(0).IntersectWith(oSelset(1), 0)<br>&#8216; acExtendNone Does not extend either object.<br>&#8216; acExtendThisEntity Extends the base object.<br>&#8216; acExtendOtherEntity Extends the object passed as an argument.<br>&#8216; acExtendBoth Extends both objects.<br>&#8216; Print all the intersection points<br>If VarType(IntersectPoint) &lt;&gt; vbEmpty Then<br>For I = LBound(IntersectPoint) To UBound(IntersectPoint) Step 3<br>Debug.Print &#8220;Intersection[&#8221; &amp; (I + 3) \/ 3 &amp; &#8220;\/&#8221; &amp; (UBound(IntersectPoint) &#8211; LBound(IntersectPoint) + 1) \/ 3 &amp; &#8220;]:&#8221; &amp; Space$(1) &amp; _<br>IntersectPoint(I) &amp; &#8220;,&#8221; &amp; IntersectPoint(I + 1) &amp; &#8220;,&#8221; &amp; IntersectPoint(I + 2)<br>Next I<br>Else<br>Debug.Print &#8220;No intersection points.&#8221;<br>End If<br>End If<\/p>\n\n\n\n<p>&#8216;\u89e3\u9664\u7ed1\u5b9a,\u91ca\u653e\u8d44\u6e90<br>oSelset.Delete<br>Set oSelset = Nothing<br>Set oItem = Nothing<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8216;\u672c\u4f8b\u6f14\u793a\u5224\u65ad\u4e24\u4e2a\u56fe\u5143\u662f\u5426\u4ea4\u53c9\uff1f\u6709\u51e0\u4e2a\u4ea4\u70b9\uff1f\u4ea4\u70b9\u5750\u6807\u5206\u522b\u662f\u4ec0\u4e48\uff1f &#8216;\u7ed1\u5b9a AutoCA &hellip; <a href=\"https:\/\/www.wyrcad.com\/?p=954\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cAutoCAD \u5224\u65ad\u56fe\u5143\u4ea4\u53c9\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[24,17],"class_list":["post-954","post","type-post","status-publish","format-standard","hentry","category-bianchengyuandi","tag-vb","tag-biancheng"],"_links":{"self":[{"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=\/wp\/v2\/posts\/954","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=954"}],"version-history":[{"count":8,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=\/wp\/v2\/posts\/954\/revisions"}],"predecessor-version":[{"id":1020,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=\/wp\/v2\/posts\/954\/revisions\/1020"}],"wp:attachment":[{"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=954"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=954"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=954"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}