AnsweredAssumed Answered

how to remove color on the face

Question asked by xianbin Huang on Sep 28, 2016
Latest reply on Sep 29, 2016 by xianbin Huang

hi all

    I write a code to remove color on the face of the active configuration,but  when i run the code ,the color on the face of other configuration will be removed,can you help me ?(   i have set swModelExt.LinkedDisplayState = True)



Public Sub RemoveAllColor()

Dim swapp                   As SldWorks.SldWorks

Dim swModel                 As SldWorks.ModelDoc2

Dim swPrt                   As SldWorks.PartDoc

Dim swBodies()                As SldWorks.Body2

Dim swBody                  As SldWorks.Body2

Dim vBody                   As Variant

Dim vBodyArr                As Variant

Dim path               As String

Dim vconfigname        As String

Dim swFaces()               As Face2

Dim swFace                  As Face2

Dim vFace                   As Variant

Dim vProps                  As Variant

Dim bRet                    As Boolean

Set swapp = Application.SldWorks

Set swModel = swapp.ActiveDoc

Set swPrt = swModel

swBodies = swPrt.GetBodies2(swAllBodies, True)

For Each vBody In swBodies

       Set swBody = vBody

        swFaces = swBody.GetFaces()

        For Each vFace In swFaces

            Set swFace = vFace

            bRet = swFace.RemoveMaterialProperty2(1, Empty)



end sub