Loading Blocks

Discussion in 'AutoCAD' started by srinivasan, Nov 12, 2004.

  1. srinivasan

    srinivasan Guest

    Hello all

    How to load a drawing file as a block in to the drawing (The browse method.)

    I tried with the dwg path in the block name but it doesnt support it.

    Thanks in advance.
    Sri
     
    srinivasan, Nov 12, 2004
    #1
  2. srinivasan

    Jackrabbit Guest

    Here's a snippet of code that is working for me:
    [pre]
    ' Open the template drawing
    ThisDrawing.Application.Documents.Open Name:=OLPTemplateDwg, ReadOnly:=True
    ThisDrawing.Application.ZoomAll

    ' Insert the package drawing in model space and explode it.
    InsertPoint(X) = 0#
    InsertPoint(Y) = 0#
    InsertPoint(Z) = 0#

    ThisDrawing.MSpace = True

    Set PkgDrawing = ThisDrawing.ModelSpace.InsertBlock _
    (InsertPoint, strPackageFile, 1, 1, 1, 0)

    Entities = PkgDrawing.Explode
    PkgDrawing.Delete

    ThisDrawing.Application.ZoomExtents
    [/pre]


    Note: the variable strPackageFile contains the full name of an AutoCAD drawing that the user selected from a common dialog.

    Example: "D:\MyFiles\Test.dwg"
     
    Jackrabbit, Nov 12, 2004
    #2
  3. srinivasan

    srinivasan Guest

    Thanks Jack

    Sri
     
    srinivasan, Nov 15, 2004
    #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.