11-06-2018
04:53 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
11-06-2018
04:53 PM
The below code works great when used within a part file, but when I add the part to an assembly, the part errors. For example, a single line of iLogic code in the assembly to change the width of the part will cause the part file to run its iLogic code, and error. When I comment out the below code, the part updates correctly in the assembly. I think the error is in the "com.autodesk.inventor.FaceAttributes" line, but I don't know how else I can find each face to update.
Dim oPartDoc As PartDocument
oPartDoc = ThisApplication.ActiveDocument
' Get all of the faces that have the "FaceColor" attribute.
Dim oFaces As ObjectCollection
oFaces = oPartDoc.AttributeManager.FindObjects( "com.autodesk.inventor.FaceAttributes", "FaceColor")
' Iterate through all faces that have colors and change.
Dim oFace As Face
Dim oAssets as Assets
oAssets = oPartDoc.Assets
Dim oAsset as Asset
oAsset = oAssets.Item("Bamboo")
For Each oFace In oFaces
oFace.Appearance = oAsset
Next
Solved! Go to Solution.