Through visual studio we run the ilogic rule but after inventor 2025 installation my code not working.

Through visual studio we run the ilogic rule but after inventor 2025 installation my code not working.

khadeerkruthi
Contributor Contributor
138 Views
0 Replies
Message 1 of 1

Through visual studio we run the ilogic rule but after inventor 2025 installation my code not working.

khadeerkruthi
Contributor
Contributor

private void RunRule(string Rule)
{

Inventor.ApplicationAddIn addIn = (ApplicationAddIn)GetiLogicAddin(); // Assign the result to addIn
if (addIn != null)
{
try
{
Console.WriteLine("Attempting to activate add-in...");
addIn.Activate();

Console.WriteLine("Getting iLogicApp");
dynamic automation = addIn.Automation;
if (automation != null)
{
dynamic MyRule = null;

foreach (dynamic _rule in automation.Rules(dInv.ActiveDocument))
{
if (_rule.Name == Rule)
{
MyRule = _rule;
break;
}
}
if (MyRule != null)
{
automation.RunRule(dInv.ActiveDocument, Rule);

}
}

}
catch (Exception ex)
{
// Handle any exceptions that occur during activation or execution
Console.WriteLine("An error occurred: " + ex.Message);
}
}
}

private Inventor.ApplicationAddIn GetiLogicAddin()
{
Inventor.ApplicationAddIn addIn = null;
try
{
addIn = dInv.ApplicationAddIns.ItemById["{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}"];
addIn.Activate();
return addIn;
}
catch
{
return null;
}
}

0 Likes
139 Views
0 Replies
Replies (0)