0 Replies Latest reply on Feb 5, 2015 12:08 AM by Joecel Torres

    SketchManager:: MakeSketchBlockFromFile returns null

    Joecel Torres

      Hello Everyone,

      After executing the following code, the block is successfully inserted on the drawing file.

      MathUtility mathUtil = (MathUtility)swApp.GetMathUtility();
      SketchManager sktMngr = swDocModel.SketchManager; 
      MathPoint mathPt;
      BlockDefinition blockDef;
      mathPt = (MathPoint)mathUtil.CreatePoint(new double[3] { .265 * scale[1], blockY * scale[1], 0 });
      blockDef = (BlockDefinition)sktMngr.MakeSketchBlockFromFile(mathPt, @"C:\Solidworks Common\blocks\W3.SLDBLK", false, .5, 0);
      

       

      Problem: blockDef is null even if the block was successfully inserted.

      What is the possible cause of this problem?

       

      Hoping anyone could help.

      Thanks in advance.

       

      Best regard,

      Joecel