VB编程怎么控制CAD画图,我要用VB语言实现新建CAD图形,并画出图形 具体代码是什么,VB如何实现自动标注
比如我要打开CAD并画一个(100,100)-(1000,1000)的直线代码怎么写若是我VB已经在PICTURE里画了线段,能直接转为CAD吗...
比如我要打开CAD并 画一个 (100,100)-(1000,1000)的直线 代码怎么写 若是我VB已经在PICTURE里画了线段,能直接转为CAD吗
展开
2个回答
展开全部
先在 工程-引用 里面增加 aucocad类型库然后写代码如下:
Private Sub Command1_Click()
Dim p1(2) As Double, p2(2) As Double, p3(2) As Double
Dim acad As AcadApplication
Dim adoc As AcadDocument
Dim aline As acadline
Dim dima As AcadDimAligned
Set acad = CreateObject("autocad.application.16")
acad.Visible = True
Set adoc = acad.Documents.Add
p1(0) = 100: p1(1) = 100: p1(2) = 0
p2(0) = 1000: p2(1) = 1000: p2(2) = 0
p3(0) = 500: p3(1) = 520: p3(2) = 0
Set aline = adoc.ModelSpace.addline(p1, p2)
aline.Color = acblue
Set dima = adoc.ModelSpace.AddDimAligned(p1, p2, p3)
dima.TextHeight = 15
dima.TextColor = acGreen
dima.ArrowheadSize = 10
End Sub
Private Sub Command1_Click()
Dim p1(2) As Double, p2(2) As Double, p3(2) As Double
Dim acad As AcadApplication
Dim adoc As AcadDocument
Dim aline As acadline
Dim dima As AcadDimAligned
Set acad = CreateObject("autocad.application.16")
acad.Visible = True
Set adoc = acad.Documents.Add
p1(0) = 100: p1(1) = 100: p1(2) = 0
p2(0) = 1000: p2(1) = 1000: p2(2) = 0
p3(0) = 500: p3(1) = 520: p3(2) = 0
Set aline = adoc.ModelSpace.addline(p1, p2)
aline.Color = acblue
Set dima = adoc.ModelSpace.AddDimAligned(p1, p2, p3)
dima.TextHeight = 15
dima.TextColor = acGreen
dima.ArrowheadSize = 10
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询