Yogibear
Mechanical
- Sep 5, 2002
- 107
I have this bit of code that I'm trying to modify to do an extrusion of a rectangular sketch with the dims that I specify. I've found in the API help where it tells me the definitions of the values I need to imput but I still can't get it to do a midplane extrusion with a value I specify.
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long
Dim Annotation As Object
Dim Gtol As Object
Dim DatumTag As Object
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Sub main()
Set swApp = CreateObject("SldWorks.Application")
'swApp.ActiveDoc.ActiveView.FrameLeft = 0
'swApp.ActiveDoc.ActiveView.FrameTop = 0
'swApp.ActiveDoc.ActiveView.FrameState = 1
'swApp.ActiveDoc.ActiveView.FrameState = 1
Set Part = swApp.NewPart()
Part.InsertSketch
Part.SketchRectangle 0, 0, 0, 0.07748542510121, -0.04675519568151, 0, 1
Part.ClearSelection
Part.SelectByID "Line1", "SKETCHSEGMENT", 0.03977962213225, 0, 0
Part.AddDimension 0.0397796, 0.0116888, 0
Part.ClearSelection
Part.SelectByID "Line4", "SKETCHSEGMENT", 0.07748542510121, -0.02337759784076, 0
Part.AddDimension 0.0974695, -0.0233776, 0
Part.ClearSelection
Part.SelectByID "D1@Sketch1@Part1.SLDPRT", "DIMENSION", 0, 0, 0
Part.SetPickMode
Part.ClearSelection
Part.SelectByID "D2@Sketch1@Part1.SLDPRT", "DIMENSION", 0.09822361673414, -0.02413171390013, 0
Part.Parameter("D2@Sketch1").SystemValue = 0
Part.SelectByID "D1@Sketch1@Part1.SLDPRT", "DIMENSION", 0.03902550607287, 0.01319703103914, 0
Part.Parameter("D1@Sketch1").SystemValue = 0
Part.FeatureExtrusion3 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long
Dim Annotation As Object
Dim Gtol As Object
Dim DatumTag As Object
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Sub main()
Set swApp = CreateObject("SldWorks.Application")
'swApp.ActiveDoc.ActiveView.FrameLeft = 0
'swApp.ActiveDoc.ActiveView.FrameTop = 0
'swApp.ActiveDoc.ActiveView.FrameState = 1
'swApp.ActiveDoc.ActiveView.FrameState = 1
Set Part = swApp.NewPart()
Part.InsertSketch
Part.SketchRectangle 0, 0, 0, 0.07748542510121, -0.04675519568151, 0, 1
Part.ClearSelection
Part.SelectByID "Line1", "SKETCHSEGMENT", 0.03977962213225, 0, 0
Part.AddDimension 0.0397796, 0.0116888, 0
Part.ClearSelection
Part.SelectByID "Line4", "SKETCHSEGMENT", 0.07748542510121, -0.02337759784076, 0
Part.AddDimension 0.0974695, -0.0233776, 0
Part.ClearSelection
Part.SelectByID "D1@Sketch1@Part1.SLDPRT", "DIMENSION", 0, 0, 0
Part.SetPickMode
Part.ClearSelection
Part.SelectByID "D2@Sketch1@Part1.SLDPRT", "DIMENSION", 0.09822361673414, -0.02413171390013, 0
Part.Parameter("D2@Sketch1").SystemValue = 0
Part.SelectByID "D1@Sketch1@Part1.SLDPRT", "DIMENSION", 0.03902550607287, 0.01319703103914, 0
Part.Parameter("D1@Sketch1").SystemValue = 0
Part.FeatureExtrusion3 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1