Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
j.romo
140 Views, 0 Replies

VB.Net Ilogic In Addin how to add parameters

@JelteDeJong

Hello Jelte,

I got working the addin with Ilogic functionality but it would be very aprecciated to get some of your knowledge.

I have a ipt and a iam files that control geometry and the sequence for a progressive die to manufacture the part, my customer has to fill a xlsx file manually to program a PlC that controlls the progressive die. i have made several iLogic rules that work as intended but its a little to complex to control by the ilogic forms (they are very bad for this).

I would like to know how to get my ilogic code (some is very basic stuff) and migrate it to the .net. I just need to be pointed to the right direction :slightly_smiling_face:

here are some sample rules

this rule pulls some parameters and populates a spreadsheet

Public Class ThisRule

 
Private Sub Main()

Dim oNUMSLOT As String = SLOTS
Dim oPOSPUNZON As Double = 9.645050000 in
Dim oSLOTPOS As Double = Parameter("MASTER BLANK:1", "SLOT" & oNUMSLOT & "_LARGO_MID") 
Dim oCUP As Double = Parameter("MASTER BLANK:1", "CUP_X_INI")
Dim oEXTENT As Double = Parameter("MASTER BLANK:1", "EXTENTS_LARGO")

Dim oCALL As Boolean
oCALL = OriginalBlank(oNEorTWO)

	If oCALL = False Then
		If oPOSPUNZON > SERVO_SAVE Then
			'ESTA REGLA SIEMPRE CORRE CUANDO EL PUNZON ESTA DESPUES DEL ORIGEN CUP
			
			STEP_PREVIO = (oPOSPUNZON-SERVO_STEP) - (oSLOTPOS - oCUP )
			STEP_COMPLEMENTARIO = PASO_SIDE - STEP_PREVIO
			SERVO_STEP = SERVO_SAVE + STEP_PREVIO
			SubRellenado()
			RUNNING_ARGUMENT = "para punzon inicial"
			
			'i = MessageBox.Show(Data(RUNNING_ARGUMENT), "My iLogic Dialog", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1)
		Else 
			
			STEP_PREVIO = (oSLOTPOS + oCUP )- (SERVO_SAVE - oPOSPUNZON)
			SERVO_STEP = SERVO_SAVE + STEP_PREVIO
			STEP_COMPLEMENTARIO = PASO_SIDE - STEP_PREVIO
			
			RUNNING_ARGUMENT = "ELSE DEL SEGUNDO si es punzon dos"
			SubRellenado()
	i = MessageBox.Show("The Value you entered was incorrect", "My iLogic Dialog", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1)
			End If
			Else
				
			oSLOTRES()  ' CORRE SUB
			
			SERVO_STEP = SERVO_SAVE + STEP_PREVIO
			
		End If	
iLogicVb.UpdateWhenDone = True
End Sub


Public Function OriginalBlank(oNEorTWO As Boolean) As Boolean
	Dim oPOSPUNZON As Double = 9.645050000 in
	Dim oEXTENT As Double = Parameter("MASTER BLANK:1", "EXTENTS_LARGO")
	Dim oPATSEP As Double = Parameter("MASTER BLANK:1", "SEPARACION_P1") 
	Dim oENTRE As Double =Parameter("MASTER BLANK:1", "ENTRE_BLANKS")

	'COMPROBAMOS SI EL BLANK LARGO PASA POR EL PUNXON
	If SERVO_SAVE > (oPOSPUNZON + oPATSEP- (oENTRE*2)) Then
		oNEorTWO = True
		Else
		oNEorTWO = False
		
	End If
	i = MessageBox.Show((oNEorTWO ), (oPOSPUNZON + oPATSEP- (oENTRE*2)), MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1)
	
	Return oNEorTWO
End Function

Sub SubRellenado()
'RELLENADO DE DATOS DE BLANKS ADICIONALES
If SLOTS = 1 Then
SLOT1_ADICION = STEP_PREVIO
SLOT1_COMPLEMENTARIO = STEP_COMPLEMENTARIO
Else If SLOTS = 2 Then
SLOT2_ADICION = STEP_PREVIO
SLOT2_COMPLEMENTARIO = STEP_COMPLEMENTARIO
Else If SLOTS = 3 Then
SLOT3_ADICION = STEP_PREVIO
SLOT3_COMPLEMENTARIO = STEP_COMPLEMENTARIO
Else If SLOTS = 4 Then
SLOT4_ADICION = STEP_PREVIO
SLOT4_COMPLEMENTARIO = STEP_COMPLEMENTARIO
Else If SLOTS = 5 Then
SLOT5_ADICION = STEP_PREVIO
SLOT5_COMPLEMENTARIO = STEP_COMPLEMENTARIO
Else If SLOTS = 6 Then
SLOT6_ADICION = STEP_PREVIO
SLOT6_COMPLEMENTARIO = STEP_COMPLEMENTARIO
Else If SLOTS = 7 Then
SLO7_ADICION = STEP_PREVIO
SLOT7_COMPLEMENTARIO = STEP_COMPLEMENTARIO
Else If SLOTS = 8 Then
SLOT8_ADICION = STEP_PREVIO
SLOT8_COMPLEMENTARIO = STEP_COMPLEMENTARIO
Else If SLOTS = 9 Then
SLOT9_ADICION = STEP_PREVIO
SLOT9_COMPLEMENTARIO = STEP_COMPLEMENTARIO
Else If SLOTS = 10 Then
SLOT10_ADICION = STEP_PREVIO
SLOT10_COMPLEMENTARIO = STEP_COMPLEMENTARIO
Else If SLOTS = 11 Then
SLOT11_ADICION = STEP_PREVIO
SLOT11_COMPLEMENTARIO = STEP_COMPLEMENTARIO
Else If SLOTS = 12 Then
SLOT12_ADICION = STEP_PREVIO
SLOT12_COMPLEMENTARIO = STEP_COMPLEMENTARIO
End If
i = MessageBox.Show("sub", "sub jalando", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1)
	
End Sub
'REGLA DE CORRER SI DATOS ESTAN LLENOS COMPLEMENTO

Sub oSLOTRES()
	If SLOTS = 1 Then
		STEP_PREVIO = SLOT1_ADICION
		STEP_COMPLEMENTARIO = SLOT1_COMPLEMENTARIO	
	Else If SLOTS = 2 Then
		STEP_PREVIO = SLOT2_ADICION
		STEP_COMPLEMENTARIO = SLOT2_COMPLEMENTARIO
	Else If SLOTS = 3 Then
		STEP_PREVIO = SLOT3_ADICION
		STEP_COMPLEMENTARIO = SLOT3_COMPLEMENTARIO		
		
	End If
	RUNNING_ARGUMENT = "SLOTRES"
End Sub 
End Class

 here I turn on and off some features in a ipt file in the main assembly

If PAN_01 = True  Then
Feature.IsActive("PAN-FAN:1", "PAN 1") = True
Else
Feature.IsActive("PAN-FAN:1", "PAN 1") = False	
End If