×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How to insert a block from external drawing to current drawing?

How to insert a block from external drawing to current drawing?

How to insert a block from external drawing to current drawing?

(OP)
My intention is insert a block "B2" from a external drawing test.dwg to current drawing. The problem is the whole drawing test.dwg was inserted in the current drawing. I know I am confused with "add a reference" and "add a block" but I don't know how to solve it. Seek help. Here is my code:

Sub InsertExternalBlock()
            
    Dim InsertPoint(0 To 2) As Double
    Dim insertEXTBlock As AcadExternalReference
    Dim PathName As String
    
'Insert point
    InsertPoint(0) = 1: InsertPoint(1) = 1: InsertPoint(2) = 0
'External drawing path which contains the blocks I want to insert
    PathName = "C:\test.dwg"
    
'Add block to the drawing
    Set insertEXTBlock = ThisDrawing.ModelSpace.AttachExternalReference(PathName, "B2", InsertPoint, 1, 1, 1, 0, False)
        
    ThisDrawing.Application.ZoomAll
    
   End Sub
 

RE: How to insert a block from external drawing to current drawing?

Hi microwave2009,

Autodesk doesn't allow this via VB/VBA.  You're actually almost home with your approach.  You'll need in insert (not AttachExternalReference) the drawing test drawing to get the definition of the block B2 into the drawing, and then insert block B2.  The other option is get into your test drawing and wblock B2, and then insert B2 from it's file location.

HTH
Todd

RE: How to insert a block from external drawing to current drawing?

Are the two drawings .dwg or .dxf files?  

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close