1 Reply Latest reply on Jan 24, 2013 4:45 PM by Artem Taturevych

    create two separates sketches

    paula caroline

      I´m having problems to create two separates sketches, with command "createline".

       

      once, I create and that´s ok. But the others it´s only created when I put command "CreateCornerRectangle" together on my createline (for the second sketch)

       

      I know this is a basic doubt....but I need that for continue my project...

       

      here´s the code:

       

      //first sketch

       

                  Part.SketchManager.InsertSketch(true);

                  vSkLines = Part.SketchManager.CreateLine(0, 0, 0, -2.18739, 0, 0);

                 

                  vSkLines = Part.SketchManager.CreateLine(-3.64316, 0, 0, -7.44239, 0, 0);

                

                  vSkLines = Part.SketchManager.CreateLine(-0.63264, 2.660, 0, -6.649, 2.660, 0);

                  Part.SketchManager.InsertSketch(true);

       

                  Part.ClearSelection2(true);

               

       

                

                 

                  //second sketch

       

                  Part.SketchManager.InsertSketch(true);

                  vSkLines = Part.SketchManager.CreateCornerRectangle(0,0.5, 0, 0.5, 0, 0);

                  vSkLines = Part.SketchManager.CreateLine(0, 0.04, 0, -5.18739, 0, 0);

                  vSkLines = Part.SketchManager.CreateLine(0, 0, 0, 0, 0.04, 0);

               

                  Part.SketchManager.InsertSketch(true);

       

                  Part.ViewZoomtofit2();

       

      So, when I take off the line: vSkLines = Part.SketchManager.CreateCornerRectangle(0,0.5, 0, 0.5, 0, 0); , on my project only shows the first sketch...

      can anyone help me

        • Re: create two separates sketches
          Artem Taturevych

          I think this is because your entities coordinates are inconsistent with current view scale/position. Try to use the ISketchManager::AddToDB in your code while working with sketch. Something like that:

           

          //first sketch

           

                      Part.SketchManager.InsertSketch(true);

                      Part.SketchManager.AddToDB = true;

                      vSkLines = Part.SketchManager.CreateLine(0, 0, 0, -2.18739, 0, 0);

           

                      vSkLines = Part.SketchManager.CreateLine(-3.64316, 0, 0, -7.44239, 0, 0);

           

                      vSkLines = Part.SketchManager.CreateLine(-0.63264, 2.660, 0, -6.649, 2.660, 0);

                      Part.SketchManager.AddToDB = false;

                      Part.SketchManager.InsertSketch(true);

           

                      Part.ClearSelection2(true);

           

           

           

           

                      //second sketch

           

                      Part.SketchManager.InsertSketch(true);

                      Part.SketchManager.AddToDB = true;

                      vSkLines = Part.SketchManager.CreateLine(0, 0.04, 0, -5.18739, 0, 0);

                      vSkLines = Part.SketchManager.CreateLine(0, 0, 0, 0, 0.04, 0);

                      Part.SketchManager.AddToDB = false;

                      Part.SketchManager.InsertSketch(true);

           

                      Part.ViewZoomtofit2();

          __________________________

          Regards,

          Artem Taturevych

          Application Engineer at Intercad

          http://intercad.com.au/

          Tel: +61 2 9454 4444