8 Replies Latest reply on Jul 14, 2018 5:01 PM by Laurent Franco Sánchez

    Exit Sketch from a Macro Feature - how to ?

    Laurent Franco Sánchez

      Dear all,


      I've a macro feature who changes the size of a sketch text. It's works fine. But at the end, I want to exit the sketch and neither InsertSketch or EditRebuild3 works.

       

      The part of the Rebuild Function :

      Function swmRebuild(vrApp As Variant, vrPart As Variant, vrFeature As Variant) As Variant
      
      
          Dim App     As Object 'SldWorks.SldWorks
          Dim Doc     As Object 'SldWorks.ModelDoc2
          Dim SelMgr  As SelectionMgr
          Dim text    As SketchText
          Dim format  As TextFormat
      
      
          'Recovering SolidWorks objects
          Set App = Application.SldWorks 'vrApp
          Set Doc = App.ActiveDoc 'vrPart
          'Set swMacroFeature = vrFeature
      
      
          'Resizing the text
          Set SelMgr = Doc.SelectionManager
          Doc.Extension.SelectByID2 "Sketch7", "SKETCH", 0, 0, 0, False, 0, Nothing, 0
          Doc.EditSketchOrSingleSketchFeature
          Doc.Extension.SelectByID2 "SketchText1", "SKETCHTEXT", 0, 0, 0, False, 0, Nothing, 0
          Set text = SelMgr.GetSelectedObject6(1, -1)
          Set format = text.GetTextFormat
          format.CharHeight = Doc.Parameter("D1@Fillet3").SystemValue / 1.5
          text.SetTextFormat False, format
          Doc.ClearSelection2 True
          Doc.SketchManager.InsertSketch True 'don't works
          Doc.EditRebuild3 'don't works
      
          swmRebuild = True
      
      
      End Function
      

       

      If you have any clue, I take it.

       

      Thanks,

      Laurent