The attached part has some bad work features on it, but I don't care about that (easy fix). It also contains a rule that simply changes the material from "P AND O" (pickles & oiled) to "201 S/S", for some reason the faulty work geometery causes this rule to throw an "unspecified error". If you delete the bad work geometry the rule runs fine.
This is easy enough for me to fix, I'll just repair the work features, but I thought AutoDesk or anyone else having a similar problem would like to see it.
Solved! Go to Solution.
Solved by bobvdd. Go to Solution.
Thanks for reporting this Michael.
I think what And I are looking at here is not an iLogic defect but more an API defect.
Once a part cannot be rebuild succesfully and shows sick features, you cannot change its material via the API.
Here is a short macro that demonstrates my thesis.
Sub test()
Dim odoc As PartDocument
Set odoc = ThisApplication.ActiveDocument
odoc.ComponentDefinition.Material = ThisApplication.StylesManager.Materials.Item(1)
End Sub
This macro will trigger a run-time error. Like you said once you fix the sick features, teh macro and your iLogic rule runs succesfully.
I have logged it as defect 1462734 Cannot change material via API on a sick part
Thanks
Bob
Michael,
I checked with our developers and this problem has been fixed in the next release of Inventor.
Because Materials are no longer in the Style editor since 2013, we are working on replacing the API call
ThisApplication.StylesManager.Materials
to
ThisApplication.AssetLibraries(3).MaterialAssets(10).
And this new call no longer has the problem with sick parts.
In the meantime try to avoid working with sick parts when you attempt material changes in your VBA or iLogic code.
Thanks
Bob
Can't find what you're looking for? Ask the community or share your knowledge.