VBA中插入图块
如何在VBA中实现:在当前图形中直接插入存储在电脑中的图块?这个在LISP中很容易实现,在VBA中我想了很久,不知道如何实现,请各位高手指导指导!! '首先需引用AutoCAD/ObjectDBX,方法是vbaide窗口中工具--->引用--->选中AutoCAD/ObjectDBX。。。后确定Dim objDbx
Dim blkName1 As String
Dim dwgName1 As String
Dim objBlk(0) As Object, objBlk1(0) As Object
Dim pnt1(2) As Double
Set objDbx = CreateObject("ObjectDBX.AxDbDocument.16")
blkName1 = "CenterHole1" '引用块的名称
dwgName1 = "路径\图名.dwg"
objDbx.Open dwgName1
pnt1(0) = : pnt1(1) =: pnt1(2) = '定义插入点
Set objBlk(0) = objDbx.Blocks(blkName1)
objDbx.CopyObjects objBlk, ThisDrawing.ModelSpace
ThisDrawing.ModelSpace.InsertBlock pnt1, blkName1, 1 / ratio, 1 / ratio, 1 / ratio, 0 'ratio为比例因子,事先自己设定好 使用insertblock函数,具体可查看帮助 占个座,一窍不通 1楼正解! 帮顶!
页:
[1]