Drawing: create new instances of inserted sketch blocks

Hi all,

i'm trying to create new instances of an already inserted sketch block (Block.sldblk) on a drawing.

But unfortunately it doesn't work yet.

Here's the snippet:

            swSketchMgr = ActiveModel.SketchManager;

            oSketchBlockDefs = (object[])swSketchMgr.GetSketchBlockDefinitions();

            foreach (object oblockDef in oSketchBlockDefs)

            {

                blockdef = (SketchBlockDefinition)oblockDef;

                string blockfilename = blockdef.FileName;

                if (blockfilename != null)

                {

                    if (blockfilename.Contains("Block.sldblk"))

                    {

                        swBlockInst = swSketchMgr.InsertSketchBlockInstance(blockdef, swMathPoint, 0, 0);

                        ActiveModel.GraphicsRedraw2();

                     }

                }

            }    

Any thoughts?

Thanks,

Christoph

SolidworksApi macros