How do I access the Solid to reset the appearance?

How do I access the Solid to reset the appearance?

JBEDsol
Collaborator Collaborator
321 Views
1 Reply
Message 1 of 2

How do I access the Solid to reset the appearance?

JBEDsol
Collaborator
Collaborator

I have a code to transverse an assembly to reset the colors for a given file.  Essentially it's to paint an imported step file.  Sometimes the file has the colors set to 246,201,122 etc.  I want as part of my paint code to grab all the solids and set to "As Part".  How do I do this?

0 Likes
322 Views
1 Reply
Reply (1)
Message 2 of 2

Ralf_Krieg
Advisor
Advisor

Hello

 

There's a sample in the Inventor API help:

Public Sub RemovePartOverrides()
    ' Get the active part document.
    Dim partDoc As PartDocument
    Set partDoc = ThisApplication.ActiveDocument

    ' Iterate through the objects that have an override.
    Dim obj As Object
    For Each obj In partDoc.ComponentDefinition.AppearanceOverridesObjects
        ' Set the source of the appearance based on the type of object.
        ' It's possible to use kPartAppearance in all cases, but this sets
        ' it to the default source used by Inventor when no overrides exist.
        If TypeOf obj Is SurfaceBody Then
            obj.AppearanceSourceType = kPartAppearance
        ElseIf TypeOf obj Is PartFeature Then
            obj.AppearanceSourceType = kBodyAppearance
        ElseIf TypeOf obj Is Face Then
            obj.AppearanceSourceType = kFeatureAppearance
        Else
            MsgBox "Unexpected type with appearance override: " & TypeName(obj)
        End If
    Next
End Sub

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes