2 Replies Latest reply on Jan 2, 2014 5:54 PM by Christoph Neundorf

    Drawing: create new instances of inserted sketch blocks

    Christoph Neundorf

      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