{"id":660,"date":"2024-06-14T08:56:16","date_gmt":"2024-06-14T00:56:16","guid":{"rendered":"http:\/\/www.wyrcad.com\/?p=660"},"modified":"2024-07-15T16:13:53","modified_gmt":"2024-07-15T08:13:53","slug":"%e6%93%8d%e4%bd%9c-autocad","status":"publish","type":"post","link":"https:\/\/www.wyrcad.com\/?p=660","title":{"rendered":"AutoCAD \u73af\u5883\u8bbe\u7f6e"},"content":{"rendered":"\n<p>Dim oAutoCAD As Object<br>Call BindAutoCAD(True)<\/p>\n\n\n\n<p>Dim sLayerName As String<br>Dim iColor As Integer<br>Dim sTextStyle As String<br>Dim iMode As Integer<\/p>\n\n\n\n<p>sLayerName = &#8220;\u5e73\u9762&#8221;<br>iColor = 1 &#8216;Red<br>sTextStyle = &#8220;\u6c49\u5b57&#8221;<br>iMode = 519 &#8216;\u7aef\u70b9 1 + \u4e2d\u70b9 2 + \u5706\u5fc3 4 + \u6700\u8fd1\u70b9 512<\/p>\n\n\n\n<p>Call AddLayer(sLayerName, iColor)<br>Call AddTextStyle(sTextStyleName)<br>Call SetOSMode(iMode)<\/p>\n\n\n\n<p>Public Sub AddLayer(sLayerName As String, iColor As Integer) &#8216;\u589e\u52a0\u56fe\u5c42<br>Dim oLayer As Object<br>Set oLayer = oAutoCAD.ActiveDocument.Layers.Add(sLayerName)<br>oLayer.Color = iColor<br>oAutoCAD.ActiveDocument.ActiveLayer = oLayer<br>End Function<\/p>\n\n\n\n<p>Public Sub AddTextStyle(sTextStyleName As String) &#8216;\u6dfb\u52a0\u6216\u4fee\u6539\u5b57\u4f53<br>Dim oTextStyle As Object<br>Set oTextStyle = oAutoCAD.ActiveDocument.TextStyles.Add(sTextStyleName)<br>oTextStyle.BigFontFile = &#8220;hztxt.shx&#8221;<br>oTextStyle.FontFile = &#8220;romans.shx&#8221;<br>oTextStyle.Height = 8<br>oTextStyle.Width = 0.6<br>oAutoCAD.ActiveDocument.ActiveTextStyle = oTextStyle<br>End Function<\/p>\n\n\n\n<p>Public Sub SetOSMode(ByVal iMode As Integer) &#8216;\u8bbe\u7f6e\u5bf9\u8c61\u6355\u6349\u6a21\u5f0f<br>oDraw.SetVariable &#8220;OSMODE&#8221;, iMode<br>&#8216;\u4f7f\u7528\u4ee5\u4e0b\u4f4d\u7801\u8bbe\u7f6e\u201c\u5bf9\u8c61\u6355\u6349\u201d\u7684\u6a21\u5f0f(OSNAP mode)\uff1a<br>&#8216;0 NON (\u65e0)<br>&#8216;1 END\uff08\u7aef\u70b9\uff09<br>&#8216;2 MID\uff08\u4e2d\u70b9\uff09<br>&#8216;4 CEN (\u5706\u5fc3)<br>&#8216;8 NOD (\u8282\u70b9)<br>&#8217;16 QUA (\u8c61\u9650\u70b9)<br>&#8217;32 INT\uff08\u4ea4\u70b9\uff09<br>&#8217;64 INS (\u63d2\u5165\u70b9)<br>&#8216;128 PER (\u5782\u8db3)<br>&#8216;256 Tan (\u5207\u70b9)<br>&#8216;512 NEA (\u6700\u8fd1\u70b9)<br>&#8216;1024 QUI (\u5feb\u901f)<br>&#8216;2048 App (\u5916\u89c2\u4ea4\u70b9)<br>&#8216;4096 EXT (\u5c3a\u5bf8\u7ebf)<br>&#8216;8192 PAR (\u5e73\u884c)<br>&#8216;\u8981\u6307\u5b9a\u591a\u4e2a\u5bf9\u8c61\u6355\u6349\u65b9\u5f0f\uff0c\u8bf7\u8f93\u5165\u5404\u4e2a\u4f4d\u7801\u503c\u4e4b\u548c\u3002<br>End Sub<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Dim oAutoCAD As ObjectCall BindAutoCAD(True) Dim sLayer &hellip; <a href=\"https:\/\/www.wyrcad.com\/?p=660\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cAutoCAD \u73af\u5883\u8bbe\u7f6e\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-660","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\/660","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=660"}],"version-history":[{"count":13,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=\/wp\/v2\/posts\/660\/revisions"}],"predecessor-version":[{"id":1275,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=\/wp\/v2\/posts\/660\/revisions\/1275"}],"wp:attachment":[{"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=660"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=660"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=660"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}