zam 86

draw shaft using visual basic application

Discussion created by zam 86 on Sep 24, 2008
Latest reply on Dec 17, 2008 by mapea ralia
hello there.........i've developed a system that can draw shaft using vba.....there is no problem to draw shaft with 1 diameter......but when i want to draw shaft in three different diameter , problem occured......

Private Sub CommandButton5_Click()

'shaft 1
Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
swApp.ActiveDoc.ActiveView.FrameState = 1
Dim SkCircle As Object
Set SkCircle = Part.SketchManager.CreateCircle(0.4091243888205, -0.2921278626156, 0, txta.Text, -0.3123621415489, 0)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Arc1", "SKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 0)
Part.FeatureManager.FeatureExtrusion2 True, False, False, 0, 0, txtb.Text, txtb.Text, False, False, False, False, 0.01745329251994, 0.01745329251994, False, False, False, False, 1, 1, 1, 0, 0, False
Part.SelectionManager.EnableContourSelection = 0
Part.ActivateSelectedFeature
Part.ClearSelection2 True

'shaft 2
Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
swApp.ActiveDoc.ActiveView.FrameState = 1

Set SkCircle = Part.SketchManager.CreateCircle(0, 0, txtb.Text, txtc.Text, 0.0323604905812, 0)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Arc1", "SKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 0)
Part.FeatureManager.FeatureExtrusion True, False, False, 0, 0, txtd.Text, txtd.Text, False, False, False, False, 0.01745329251994, 0.01745329251994, False, False, False, False, 1, 1, 1
Part.SelectionManager.EnableContourSelection = 0
Part.ClearSelection2 True
End Sub

this is my codding........

my problem is 2 cylinder is start in the same reference.....i want my program first draw 1 cylinder,then another cylinder is extrude from it surface not from reference......

Outcomes