tsxvvv 发表于 2003-5-21 16:18:00

sos-->mccad转移

请问各位:怎样才能用VBA程序在cad中加在以图块(全部用VBA代码)

mccad 发表于 2003-5-21 17:46:00

你想插入外部图形还是图形中的图块?

tsxvvv 发表于 2003-5-23 09:44:00

SOS

是外部图形啊!!!

china-hz 发表于 2003-5-23 13:06:00

此帮助

Sub Example_InsertBlock()
    ' This example creates a block containing a circle.
    ' It then inserts the block.

    ' Create the block
    Dim blockObj As AcadBlock
    Dim insertionPnt(0 To 2) As Double
    insertionPnt(0) = 0#: insertionPnt(1) = 0#: insertionPnt(2) = 0#
    Set blockObj = ThisDrawing.Blocks.Add(insertionPnt, "CircleBlock")
   
    ' Add a circle to the block
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 0: center(1) = 0: center(2) = 0
    radius = 1
    Set circleObj = blockObj.AddCircle(center, radius)
   
    ' Insert the block
    Dim blockRefObj As AcadBlockReference
    insertionPnt(0) = 2#: insertionPnt(1) = 2#: insertionPnt(2) = 0
    Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, "CircleBlock", 1#, 1#, 1#, 0)
   
    ZoomAll
   
End Sub

china-hz 发表于 2003-5-23 13:08:00

如是外部图形,将"CircleBlock",改成"图形文件名及其完整路径"即可

tsxvvv 发表于 2003-5-25 14:32:00

谢谢!

谢谢你!!
在将“CircleBlock"改写萎所需“图形文件名及路径”时,需不需要引号阿??
页: [1]
查看完整版本: sos-->mccad转移