Selecting the insert point of a block in vba

Selecting the insert point of a block in vba

Anonymous
Not applicable
818 Views
4 Replies
Message 1 of 5

Selecting the insert point of a block in vba

Anonymous
Not applicable
I have managed to work out the inserting of a block using:
Dim insertionPnt(0 To 2) As Double
Dim blockRefObj As AcadBlockReference

Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, "c:\windows\dv1a.dwg", 1#, 1#, 1#, 0)
ZoomAll

but I want to allow the user to click the screen for the location. Any help would be appreciated.
cheers
Richard
0 Likes
819 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
use thisdrawing.utitilty.getpoint()
method


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
have managed to work out the inserting of a block using:

    Dim insertionPnt(0 To 2) As Double

    Dim blockRefObj As AcadBlockReference

Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt,
"c:\windows\dv1a.dwg", 1#, 1#, 1#, 0)
    ZoomAll

but I want to allow the user to click the screen for the location. Any help
would be appreciated.
cheers
Richard

0 Likes
Message 3 of 5

Anonymous
Not applicable
this is where VBA really has its
shortcommings.

 

this will work for you

 

Dim name As String
name =
"P:\STDS\SYM\ELEC\LIGHTS\El2x4.dwg"
ThisDrawing.ActiveDocument.SendCommand
("Ortho on " & vbCrLf & "-INSERT " & name & vbCrLf &
"(command pause 1 1)" & vbCrLf & "(command pause 1
1)")
        

this is really using the command line to start the
block insert command.

The variable name is the name of the block you want
to insert.

I used an example from my office, change it to the
block you want

 

I don't know why this has not been fixed. Such a
common function can't really be completed in VBA.(or VB)

 

 

       


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

use thisdrawing.utitilty.getpoint()
method


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
have managed to work out the inserting of a block using:

    Dim insertionPnt(0 To 2) As Double

    Dim blockRefObj As AcadBlockReference

Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt,
"c:\windows\dv1a.dwg", 1#, 1#, 1#, 0)
    ZoomAll

but I want to allow the user to click the screen for the location. Any
help would be appreciated.
cheers

Richard

0 Likes
Message 4 of 5

Anonymous
Not applicable
Hi,

Another approach is to pick the point with a GETPOINT command, then put the
block in the drawing at that point.

The disadvantage of this approach is that you can't see an outline of the
block while you pick the insert point.

--




Laurie Comerford
CADApps
www.cadapps.com.au



"Mike Daugird" wrote in message
news:8E388044B68CE828378E5963B62D577F@in.WebX.maYIadrTaRb...
> this is where VBA really has its shortcommings.
>
> this will work for you
>
> Dim name As String
> name = "P:\STDS\SYM\ELEC\LIGHTS\El2x4.dwg"
> ThisDrawing.ActiveDocument.SendCommand ("Ortho on " & vbCrLf & "-INSERT "
& name & vbCrLf & "(command pause 1 1)" & vbCrLf & "(command pause 1 1)")
>
>
> this is really using the command line to start the block insert command.
> The variable name is the name of the block you want to insert.
> I used an example from my office, change it to the block you want
>
> I don't know why this has not been fixed. Such a common function can't
really be completed in VBA.(or VB)
>
>
>
> "Jaime" wrote in message
news:C7ACF4A2B8855F97931DC437C3E11B5B@in.WebX.maYIadrTaRb...
> use thisdrawing.utitilty.getpoint() method
> "richardm73" wrote in message
news:f0a54bd.-1@WebX.maYIadrTaRb...
> I have managed to work out the inserting of a block using:
> Dim insertionPnt(0 To 2) As Double
> Dim blockRefObj As AcadBlockReference
> Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt,
"c:\windows\dv1a.dwg", 1#, 1#, 1#, 0)
> ZoomAll
>
> but I want to allow the user to click the screen for the location. Any
help would be appreciated.
> cheers
> Richard
>
>
0 Likes
Message 5 of 5

Anonymous
Not applicable


Did everyone miss this post? is there any reason this wouldn't work for
you?

Jaime wrote:

 use thisdrawing.utitilty.getpoint()
method

0 Likes