How can I insert a DWG-File into an existing DWG-file as a block?

Hello,
I am new here and have a question, that makes me cracy.

I am going on to to develope a little tool for inserting Survey-Points into a DWG.
Therefore I built some Symbol-DWGs (this I want use for Insertion) with Attributes. Now I want insert this symbol-dwg into an existing drawing in this way, that it is available as block.
I tried this:

Dim blkObj As AcadBlock = Nothing 'Block for Symbol
blkObj = actDOC.Blocks.Add(insPtBlk, sFileName) 'actDoc is the Activedocument
blkObj.name="Test"

The blockname "Test" appears in the blockdefinitions, but the block itself has NOTHING (no objects or Attributes, that I have defined in the Symbol-DWG).

Thank you for help.

Hans

Comments

  • Use the InsertBlock method. If you don't want to create a block reference just delete it. There is an alternative way (ODBX+CopyObjects) but it is much more involved.

  • Hi Roy,
    thank you very much. It work fine and exactly this way I Need.

    Thanks

This discussion has been closed.