vb block insert

vb block insert

Anonymous
Not applicable
485 Views
4 Replies
Message 1 of 5

vb block insert

Anonymous
Not applicable
When I insert a block using the following code in paper space the block does not appear. Work fine in model space. Does anyone have any ideas?

' Insert the block

Dim InsertPnt As Variant
Dim prompt1 As String

prompt1 = vbCrLf & "Enter the Insertion point for the Titleblock: "



'user defines insertion point

InsertPnt = ThisDrawing.Utility.GetPoint(, prompt1)

Dim blockRefObj As AcadBlockReference

Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(InsertPnt, "K:\Autodesk\AutoCAD\TEMPLATES\Howden_Standard_B.dwg", 1#, 1#, 1#, 0)

ZoomExtents 'Zoom extents on the drawing
0 Likes
486 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
I figured out my mistake.
0 Likes
Message 3 of 5

Anonymous
Not applicable
What was the mistake?

I am experiencing the same problem.
0 Likes
Message 4 of 5

Anonymous
Not applicable
Look at the following:

If ThisDrawing.ActiveSpace = acModelSpace Then
Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock ....
Else
Set blockRefObj = ThisDrawing.PaperSpace.InsertBlock ....
End If
0 Likes
Message 5 of 5

arcticad
Advisor
Advisor
You can also simplify the code.

Set blockRefObj = ThisDrawing.GetSpace.InsertBlock ....

[code]
Function GetSpace() As Variant
If IsModelspace Then
Set GetSpace = ThisDrawing.ModelSpace
Else
Set GetSpace = ThisDrawing.PaperSpace
End If
End Function

Public Function IsModelspace() As Boolean
Dim document As AcadDocument
For Each document In Documents
If document.Active = True Then
If document.ActiveSpace = acPaperSpace Then
IsModelspace = document.MSpace
Exit For
Else
IsModelspace = True
Exit For
End If
End If
Next
End Function

[/code]
---------------------------



(defun botsbuildbots() (botsbuildbots))
0 Likes