Community
I wanted to make iLogic rule to change color of selected face in Part.
Dim oPartDoc As PartDocument oPartDoc = ThisApplication.ActiveDocument ' Dim userParams As UserParameters ' userParams = oPartDoc.ComponentDefinition.Parameters.UserParameters ' Dim param As Parameter Dim oAsset As Asset Dim oAssets As Assets oAssets = oPartDoc.Assets Dim kolWew As Asset Dim kolWewNazwa As String kolWewNazwa = "RAL1001_Beige" Dim kolZew As Asset Dim kolZewNazwa As String kolZewNazwa = "RAL6018_Yellow_green" Try kolWew = ThisApplication.AssetLibraries.Item("RAL_Colors").AppearanceAssets.Item(kolWewNazwa).CopyTo(ThisDoc.Document, True) Catch kolWew = oPartDoc.Assets.Item(kolWewNazwa) End Try Try kolZew = ThisApplication.AssetLibraries.Item("RAL_Colors").AppearanceAssets.Item(kolZewNazwa).CopyTo(ThisDoc.Document, True) Catch kolZew = oPartDoc.Assets.Item(kolZewNazwa) End Try ' While True oFace = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllEntitiesFilter, "Wskaż powierzchnie zewnętrzne") oFace.Appearance = kolZew ' End While
The problem is in line:
oFace.Appearance = kolZew
This give me error "HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND)". I didn't found the solution to this problem for Assets. I also used "Help" in Inventor, but it didn't not help that. Compared to examples in "Help", everything looks correct.
Is there any other functions to allow override the color on any selected faces in part?
Thanks in advance
Hello,
try to insert a
dim oFace as Face
Dim oPartDoc As PartDocument oPartDoc = ThisApplication.ActiveDocument ' Dim userParams As UserParameters ' userParams = oPartDoc.ComponentDefinition.Parameters.UserParameters ' Dim param As Parameter Dim oAsset As Asset Dim oAssets As Assets oAssets = oPartDoc.Assets Dim kolWew As Asset Dim kolWewNazwa As String kolWewNazwa = "RAL1001_Beige" Dim kolZew As Asset Dim kolZewNazwa As String kolZewNazwa = "RAL6018_Yellow_green" Try kolWew = ThisApplication.AssetLibraries.Item("RAL_Colors").AppearanceAssets.Item(kolWewNazwa).CopyTo(ThisDoc.Document, True) Catch kolWew = oPartDoc.Assets.Item(kolWewNazwa) End Try Try kolZew = ThisApplication.AssetLibraries.Item("RAL_Colors").AppearanceAssets.Item(kolZewNazwa).CopyTo(ThisDoc.Document, True) Catch kolZew = oPartDoc.Assets.Item(kolZewNazwa) End Try Dim oFace as Face
' While True oFace = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllEntitiesFilter, "Wskaż powierzchnie zewnętrzne") oFace.Appearance = kolZew ' End While
Best Regards
Wolfgang
Can't find what you're looking for? Ask the community or share your knowledge.