jzecha
Aerospace
- Jan 20, 2016
- 236
I am trying to write a code to automate inserting hole and I am struggling to get part of my code to work.
I have a section of my code that lets you pick between Simple, Counterbored, and Countersunk holes and lets you put the needed information in.
I have gotten the Simple and Counterbored holes to work perfectly, but the issue is there are three different Countersunk hole styles.
So I tired using the same type of code to allow me to pick between those three styles as well inside the code of the Countersunk hole selection, but it fails.
For reference this section of the code is in a VBA Form:
And this section is in the VBA Module:
I have a section of my code that lets you pick between Simple, Counterbored, and Countersunk holes and lets you put the needed information in.
I have gotten the Simple and Counterbored holes to work perfectly, but the issue is there are three different Countersunk hole styles.
So I tired using the same type of code to allow me to pick between those three styles as well inside the code of the Countersunk hole selection, but it fails.
For reference this section of the code is in a VBA Form:
Code:
index5 = cmbobxHoleType.Value
Select Case index5
Case Is = "Simple"
Case Is = "Counterbored"
hDiameter2MM = frmHoleMenu.txtbxDiameter2.Value
hDepth2MM = frmHoleMenu.txtbxDepth2.Value
Case Is = "Countersunk"
index6 = cmbobx_CS_Typee.Value
Select Case index6
Case Is = "Depth & Angle"
hDepth2MM = frmHoleMenu.txtbxDepth2.Value
hAngle2 = frmHoleMenu.txtbxAngle2.Value
Case Is = "Depth & Diameter"
hDepth2MM = frmHoleMenu.txtbxDepth2.Value
hDiameter2MM = frmHoleMenu.txtbxDiameter2.Value
Case Is = "Angle & Diameter"
hAngle2 = frmHoleMenu.txtbxAngle2.Value
hDiameter2MM = frmHoleMenu.txtbxDiameter2.Value
End Select
And this section is in the VBA Module:
Code:
'''''
'Setting Up Hole Type (Simple, Tapered, Counterbored...)
Select Case index5
Case Is = "Simple"
oHole.Type = catSimpleHole
Case Is = "Counterbored"
oHole.Type = catCounterboredHole
'Dim oHeadDiameter As Length
Set oHeadDiameter = oHole.HeadDiameter
oHeadDiameter.Value = hDiameter2IN
'Dim oHeadDepth As Length
Set oHeadDepth = oHole.HeadDepth
oHeadDepth.Value = hDepth2IN
oPart.UpdateObject oHole
Case Is = "Countersunk"
index6 = cmbobx_CS_Typee.Value
Select Case index6
Case Is = "Depth & Angle"
oHole.Type = catCountersunkHole
oHole.CounterSunkMode = catCSModeDepthAngle
'Dim oHeadDepth As Length
Set oHeadDepth = oHole.HeadDepth
oHeadDepth.Value = hDepth2IN
'Dim oHeadAngle As Angle
Set oHeadAngle = oHole.HeadAngle
oHeadAngle.Value = hAngle2IN
oPart.UpdateObject oHole
Case Is = "Depth & Diameter"
oHole.Type = catCountersunkHole
oHole.CounterSunkMode = catCSModeDepthDiameter
'Dim oHeadDiameter As Length
Set oHeadDiameter = oHole.HeadDiameter
oHeadDiameter.Value = hDiameter2IN
'Dim oHeadDepth As Length
Set oHeadDepth = oHole.HeadDepth
oHeadDepth.Value = hDepth2IN
oPart.UpdateObject oHole
Case Is = "Angle & Diameter"
oHole.Type = catCountersunkHole
oHole.CounterSunkMode = catCSModeAngleDiameter
'Dim oHeadAngle As Angle
Set oHeadAngle = oHole.HeadAngle
oHeadAngle.Value = hAngle2IN
'Dim oHeadDiameter As Length
Set oHeadDiameter = oHole.HeadDiameter
oHeadDiameter.Value = hDiameter2IN
oPart.UpdateObject oHole
End Select