Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim swApp As Object
- Dim Part As Object
- Dim boolstatus As Boolean
- Dim longstatus As Long, longwarnings As Long
- Dim skSegment As Object
- Dim R1 As Double
- Dim R2 As Double
- Dim R3 As Double
- Dim R4 As Double
- Dim R5 As Double
- Dim H1 As Double
- Dim H2 As Double
- Dim H3 As Double
- Dim H4 As Double
- Sub main()
- Set swApp = Application.SldWorks
- Set Part = swApp.ActiveDoc
- R1 = 20 / 1000
- R2 = 30 / 1000
- R3 = 80 / 1000
- R4 = 90 / 1000
- R5 = 120 / 1000
- H1 = 10 / 1000
- H2 = 5 / 1000
- H3 = 8 / 1000
- H4 = 6 / 1000
- ''''''''''''''''''''''''''''''''''''''''''''''
- 'Bossage 1''''''''''''''''''''''''''''''''''''
- ''''''''''''''''''''''''''''''''''''''''''''''
- boolstatus = Part.Extension.SelectByID2("Plan de face", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
- Part.SketchManager.InsertSketch True
- Dim skSegment As Object
- Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.015723, 0.009153, 0#)
- Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.023747, 0.01492, 0#)
- Part.ClearSelection2 True
- 'Renommer l'esquisse
- Set swSketch = Part.GetActiveSketch2
- Set swFeat = swSketch
- swFeat.Name = "esq1"
- 'Cotation 1
- boolstatus = Part.Extension.SelectByID2("Arc1", "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
- Set myDisplayDim = Part.AddDimension2(0, 0, 0)
- Part.Parameter("D1@esq1").SystemValue = R1 * 2
- 'Cotation 2
- boolstatus = Part.Extension.SelectByID2("Arc2", "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
- Set myDisplayDim = Part.AddDimension2(0, 0, 0)
- Part.Parameter("D2@esq1").SystemValue = R2 * 2
- Set myFeature = Part.FeatureManager.FeatureExtrusion2(True, False, False, 6, 0, H1, H1, False, False, False, False, 0, 0, False, False, False, False, True, True, True, 0, 0, False)
- Part.SelectionManager.EnableContourSelection = False
- Part.ClearSelection2 True
- ''''''''''''''''''''''''''''''''''''''''''''''
- 'Bossage 2''''''''''''''''''''''''''''''''''''
- ''''''''''''''''''''''''''''''''''''''''''''''
- boolstatus = Part.Extension.SelectByID2("Plan de face", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
- Part.SketchManager.InsertSketch True
- Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.023747, 0.01492, 0#)
- Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.054088, 0.023947, 0#)
- Part.ClearSelection2 True
- 'Renommer l'esquisse
- Set swSketch = Part.GetActiveSketch2
- Set swFeat = swSketch
- swFeat.Name = "esq2"
- 'Cotation 1
- boolstatus = Part.Extension.SelectByID2("Arc1", "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
- Set myDisplayDim = Part.AddDimension2(0, 0, 0)
- Part.Parameter("D1@esq2").SystemValue = R2 * 2
- 'Cotation 2
- boolstatus = Part.Extension.SelectByID2("Arc2", "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
- Set myDisplayDim = Part.AddDimension2(0, 0, 0)
- Part.Parameter("D2@esq2").SystemValue = R3 * 2
- Set myFeature = Part.FeatureManager.FeatureExtrusion2(True, False, False, 6, 0, H2, H2, False, False, False, False, 0, 0, False, False, False, False, True, True, True, 0, 0, False)
- Part.SelectionManager.EnableContourSelection = False
- Part.ClearSelection2 True
- ''''''''''''''''''''''''''''''''''''''''''''''
- 'Bossage 3''''''''''''''''''''''''''''''''''''
- ''''''''''''''''''''''''''''''''''''''''''''''
- boolstatus = Part.Extension.SelectByID2("Plan de face", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
- Part.SketchManager.InsertSketch True
- Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.054088, 0.023947, 0#)
- Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.072393, 0.002382, 0#)
- Part.ClearSelection2 True
- 'Renommer l'esquisse
- Set swSketch = Part.GetActiveSketch2
- Set swFeat = swSketch
- swFeat.Name = "esq3"
- 'Cotation 1
- boolstatus = Part.Extension.SelectByID2("Arc1", "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
- Set myDisplayDim = Part.AddDimension2(0, 0, 0)
- Part.Parameter("D1@esq3").SystemValue = R3 * 2
- 'Cotation 2
- boolstatus = Part.Extension.SelectByID2("Arc2", "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
- Set myDisplayDim = Part.AddDimension2(0, 0, 0)
- Part.Parameter("D2@esq3").SystemValue = R4 * 2
- Set myFeature = Part.FeatureManager.FeatureExtrusion2(True, False, False, 6, 0, H3, H3, False, False, False, False, 0, 0, False, False, False, False, True, True, True, 0, 0, False)
- Part.SelectionManager.EnableContourSelection = False
- Part.ClearSelection2 True
- ''''''''''''''''''''''''''''''''''''''''''''''
- 'Bossage 4''''''''''''''''''''''''''''''''''''
- ''''''''''''''''''''''''''''''''''''''''''''''
- boolstatus = Part.Extension.SelectByID2("Plan de face", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
- Part.SketchManager.InsertSketch True
- Part.ClearSelection2 True
- Set skSegment = Part.SketchManager.CreateLine(R4, 0#, 0#, R3 * Cos(30 * 3.14 / 360), R3 * Sin(30 * 3.14 / 360), 0#)
- Set skSegment = Part.SketchManager.CreateLine(R3 * Cos(30 * 3.14 / 360), R3 * Sin(30 * 3.14 / 360), 0#, R4 * 2, 0#, 0#)
- Set skSegment = Part.SketchManager.CreateLine(R4 * 2, 0#, 0#, R3 * Cos(30 * 3.14 / 360), R3 * -Sin(30 * 3.14 / 360), 0#)
- Set skSegment = Part.SketchManager.CreateLine(R3 * Cos(30 * 3.14 / 360), R3 * -Sin(30 * 3.14 / 360), 0#, R4, 0#, 0#)
- Set myFeature = Part.FeatureManager.FeatureExtrusion2(True, False, False, 6, 0, H4, H4, False, False, False, False, 0, 0, False, False, False, False, True, True, True, 0, 0, False)
- Part.SelectionManager.EnableContourSelection = False
- Part.ClearSelection2 True
- End Sub
Add Comment
Please, Sign In to add comment