5 Replies Latest reply on Dec 4, 2017 5:08 AM by Nilesh Patel

    runtime error 424 while CreateCenterRectangle

    Raumik Rana

      Dim swApp As SldWorks.SldWorks

      Dim part As SldWorks.ModelDoc2

      Dim boostatus As Boolean

      Dim longWarnings As Long, longstatus As Long

      Dim swSM As SldWorks.SketchManager

      Dim swSegment As SldWorks.SketchSegment

       

       

      Sub main()

       

       

      Set swApp = Application.SldWorks

       

       

      Set part = swApp.NewDocument("C:\ProgramData\SOLIDWORKS\SOLIDWORKS 2016\templates\Part.prtdot", 0, 0, 0)

      boolstatus = part.SelectByID("FRONT PLANE", "Plane", 0, 0, 0)

      part.SketchManager.InsertSketch True

       

       

      Set swSM = part.SketchManager

      Set swSegment = swSM.CreateCenterRectangle(0, 0, 0, 1, 1, 0)

       

      End Sub

       

       

      when I am trying to createcenterrectangle using this code i get error message runtime eror '424'.

      Please help me to find out what's wrong in this code.