Guest User

Untitled

a guest
Dec 10th, 2018
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.87 KB | None | 0 0
  1. Dim swApp As Object
  2.  
  3. Dim Part As Object
  4. Dim boolstatus As Boolean
  5. Dim longstatus As Long, longwarnings As Long
  6. Dim skSegment As Object
  7.  
  8. Sub main()
  9.  
  10. Set swApp = Application.SldWorks
  11.  
  12. Set Part = swApp.ActiveDoc
  13. boolstatus = Part.Extension.SelectByID2("Plan de face", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
  14. Part.SketchManager.InsertSketch True
  15. Dim skSegment As Object
  16. Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.015723, 0.009153, 0#)
  17. Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.023747, 0.01492, 0#)
  18. Part.ClearSelection2 True
  19. 'Renommer l'esquisse
  20. Set swSketch = Part.GetActiveSketch2
  21. Set swFeat = swSketch
  22. swFeat.Name = "esq1"
  23. 'Cotation 1
  24. boolstatus = Part.Extension.SelectByID2("Arc1", "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
  25. Set myDisplayDim = Part.AddDimension2(0, 0, 0)
  26. Part.Parameter("D1@esq1").SystemValue = 40 / 1000
  27. 'Cotation 2
  28. boolstatus = Part.Extension.SelectByID2("Arc2", "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
  29. Set myDisplayDim = Part.AddDimension2(0, 0, 0)
  30. Part.Parameter("D2@esq1").SystemValue = 60 / 1000
  31. Set myFeature = Part.FeatureManager.FeatureExtrusion2(True, False, False, 6, 0, 0.01, 0.01, False, False, False, False, 0, 0, False, False, False, False, True, True, True, 0, 0, False)
  32. Part.SelectionManager.EnableContourSelection = False
  33. Part.ClearSelection2 True
  34.  
  35. boolstatus = Part.Extension.SelectByID2("Plan de face", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
  36. Part.SketchManager.InsertSketch True
  37. Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.023747, 0.01492, 0#)
  38. Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.054088, 0.023947, 0#)
  39. Part.ClearSelection2 True
  40. 'Renommer l'esquisse
  41. Set swSketch = Part.GetActiveSketch2
  42. Set swFeat = swSketch
  43. swFeat.Name = "esq2"
  44. 'Cotation 1
  45. boolstatus = Part.Extension.SelectByID2("Arc1", "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
  46. Set myDisplayDim = Part.AddDimension2(0, 0, 0)
  47. Part.Parameter("D1@esq2").SystemValue = 60 / 1000
  48. 'Cotation 2
  49. boolstatus = Part.Extension.SelectByID2("Arc2", "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
  50. Set myDisplayDim = Part.AddDimension2(0, 0, 0)
  51. Part.Parameter("D2@esq2").SystemValue = 160 / 1000
  52. Set myFeature = Part.FeatureManager.FeatureExtrusion2(True, False, False, 6, 0, 0.005, 0.005, False, False, False, False, 0, 0, False, False, False, False, True, True, True, 0, 0, False)
  53. Part.SelectionManager.EnableContourSelection = False
  54. Part.ClearSelection2 True
  55.  
  56. boolstatus = Part.Extension.SelectByID2("Plan de face", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
  57. Part.SketchManager.InsertSketch True
  58. Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.054088, 0.023947, 0#)
  59. Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.072393, 0.002382, 0#)
  60. Part.ClearSelection2 True
  61. 'Renommer l'esquisse
  62. Set swSketch = Part.GetActiveSketch2
  63. Set swFeat = swSketch
  64. swFeat.Name = "esq3"
  65. 'Cotation 1
  66. boolstatus = Part.Extension.SelectByID2("Arc1", "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
  67. Set myDisplayDim = Part.AddDimension2(0, 0, 0)
  68. Part.Parameter("D1@esq3").SystemValue = 160 / 1000
  69. 'Cotation 2
  70. boolstatus = Part.Extension.SelectByID2("Arc2", "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
  71. Set myDisplayDim = Part.AddDimension2(0, 0, 0)
  72. Part.Parameter("D2@esq3").SystemValue = 180 / 1000
  73. Set myFeature = Part.FeatureManager.FeatureExtrusion2(True, False, False, 6, 0, 0.008, 0.008, False, False, False, False, 0, 0, False, False, False, False, True, True, True, 0, 0, False)
  74. Part.SelectionManager.EnableContourSelection = False
  75. Part.ClearSelection2 True
  76.  
  77. 'Dim myFeature As Object
  78. 'Set myFeature = Part.FeatureManager.FeatureExtrusion2(True, False, False, 6, 0, 0.01, 0.01, False, False, False, False, 1.74532925199433E-02, 1.74532925199433E-02, False, False, False, False, True, True, True, 0, 0, False)
  79. 'Part.SelectionManager.EnableContourSelection = False
  80. 'Part.ClearSelection2 True
  81.  
  82. End Sub
Add Comment
Please, Sign In to add comment