Insert block problem

Discussion in 'AutoCAD' started by annef0603, Aug 18, 2003.

  1. annef0603

    annef0603 Guest

    Hi -

    I created a drawing file with wblock (source set to block). Now I want to programatically insert the block from an icon on a toolbar. I am using the following code to insert the block:

    Dim acBlockRef As AcadBlockReference
        Dim dInsPt(0 To 2) As Double
        Dim vPoint As Variant
        Dim blockname As String

    blockname = "c:\LanpakBlock.dwg"

    'get insertion point from user
        vPoint = ThisDrawing.Utility.GetPoint(, "Select insertion point")
        dInsPt(0) = vPoint(0)
        dInsPt(1) = vPoint(1)
        dInsPt(2) = vPoint(2)

    'insert geometry
        Set acBlockRef = ThisDrawing.ModelSpace.InsertBlock(dInsPt, blockname, 1, 1, 1, 0)

    I let the user select the insertion point with the mouse but the block is not being inserted at that point. How can I get the block to be inserted at the point the user picked?

    Thanks for any help...
     
    annef0603, Aug 18, 2003
    #1
  2. annef0603

    arsnik91 Guest

    I had set this up a while back and there may be better ways to do it but have a look.
    TOOLBAR BUTTON: ^C^C_-vbarun;RevTri
    VBA CODE:
    Sub RevTri()

    ''Inserts the Revision Triangle Block

    ThisDrawing.SendCommand "-insert" & vbCr & "rev_tri" & vbCr

    End Sub

    My Rev_Tri block is in a directory in the search path. I access this group via the Web page so the text seems to wrap funny on my posts.
     
    arsnik91, Aug 18, 2003
    #2
  3. annef0603

    annef0603 Guest

    Thanks - that worked perfectly....
     
    annef0603, Aug 19, 2003
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.