4 Replies Latest reply on Jul 10, 2014 12:51 PM by Rejo Jayaraj

    SketchTrim & SelectById

    Rejo Jayaraj

      Hello guys,

       

      I am facing a wierd issue with the SketchTrim. Each time I try to trim the select lines in the sketch, most the time the lines are not selected through SelectById method. However I observed that whenever the screen is zoomed in/out the selection sometimes works. Sometime on reopening the session the script works fine. Does anyone have any idea what am i missing in the code.

       

      Thanks & Regards,

      Rejo

        • Re: SketchTrim & SelectById
          Artem Taturevych

          Try avoid selecting the objects using SelectByID2 - as you have noted it is view dependent. Use direct selection methods like ISketchSegment::Select4 instead.

            • Re: SketchTrim & SelectById
              Rejo Jayaraj

              Hello Artem, thanks for your reply. I now realise why my whole script reatcts in a wierd mannr.

               

              Here is the reason why I am trying to use SelectById2 rather than Select4. I am trying to trim between a  line which is a last segment created in the sketch and anther line which is created newly. Since SelectByID2 helps to choose the sides which i want the end trim result to be I use this approach rather than select4. Below shown is the piece of the code I have for the trim. The first SelectByID helps me to select the segement which is alreayd there in the sketch and the second it selects the line which I have just created. Is there a way I could use Select4 and still determine the side to be trimmed. Could you please suggest me an alternative solution if this approach is not an optimum one.

               

               

               

                      Set vsklines_1 = mymodel.SketchManager.CreateLine((Xend / 39.37), (Ymin_end / 39.37), 0, (Xend / 39.37), (Yend / 39.37), 0)

                      boolstatus = mymodel.Extension.SelectByID2("", "SKETCHSEGMENT", (X_midseg), (Y_midseg), 0, True, 0, Nothing, 0)

                      boolstatus = mymodel.Extension.SelectByID2("", "SKETCHSEGMENT", (X_midline2), ((Y_midline2)), 0, True, 0, Nothing, 0)

                      boolstatus = mymodel.SketchManager.SketchTrim(1, 0, 0, 0)

               

              Thanks & Regards,

              Rejo Jayaraj