[求助]急!求助!关于在VBA中使用ACAD命令行的问题
本人用以下两种方法欲使用ACAD命令行建立虚线图层可是没有成功,不知道问题所在,
请高手指教,帮忙!谢谢!<BR>一,
ThisDrawing.SendCommand "-layer m 1 c 2 1 l acad_iso10w100 1 "
二,<BR>ThisDrawing.SendCommand "-layer "<BR>ThisDrawing.SendCommand "m "<BR>ThisDrawing.SendCommand "1 "<BR>ThisDrawing.SendCommand ""<BR>ThisDrawing.SendCommand "c "<BR>ThisDrawing.SendCommand " "<BR>ThisDrawing.SendCommand "2 "<BR>ThisDrawing.SendCommand " "<BR>ThisDrawing.SendCommand "1 "<BR>ThisDrawing.SendCommand " "<BR>ThisDrawing.SendCommand "l "<BR>ThisDrawing.SendCommand "acad_iso10w100 "<BR>ThisDrawing.SendCommand "1"<BR>ThisDrawing.SendCommand " "<BR> acad_iso10w100 还没有加载吧? 行吗?怎样加载? 你使用如下方法:
Public Function SetCurLinetype(ByVal LineTypeName As String, ByVal strFile As String)<BR>On Error goto hangc' trap any load errors<BR>AcadDoc.Linetypes.Load LineTypeName, strFile '"acadiso.lin"<BR>'=====================================================<BR>Dim entry As Variant, found As Boolean<BR>Dim newLineType As Variant<BR>For Each entry In AcadDoc.Linetypes<BR> If StrComp(entry.Name, LineTypeName, 1) = 0 Then<BR> Set newLineType = entry<BR> AcadDoc.ActiveLinetype = newLineType<BR> Exit For<BR> End If<BR>Next
exit function
hangc:
msgbox err<BR>End Function
调用方法:
Dim curLineType As Variant<BR>Set curLineType = AcadDoc.ActiveLinetype<BR>SetCurLinetype "acad_iso10w100 ", "acadiso.lin" 本帖最后由 作者 于 2005-5-7 19:20:27 编辑
谢谢了!可是上面的方法由于我是新手,感觉很麻烦,很难理解,我就想用我的那种方法,可以吗?哪位高手能指教一下啊?非常感谢!! 怎么没有人回答了,我急啊! Dim entry As AcadLineType<BR> Dim found As Boolean<BR> found = False<BR> For Each entry In ThisDrawing.Linetypes<BR> If StrComp(entry.Name, "ACAD_ISO10W100", 1) = 0 Then<BR> found = True<BR> Exit For<BR> End If<BR> Next<BR> If Not (found) Then ThisDrawing.Linetypes.Load "ACAD_ISO10W100", "acad.lin"<BR> 我要的不是这个程序,而是我我最上面的那种方法能不能行的通?明经的高手在哪啊? 郁闷!!!! 7楼的是加载线型程序,如果没有加载过,当然需要这一步。我看1楼的格式也不对,当然不能正常运行。
Sub test()<BR> Dim entry As AcadLineType<BR> Dim found As Boolean<BR> found = False<BR> For Each entry In ThisDrawing.Linetypes<BR> If StrComp(entry.Name, "ACAD_ISO10W100", 1) = 0 Then<BR> found = True<BR> Exit For<BR> End If<BR> Next<BR> If Not (found) Then ThisDrawing.Linetypes.Load "ACAD_ISO10W100", "acad.lin"
<BR>ThisDrawing.SendCommand "-layer" & vbCr & "m" & vbCr & "1" & vbCr & "c" & vbCr & "2" _<BR> & vbCr & "1" & vbCr & "l" & vbCr & "acad_iso10w100" & vbCr & "1" & vbCr & "" & vbCr
<BR>End Sub
页:
[1]
2