Custom Bolt I Logic

Custom Bolt I Logic

corey_danielson
Advocate Advocate
456 Views
6 Replies
Message 1 of 7

Custom Bolt I Logic

corey_danielson
Advocate
Advocate

My bolts work just as I want them to, this is the 3/4-10. What I would like to do is have a choice of choosing Partial or Full thread but only if that option is available.  2.75" and below is full thread only.  3" and above is partial thread or full thread (thru 5"), above that is all partial thread. I have a parameter THREAD. this is multi value (Full and Partial) I have the choice to pick in my form.

If DESCRIPTION1 = "SOCKET HEAD CAP SCREW 3/4-10" Then
	BOLT_LENGTH = BOLT_LENGTH
	HEAD_HEIGHT = .75
    HEX_WIDTH = .625
    HEAD_DIA = 1.125
    BOLT_DIA = .75
	HEX_DEPTH = .625
	SOLT_HEIGHT = (HEAD_HEIGHT/2)
	Feature.IsActive("Thread1") = True
    Feature.ThreadDesignation("Thread1") = "3/4-10 UNC"
	
If DESCRIPTION1 = "SOCKET HEAD CAP SCREW 3/4-10" And
	 BOLT_LENGTH < .75 Then
	MessageBox.Show("SOCKET HEAD CAP SCREW 3/4-10 length must be 3/4 or greater. Changing to 3/4", "AO Paramter Police")
	BOLT_LENGTH = .75
Else If DESCRIPTION1 = "SOCKET HEAD CAP SCREW 3/4-10" And
	BOLT_LENGTH > 20 Then
	MessageBox.Show("SOCKET HEAD CAP SCREW 3/4-10 length must be 20 or less. Changing to 20", "AO Paramter Police")
	BOLT_LENGTH = 20
End If	

THREAD = InputBox("THREAD", "PARTIAL OR FULL", "Default Entry")

If Parameter("THREAD") = "PARTIAL" Then
THREAD_LENGTH = 2
Else If Parameter("THREAD") = "FULL" Then
THREAD_LENGTH = BOLT_LENGTH
End If
	
	SHCS_DESC = DESCRIPTION1 & " " & "X" & " " & BOLT_LENGTH &  " " & "LONG"
	PART_NUMBER1 = "SHCS.75-10" & "X" & BOLT_LENGTH & "LG"
End If

 

0 Likes
Accepted solutions (1)
457 Views
6 Replies
Replies (6)
Message 2 of 7

Curtis_Waguespack
Consultant
Consultant

Hi @corey_danielson ,

Do you have a model you can share?

 

I don't seen anyone being able to help with this, unless they spend a lot of time setting up a model to understand the issue/question... therefore without a model provided by you, you're not likely to get much of a response.

 

Hope that helps,

Curtis

EESignature

0 Likes
Message 3 of 7

Curtis_Waguespack
Consultant
Consultant
Accepted solution

@corey_danielson, in lieu of having the model, I ran this through and AI tool and it gave this. It might work for you, or at least give you a hint on the logic.

Hope that helps,
Curtis

 

If DESCRIPTION1 = "SOCKET HEAD CAP SCREW 3/4-10" Then
    BOLT_LENGTH = BOLT_LENGTH
    HEAD_HEIGHT = .75
    HEX_WIDTH = .625
    HEAD_DIA = 1.125
    BOLT_DIA = .75 
    HEX_DEPTH = .625
    SOLT_HEIGHT = (HEAD_HEIGHT/2)
    Feature.IsActive("Thread1") = True
    Feature.ThreadDesignation("Thread1") = "3/4-10 UNC"

    'Length validation
    If BOLT_LENGTH < .75 Then
        MessageBox.Show("SOCKET HEAD CAP SCREW 3/4-10 length must be 3/4 or greater. Changing to 3/4", "AO Parameter Police")
        BOLT_LENGTH = .75
    ElseIf BOLT_LENGTH > 20 Then
        MessageBox.Show("SOCKET HEAD CAP SCREW 3/4-10 length must be 20 or less. Changing to 20", "AO Parameter Police")
        BOLT_LENGTH = 20
    End If

    'Thread type logic based on length
    If BOLT_LENGTH <= 2.75 Then
        'Only full thread available
        Parameter("THREAD") = "FULL"
        THREAD_LENGTH = BOLT_LENGTH
    ElseIf BOLT_LENGTH > 5 Then
        'Only partial thread available
        Parameter("THREAD") = "PARTIAL"  
        THREAD_LENGTH = 2
    Else
        'Both options available between 3" and 5"
        'Keep existing THREAD parameter selection from form
        If Parameter("THREAD") = "PARTIAL" Then
            THREAD_LENGTH = 2
        Else 'FULL
            THREAD_LENGTH = BOLT_LENGTH
        End If
    End If

    SHCS_DESC = DESCRIPTION1 & " " & "X" & " " & BOLT_LENGTH & " " & "LONG"
    PART_NUMBER1 = "SHCS.75-10" & "X" & BOLT_LENGTH & "LG"
End If

 

EESignature

0 Likes
Message 4 of 7

corey_danielson
Advocate
Advocate

Curtis, Thank you very much. This got me really close, I tested in a new part, now I am adding it into the part for each size.  This seems to work perfectly; I modify it as needed. Thanks again!

Message 5 of 7

corey_danielson
Advocate
Advocate
one more question, this is the only active code in my part, I commented out all the other variations to test this one
Can you see what is wrong here? Still trying to wrap my head around some of the lingo. The Socket head cap Screws
Work perfectly, Working on Hex Bolts now, trying to use the same code with a few modifications. Thank you


'++++++++++++++++++++++++++++++++++++HEX HEAD BOLTS BELOW SEPERATED By LINES+++++++++++++++++++++++++++++
'========================================================== Dim sLengthFraction As String = Parameter.Param("LENGTH").Expression oLength = LENGTH 'If oLength.Contains(" / ") Then ' Dim wholeNumber As Integer = .0 ' Dim fraction As String ' If oLength.Contains(" ") Then ' sArray = Split(oLength, " ") ' wholeNumber = CInt(sArray(0)) ' fraction = sArray(1) ' Else ' fraction = oLength ' End If ' sFractionArray = Split(fraction, " / ") ' Dim fractionAsDecimal As Double = sFractionArray(0) / sFractionArray(1) ' oLength = wholeNumber + fractionAsDecimal 'End If '======================================= BOLT GRADE =========================================== MultiValue.SetList("GRADE", "GR5", "GR8") If Parameter("GRADE") = "GR5" Then SLOTPATTERN = 3 Else If Parameter("GRADE") = "GR8" Then SLOTPATTERN = 5 End If '====================================================== 1/4-20 TEST================================== If DescriptionBolt = "HEX BOLT 1/4-20" LENGTH = oLength THREADLENGTH = .75 SLOTPATTERN = SLOTPATTERN HEADTHICKNESS = .15625 DIAMETER = .25 CHAMFER = .015 HEX = .4375 boltpartnumber = "HB-PT" & ".25-20" & "X" & (LENGTH) & (GRADE) BOLT_DESCRIPTION = DescriptionBolt & " X " & LENGTH & " " & "LONG" & " " & GRADE & " " & Color SLOT = .09375 RADIUS = .04 VERTICAL_RADIUS = .04 FROM_CENTER = .0625 HALF_SLOT_WIDTH1 = .01 HALF_SLOT_WIDTH2 = .01 Feature.IsActive("Thread3") = True Feature.ThreadDesignation("Thread3") = "1/4-20 UNC" If DescriptionBolt = "SOCKET HEAD CAP SCREW 1/4-20" And LENGTH < .375 Then MessageBox.Show("SOCKET HEAD CAP SCREW 1/4-20 length must be 3/8 or greater. Changing to 3/8", "AO Paramter Police") LENGTH = .375 Else If DescriptionBolt = "SOCKET HEAD CAP SCREW 1/4-20" And LENGTH > 12 Then MessageBox.Show("SOCKET HEAD CAP SCREW 1/4-20 length must be 12 or less. Changing to 12", "AO Paramter Police") LENGTH = 12 End If 'Thread type logic based on length If LENGTH <= 1.125 Then 'Only full thread available Parameter("Thread3") = "FULL" THREADLENGTH = LENGTH ElseIf LENGTH > 6 Then 'Only partial thread available Parameter("Thread3") = "PARTIAL" THREADLENGTH = 1 Else 'Both options available between 1" and 6" 'Keep existing THREAD parameter selection form active If Parameter("Thread3") = "PARTIAL" Then THREADLENGTH = .875 Else 'FULL THREADLENGTH = LENGTH End If End If BOLT_DESCRIPTION = DescriptionBolt & "" & "GRADE" & "X" & " " & LENGTH & " " & "LONG" boltpartnumber = "HEXBOLT-.25-20" & "GRADE" & "X" & LENGTH & "LG" End If
0 Likes
Message 6 of 7

Curtis_Waguespack
Consultant
Consultant

Hi @corey_danielson , I think you will want to structure it something like this. Hope that helps, Curtis

 

If DescriptionBolt = "HEX BOLT 1/4-20" Then

	If LENGTH < .375 Then
		' do stuff here
	ElseIf LENGTH ? ? ? Then
		' do stuff here
	ElseIf LENGTH ? ? ? Then
		' do stuff here
	ElseIf LENGTH ? ? ? Then
		' do stuff here
	Else
		' do stuff here
	End If

ElseIf DescriptionBolt = "SOCKET HEAD CAP SCREW 1/4-20" Then

	If LENGTH < .375 Then
		' do stuff here
	ElseIf LENGTH ? ? ? Then
		' do stuff here
	ElseIf LENGTH ? ? ? Then
		' do stuff here
	ElseIf LENGTH ? ? ? Then
		' do stuff here
	Else
		' do stuff here
	End If

End If

 

EESignature

0 Likes
Message 7 of 7

corey_danielson
Advocate
Advocate

Thanks Curtis, I am going to try this.

0 Likes