InsertBlock method example
Sub InsertBlock_Example()
Dim sBlockName As String
sBlockName = InputBox("Type a block name")
Dim insPt(0 To 2) As Double: insPt(0) = 4: insPt(1) = 3
Dim blockObj As AcadBlock
Set blockObj = ThisDrawing.Blocks.Add(insPt, sBlockName)
Dim myStartPt(0 To 2) As Double: myStartPt(0) = 4: myStartPt(1) = 4
Dim myEndPt(0 To 2) As Double: myEndPt(0) = 7: myEndPt(1) = 1
blockObj.AddLine myStartPt, myEndPt
Dim cenPt(0 To 2) As Double: cenPt(0) = 3: cenPt(1) = 4
Dim dRadius As Double: dRadius = 1
blockObj.AddCircle cenPt, dRadius
Dim blockRefObj As AcadBlockReference
Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insPt, sBlockName, 1, 1, 1, 0)
MsgBox "The block " & sBlockName & " has been inserted."
End Sub
© Bricsys NV. All rights reserved. |