- 积分
- 292
- 明经币
- 个
- 注册时间
- 2004-6-10
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2004-6-10 18:52:00
|
显示全部楼层
先谢谢楼上的大哥
不过您说的我有点不大明白
我的程序是这样写的
Public AcadApp As AcadApplication Public AcadPre As AcadPreferences Public AcadDoc As AcadDocument Public AcadPaS As AcadPaperSpace Public AcadMoS As AcadModelSpace
Public Sub cmdlinkCAD()
On Error Resume Next Set AcadApp = GetObject(, "AutoCAD.Application") If Err Then Err.Clear Set AcadApp = CreateObject("AutoCAD.Application") If Err Then MsgBox "²»ÄÜÔËÐÐAutoCAD!" & Err.Description Exit Sub End If End If
Set AcadPre = AcadApp.Preferences Set AcadDoc = AcadApp.ActiveDocument Set AcadPaS = AcadDoc.PaperSpace Set AcadMoS = AcadDoc.ModelSpace
AcadApp.Visible = True
End Sub
Public Sub cmdRunCAD()
Dim insPnt(0 To 2) As Double insPnt(0) = 2 insPnt(0) = 4 insPnt(0) = 0 Dim texthgt As Double Dim textstr As String textstr = "Auto CAD Automation" texthgt = 1# Call AcadMoS.AddText(textstr, insPnt, texthgt) Call AcadMoS.AddLine(insPnt, insPnt) 'Call AcadMoS.AddArc(insPnt, insPnt) Call AcadMoS.AddEllipse(insPnt, texthgt, 1) Call AcadMoS.AddCircle(insPnt, texthgt)
End Sub
cmdlinkCAD Dim insPnt(0 To 2) As Double Dim insPnt1(0 To 2) As Double Dim insPnt2(0 To 2) As Double
AcadDoc.TextStyles.Add "宋体" 'AcadDoc.TextStyles("宋体").fontFile = "宋体" AcadDoc.ActiveTextStyle = AcadDoc.TextStyles("宋体") Dim texthgt As Double texthgt = 400
insPnt(0) = 79650: insPnt(1) = 3600: insPnt(2) = 0 Call AcadMoS.AddText("文字", insPnt, texthgt)
然后编译到AcadDoc.TextStyles("宋体").fontFile = "宋体"
这句就出现错误
麻烦能帮改一下或说具体点吗?
拜谢 |
|