Cancel
Showing results for 
Search instead for 
Did you mean: 

change the style of features for each in occurrencedocs, does not work!?

Pioneer
Pioneer

Hi there, 

I'm on to a doole to change all feature-colors (faces) of parts/occurences to a style, but it doesn't work for th occurrencedocs...

(but it works for a single partdoc!)

 

is there any unknown .update for the assembly or should it work ?

Smiley Wink and - no I don't mean objOcc.Style, it is the aim to change the parts -> features- > style (don't ask why...)

 

        If DokTyp = "ASM" Then
            Dim ASMdoc As SolidEdgeAssembly.AssemblyDocument = SE_App.ActiveDocument

            Dim Linckgreen As SolidEdgeFramework.FaceStyle = ASMdoc.FaceStyles("0_linck_grün")
            For Each occ As SolidEdgeAssembly.Occurrence In ASMdoc.Occurrences
                If occ.Type = SolidEdgeFramework.ObjectType.igPart Then
                    Dim ParDoc As SolidEdgePart.PartDocument = occ.PartDocument
                    For Each feat In ParDoc.DesignEdgebarFeatures
                        ChangeFeat(feat, Linckgreen)
                    Next
                End If

            Next
            'ASMdoc.UpdateAll()
        ElseIf DokTyp = "PAR" Then
            Dim PARdoc As SolidEdgePart.PartDocument = SE_App.ActiveDocument
            Dim Linckgreen As SolidEdgeFramework.FaceStyle = PARdoc.FaceStyles("0_linck_grün")
            Dim Bronze As SolidEdgeFramework.FaceStyle = PARdoc.FaceStyles("Bronze")

            For Each feat In PARdoc.DesignEdgebarFeatures
                ChangeFeat(feat, Linckgreen)
            Next
            'PARdoc.Recompute
        End If

    End Sub

    Private Sub ChangeFeat(ByVal PartFeature As Object, ByVal FaceStyle As SolidEdgeFramework.FaceStyle)

        Try
            Dim style = PartFeature.GetStyle
            PartFeature.SetStyle(FaceStyle)

            'Dim style = feat.GetStyle()
            'MsgBox(style.StyleName)
        Catch ex As Exception

        End Try


    End Sub

 

1 REPLY

Re: change the style of features for each in occurrencedocs, does not work!?

Solution Partner Genius Solution Partner Genius
Solution Partner Genius

Hi,

I think that you are missing to make the occurrence writable .By default the documents are readonly if accessed from the asm.

Hope this helps,

Julian

For Each occ As SolidEdgeAssembly.Occurrence In ASMdoc.Occurrences
                If occ.Type = SolidEdgeFramework.ObjectType.igPart Then
occ.MakeWritable Dim ParDoc As SolidEdgePart.PartDocument = occ.PartDocument For Each feat In ParDoc.DesignEdgebarFeatures ChangeFeat(feat, Linckgreen) Next End If Next

 

Julian Guillo
Pixel Sistemas SL
Spain