2 Replies Latest reply on Oct 14, 2014 2:17 AM by Pranjal Jamsandekar

    Need a little help in the created macro for the fillet.

    Pranjal Jamsandekar

      Having issue in creating the fillet as shown in below image. I need a urgent help.

      Aslo I am giving the macro code created for the same below image.

       

      Dim swApp As SldWorks.SldWorks
      Dim swModel As SldWorks.ModelDoc2
      Dim swSketchMgr As SldWorks.SketchManager
      Dim swSketchSeg As SldWorks.SketchSegment
      Dim swLine(34) As SldWorks.SketchLine

      Sub main()
          Set swApp = Application.SldWorks
          Set swModel = swApp.ActiveDoc
          Set swSketchMgr = swModel.SketchManager
         
          'insert oring profile and create plane
          swModel.Extension.SelectByID2 "ToP Plane", "PLANE", 0, 0, 0, False, 0, Nothing, 0
          swSketchMgr.InsertSketch True

          'turn on direct addition to database
          swSketchMgr.AddToDB = True

          Set swLine(0) = swSketchMgr.CreateLine(0.22501, -0.02029, 0, 0.22501, 0.02029, 0)
          Set swLine(1) = swSketchMgr.CreateLine(0.22501, 0.02029, 0, 0.20229, 0.04225, 0)
          Set swLine(2) = swSketchMgr.CreateLine(0.20229, 0.04225, 0, 0.18946, 0.04225, 0)
          Set swLine(3) = swSketchMgr.CreateLine(0.18946, 0.04225, 0, 0.18514, 0.03305, 0)
          Set swLine(4) = swSketchMgr.CreateLine(0.18514, 0.03305, 0, 0.17625, 0.02857, 0)
          Set swLine(5) = swSketchMgr.CreateLine(0.17625, 0.02857, 0, 0.17625, 0.01275, 0)
          Set swLine(6) = swSketchMgr.CreateLine(0.17625, 0.01275, 0, 0.15375, 0.01275, 0)
          Set swLine(7) = swSketchMgr.CreateLine(0.15375, 0.01275, 0, 0.15375, 0.02857, 0)
          Set swLine(8) = swSketchMgr.CreateLine(0.15375, 0.02857, 0, 0.14486, 0.03305, 0)
          Set swLine(9) = swSketchMgr.CreateLine(0.14486, 0.03305, 0, 0.14054, 0.04225, 0)
          Set swLine(10) = swSketchMgr.CreateLine(0.14054, 0.04225, 0, 0.11755, 0.04225, 0)
          Set swLine(11) = swSketchMgr.CreateLine(0.11755, 0.04225, 0, 0.1075, 0.02178, 0)
          Set swLine(12) = swSketchMgr.CreateLine(0.1075, 0.02178, 0, 0.09745, 0.04225, 0)
          Set swLine(13) = swSketchMgr.CreateLine(0.09745, 0.04225, 0, 0.06755, 0.04225, 0)
          Set swLine(14) = swSketchMgr.CreateLine(0.06755, 0.04225, 0, 0.0575, 0.02178, 0)
          Set swLine(15) = swSketchMgr.CreateLine(0.0575, 0.02178, 0, 0.04775, 0.04225, 0)
          Set swLine(16) = swSketchMgr.CreateLine(0.04775, 0.04225, 0, 0.02446, 0.04225, 0)
          Set swLine(17) = swSketchMgr.CreateLine(0.02446, 0.04225, 0, 0.02014, 0.03305, 0)
          Set swLine(18) = swSketchMgr.CreateLine(0.02014, 0.03305, 0, 0.01125, 0.02857, 0)
          Set swLine(19) = swSketchMgr.CreateLine(0.01125, 0.02857, 0, 0.01125, 0.01634, 0)
          Set swLine(20) = swSketchMgr.CreateLine(0.01125, 0.01634, 0, 0.00375, 0.0108, 0)
          Set swLine(21) = swSketchMgr.CreateLine(0.00375, 0.0108, 0, 0.00375, -0.0317, 0)
          Set swLine(22) = swSketchMgr.CreateLine(0.00375, -0.0317, 0, 0.00659, -0.03535, 0)
          Set swLine(23) = swSketchMgr.CreateLine(0.00659, -0.03535, 0, 0.01004, -0.04225, 0)
          Set swLine(24) = swSketchMgr.CreateLine(0.01004, -0.04225, 0, 0.04775, -0.04225, 0)
          Set swLine(25) = swSketchMgr.CreateLine(0.04775, -0.04225, 0, 0.0575, -0.02178, 0)
          Set swLine(26) = swSketchMgr.CreateLine(0.0575, -0.02178, 0, 0.06755, -0.04225, 0)
          Set swLine(27) = swSketchMgr.CreateLine(0.06755, -0.04225, 0, 0.09745, -0.04225, 0)
          Set swLine(28) = swSketchMgr.CreateLine(0.09745, -0.04225, 0, 0.1075, -0.02178, 0)
          Set swLine(29) = swSketchMgr.CreateLine(0.1075, -0.02178, 0, 0.11755, -0.04225, 0)
          Set swLine(30) = swSketchMgr.CreateLine(0.11755, -0.04225, 0, 0.15495, -0.04225, 0)
          Set swLine(31) = swSketchMgr.CreateLine(0.15494, -0.04225, 0, 0.1659, -0.01995, 0)
          Set swLine(32) = swSketchMgr.CreateLine(0.1659, -0.01995, 0, 0.17439, -0.04225, 0)
          Set swLine(33) = swSketchMgr.CreateLine(0.17439, -0.04225, 0, 0.20229, -0.04225, 0)
          Set swLine(34) = swSketchMgr.CreateLine(0.20229, -0.04225, 0, 0.22501, -0.02029, 0)

        
          'create fillet
          Set swSketchSeg = swLine(0)
          swSketchSeg.Select False
         
          Set swSketchSeg = swLine(1)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.01125, 1)
         
          Set swSketchSeg = swLine(1)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(2)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.01125, 1)
         
          Set swSketchSeg = swLine(2)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(3)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.01125, 1)
         
          Set swSketchSeg = swLine(3)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(4)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00775, 1)
         
          Set swSketchSeg = swLine(4)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(5)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00775, 1)
         
          Set swSketchSeg = swLine(5)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(6)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00725, 1)
         
          Set swSketchSeg = swLine(6)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(7)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00725, 1)
         
          Set swSketchSeg = swLine(7)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(8)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00775, 1)
         
          Set swSketchSeg = swLine(8)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(9)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00875, 1)
         
          Set swSketchSeg = swLine(9)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(10)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00875, 1)
         
          Set swSketchSeg = swLine(10)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(11)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00875, 1)
         
          Set swSketchSeg = swLine(11)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(12)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00775, 1)
         
          Set swSketchSeg = swLine(12)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(13)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00875, 1)
         
          Set swSketchSeg = swLine(13)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(14)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00875, 1)
         
          Set swSketchSeg = swLine(14)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(15)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00775, 1)
         
          Set swSketchSeg = swLine(15)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(16)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00875, 1)
         
          Set swSketchSeg = swLine(16)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(17)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00875, 1)
         
          Set swSketchSeg = swLine(17)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(18)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00875, 1)
         
          Set swSketchSeg = swLine(18)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(19)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00875, 1)
         
          Set swSketchSeg = swLine(19)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(20)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00725, 1)
         
          Set swSketchSeg = swLine(20)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(21)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00875, 1)
         
          Set swSketchSeg = swLine(21)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(22)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00875, 1)
         
          Set swSketchSeg = swLine(22)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(23)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00875, 1)
         
          Set swSketchSeg = swLine(23)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(24)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00875, 1)
         
          Set swSketchSeg = swLine(24)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(25)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00875, 1)
         
          Set swSketchSeg = swLine(25)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(26)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00775, 1)
         
          Set swSketchSeg = swLine(26)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(27)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00875, 1)
         
          Set swSketchSeg = swLine(27)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(28)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00875, 1)
         
          Set swSketchSeg = swLine(28)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(29)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00775, 1)
         
          Set swSketchSeg = swLine(29)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(30)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00875, 1)
         
          Set swSketchSeg = swLine(30)
          swSketchSeg.Select True
         
          Set swSketchSeg = swLine(31)
          swSketchSeg.Select True
         
          Set swSketchSeg = swSketchMgr.CreateFillet(0.00875, 1)
         
         
         
          'turn on direct addition to database
         swSketchMgr.AddToDB = True

      End Sub