jloeff
Mechanical
- Feb 13, 2002
- 29
Need some help to get started. I did my best to try to show what I wanted to do. Please help.
'----------------------------------------------------------------------------------
'Preconditions:
' An assembly that consists of three or more parts (Cavity, Mold, EJ Plate)
' A sketch containing sketch points
'
'Postconditions:
' A hole that varies type and size through 3 seperate parts in an assembly using
' the same x,y coordinates.
'
'-----------------------------------------------------------------------------------
Sub Ej_Pin_Hole()
Dim swApp As Object
Dim Part As Object
Dim SelMgr As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim Feature As Object
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
swApp.ActiveDoc.ActiveView.FrameState = 1
Part.ClearSelection2 True
'Ask user to select a sketch that contains sketch points
swApp.SendMsgToUser2 "Please select the Sketch.", swMbWarning, swMbOk
'User selects sketch
???? select all points in sketch (x & y values needed only)
'--------------------------------CAVITY-----------------
'Ask user to select the Cavity
swApp.SendMsgToUser2 "Please select the Cavity.", swMbWarning, swMbOk
'User selects the cavity
?????
Part.EditPart
'Ask the user to select a starting face
swApp.SendMsgToUser2 "Please select the Cavity Start Face.", swMbWarning, swMbOk
'User selects face to start hole wizard
?????
'Ask the user to select an ending face
swApp.SendMsgToUser2 "Please select the Cavity End Face.", swMbWarning, swMbOk
'User selects face to end the hole wizard
?????
'User is asked to provide a value for h1offset
????? h1offset=?
'Add hole wizard feature at previously selected sketch points and face
' with the end face being the reference plane to the "end condition"
'being "offset from surface" by a value of "h1offset"
????? use values collected above for x, y, and z positions
Part.FeatureManager.HoleWizard2 2, 3, 101, "3/16", 1, 0.0047625, 0.0508, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, "", False, 1, 1, 1, 1
Part.EditAssembly
'----------------------MOLD---------------------
'Ask user to select the Mold
swApp.SendMsgToUser2 "Please select the Mold.", swMbWarning, swMbOk
'User selects the Mold
?????
Part.EditPart
'Ask User to select the Mold Start face
?????
'Add hole wizard feature at previously selected x,y sketch points
'and Mold start face
Part.FeatureManager.HoleWizard2 2, 3, 101, "3/16", 1, 0.00555625, 0.0254, 2, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, "", False, 1, 1, 1, 1
Part.EditAssembly
'-------------------------------EJ PLATE---------------------------
'Ask user to select the Ej PLate
swApp.SendMsgToUser2 "Please select the Ej Plate.", swMbWarning, swMbOk
'User selects the Ej Plate
?????
Part.EditPart
'Ask User to select the Ej Plate Start face
?????
'Add hole wizard feature at previously selected sketch points
'and Ej Plate start face
Part.FeatureManager.HoleWizard2 0, 3, 80, "3/16", 1, 0.00555625, 0.0127, 0.01031875, 0.0047625, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, "", False, 1, 1, 1, 1
Part.EditAssembly
End Sub
'----------------------------------------------------------------------------------
'Preconditions:
' An assembly that consists of three or more parts (Cavity, Mold, EJ Plate)
' A sketch containing sketch points
'
'Postconditions:
' A hole that varies type and size through 3 seperate parts in an assembly using
' the same x,y coordinates.
'
'-----------------------------------------------------------------------------------
Sub Ej_Pin_Hole()
Dim swApp As Object
Dim Part As Object
Dim SelMgr As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim Feature As Object
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
swApp.ActiveDoc.ActiveView.FrameState = 1
Part.ClearSelection2 True
'Ask user to select a sketch that contains sketch points
swApp.SendMsgToUser2 "Please select the Sketch.", swMbWarning, swMbOk
'User selects sketch
???? select all points in sketch (x & y values needed only)
'--------------------------------CAVITY-----------------
'Ask user to select the Cavity
swApp.SendMsgToUser2 "Please select the Cavity.", swMbWarning, swMbOk
'User selects the cavity
?????
Part.EditPart
'Ask the user to select a starting face
swApp.SendMsgToUser2 "Please select the Cavity Start Face.", swMbWarning, swMbOk
'User selects face to start hole wizard
?????
'Ask the user to select an ending face
swApp.SendMsgToUser2 "Please select the Cavity End Face.", swMbWarning, swMbOk
'User selects face to end the hole wizard
?????
'User is asked to provide a value for h1offset
????? h1offset=?
'Add hole wizard feature at previously selected sketch points and face
' with the end face being the reference plane to the "end condition"
'being "offset from surface" by a value of "h1offset"
????? use values collected above for x, y, and z positions
Part.FeatureManager.HoleWizard2 2, 3, 101, "3/16", 1, 0.0047625, 0.0508, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, "", False, 1, 1, 1, 1
Part.EditAssembly
'----------------------MOLD---------------------
'Ask user to select the Mold
swApp.SendMsgToUser2 "Please select the Mold.", swMbWarning, swMbOk
'User selects the Mold
?????
Part.EditPart
'Ask User to select the Mold Start face
?????
'Add hole wizard feature at previously selected x,y sketch points
'and Mold start face
Part.FeatureManager.HoleWizard2 2, 3, 101, "3/16", 1, 0.00555625, 0.0254, 2, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, "", False, 1, 1, 1, 1
Part.EditAssembly
'-------------------------------EJ PLATE---------------------------
'Ask user to select the Ej PLate
swApp.SendMsgToUser2 "Please select the Ej Plate.", swMbWarning, swMbOk
'User selects the Ej Plate
?????
Part.EditPart
'Ask User to select the Ej Plate Start face
?????
'Add hole wizard feature at previously selected sketch points
'and Ej Plate start face
Part.FeatureManager.HoleWizard2 0, 3, 80, "3/16", 1, 0.00555625, 0.0127, 0.01031875, 0.0047625, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, "", False, 1, 1, 1, 1
Part.EditAssembly
End Sub