[拜求]关于VB与AutoCAD的开发的问题!
用VB开发AutoCAD2004<BR>如何设定图形中:<BR>1 直线的线宽<BR>2 文字的字体<BR>关于字体 小弟写的是这样<BR>AcadDoc.TextStyles.Add "宋体"<BR>AcadDoc.TextStyles("宋体").fontFile = "宋体"<BR>AcadDoc.ActiveTextStyle = AcadDoc.TextStyles("宋体")在AutoCAD R14或2000版本下能正常运行 但是到了2002和2004版本下 <BR>第2句就不能执行
那位大哥帮帮小弟 给小弟代码<BR>小弟先谢了 HELP ME
呜呜 再次拜谢 使用TTF字体应该使用SetFont。 先谢谢楼上的大哥
不过您说的我有点不大明白
我的程序是这样写的
Public AcadApp As AcadApplication<BR>Public AcadPre As AcadPreferences<BR>Public AcadDoc As AcadDocument<BR>Public AcadPaS As AcadPaperSpace<BR>Public AcadMoS As AcadModelSpace
Public Sub cmdlinkCAD()
On Error Resume Next<BR>Set AcadApp = GetObject(, "AutoCAD.Application")<BR>If Err Then<BR> Err.Clear<BR> Set AcadApp = CreateObject("AutoCAD.Application")<BR> If Err Then<BR> MsgBox "²»ÄÜÔËÐÐAutoCAD!" & Err.Description<BR> Exit Sub<BR> End If<BR>End If
Set AcadPre = AcadApp.Preferences<BR>Set AcadDoc = AcadApp.ActiveDocument<BR>Set AcadPaS = AcadDoc.PaperSpace<BR>Set AcadMoS = AcadDoc.ModelSpace
AcadApp.Visible = True
End Sub
Public Sub cmdRunCAD()
Dim insPnt(0 To 2) As Double<BR>insPnt(0) = 2<BR>insPnt(0) = 4<BR>insPnt(0) = 0<BR>Dim texthgt As Double<BR>Dim textstr As String<BR>textstr = "Auto CAD Automation"<BR>texthgt = 1#<BR>Call AcadMoS.AddText(textstr, insPnt, texthgt)<BR>Call AcadMoS.AddLine(insPnt, insPnt)<BR>'Call AcadMoS.AddArc(insPnt, insPnt)<BR>Call AcadMoS.AddEllipse(insPnt, texthgt, 1)<BR>Call AcadMoS.AddCircle(insPnt, texthgt)
End Sub
cmdlinkCAD<BR>Dim insPnt(0 To 2) As Double<BR>Dim insPnt1(0 To 2) As Double<BR>Dim insPnt2(0 To 2) As Double
AcadDoc.TextStyles.Add "宋体"<BR>'AcadDoc.TextStyles("宋体").fontFile = "宋体"<BR>AcadDoc.ActiveTextStyle = AcadDoc.TextStyles("宋体")<BR>Dim texthgt As Double<BR>texthgt = 400
insPnt(0) = 79650: insPnt(1) = 3600: insPnt(2) = 0<BR>Call AcadMoS.AddText("文字", insPnt, texthgt)
然后编译到AcadDoc.TextStyles("宋体").fontFile = "宋体"
这句就出现错误
麻烦能帮改一下或说具体点吗?
拜谢 写成
AcadDoc.TextStyles("宋体").SetFont = "宋体"
的话,编译时提示.SetFont参数不可选
555555555555 建议你先看看对象模型 多谢版主指点
万分感谢
页:
[1]