iLogic: Shared Function

iLogic: Shared Function

lantinma
Enthusiast Enthusiast
419 Views
2 Replies
Message 1 of 3

iLogic: Shared Function

lantinma
Enthusiast
Enthusiast

Hi All,

 

I have made a function (SteelProfile( PartName, Profile)) which works fine inside the rule, but if I want to call to this function in other rules it doesn't work. My question is how a share this function so that each rule can call it?

 

My function:

Function SteelProfile(PartName, Profile)        'Sub function to get dimensions from excel

ExcelFile = "C:\Users\...\SteelProfilesTable.xlsx"
i = GoExcel.FindRow(ExcelFile, "Sheet1", "Name", "=", Profile)    

Parameter(PartName, "Parameter_B") = GoExcel.CurrentRowValue("b")     
Parameter(PartName, "Parameter_H") = GoExcel.CurrentRowValue("h")     

End Function

Main function and calling function

Sub Main()
'Roof Beams SteelProfile("RoofBeam", RoofBeam_profile) 'Calls the function with values

End Sub

 -Leevi

0 Likes
420 Views
2 Replies
Replies (2)
Message 2 of 3

ianteneth
Advocate
Advocate

Hi @lantinma,

 

Maybe this link will help. It discusses how to run other rules inside your rule.

 

https://knowledge.autodesk.com/support/inventor/learn-explore/caas/CloudHelp/cloudhelp/2018/ENU/Inve... 

0 Likes
Message 3 of 3

lantinma
Enthusiast
Enthusiast

Hi @ianteneth 

 

Thanks for quick reply. 

 

I tried following, "Test1" - rule only includes my SteelProfile function:

Sub Main()
iLogicVb.RunRule("Test1")

SteelProfile("RoofBeam", RoofBeam_profile)        'Calls the fuction with set values

End Sub

 
Inventor gives same error:

"Rule Compile Errors in Test2, in B2026544.iam

Error on Line 6 : 'SteelProfile' is not declared. It may be inaccessible due to its protection level."

 

Should I next try to make a macro and run it through Run.Macro command?

0 Likes