ViewLabels and stuff

ViewLabels and stuff

mgrenier1
Advocate Advocate
146 Views
4 Replies
Message 1 of 5

ViewLabels and stuff

mgrenier1
Advocate
Advocate

I need to add prefixes to views through the style manager for an iLogic rule to work properly

Capture d’écran 2025-06-04 115319.png

 

But this is causing some unwanted side effects  and I could not find a way to turn it off

Capture d’écran 2025-06-04 115613.png

 

And here's the rule in question : 

 

' Librarie de code iLogic/VBA Métal Marquis
' Auteur: Mathieu Grenier
' Nom: Vues dépliées
' Catégorie: Règles de mises en plans
' Date: 2025-06-04
' Description: Place des vues dépliées pour chaque pièce de tolerie présente sur la feuille de dessin active
' Version: 1.0
' En développement: Oui
' Notes: 

Dim doc As DrawingDocument = ThisApplication.ActiveDocument
Dim sheet As Sheet = doc.ActiveSheet

Dim oOptions As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
oOptions.Add("SheetMetalFoldedModel", False)

For Each view As DrawingView In sheet.DrawingViews
    Dim viewName As String = view.Name.ToUpper()

    ' Ignorer les vues projetées ou générées automatiquement
    If viewName.StartsWith("PROJ") _
    Or viewName.StartsWith("AUX") _
    Or viewName.StartsWith("COUPE") _
    Or viewName.StartsWith("DRAFT") _
	Or viewName.StartsWith("DETAIL") _
    Or viewName.StartsWith("VIEW") Then
        Continue For
    End If

    Try
        Dim refDoc As PartDocument = Nothing
        Try
            refDoc = View.ReferencedDocumentDescriptor.ReferencedDocument
        Catch
            Continue For
        End Try

        If Not refDoc Is Nothing Then
            Dim def As SheetMetalComponentDefinition = Nothing
            Try
                def = refDoc.ComponentDefinition
            Catch
                Continue For
            End Try

            If def.HasFlatPattern Then
                If def.FlatPattern Is Nothing Then
                    def.Unfold()
                    def.FlatPattern.ExitEdit()
                End If

                Dim pt As Point2d = ThisApplication.TransientGeometry.CreatePoint2d( _
                    View.Center.X, View.Center.Y + 10)

                Dim oFlatView As DrawingView = sheet.DrawingViews.AddBaseView( _
                    refDoc, _
                    pt, _
                    View.Scale, _
                    ViewOrientationTypeEnum.kFrontViewOrientation, _
                    DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle, _
                    , , oOptions)
					oFlatView.ShowLabel = False
                	oFlatView.Name = "FLAT_" & view.Name
            End If
        End If
    Catch
        Continue For
    End Try
Next

 

So like, the rule need to ignore every view on the active drawing sheet that isn't a base view.

How can I achieve this, or just hide the view prefix from the section view lines and the detail bubble?

0 Likes
147 Views
4 Replies
Replies (4)
Message 2 of 5

mgrenier1
Advocate
Advocate

Never mind, I figured it out

0 Likes
Message 3 of 5

C_Haines_ENG
Collaborator
Collaborator

You should include your solution, and mark it as the solution to close out the thread. 

0 Likes
Message 4 of 5

mgrenier1
Advocate
Advocate

Is it really a solution if I just turned it off ? 😂

0 Likes
Message 5 of 5

C_Haines_ENG
Collaborator
Collaborator

😂I guess not, but you could just check what type of view you were on instead of grabbing a prefix.

Dim oDoc As DrawingDocument = ThisDoc.Document

Dim oSheet As Sheet = oDoc.ActiveSheet

For Each oView As DrawingView In oSheet.DrawingViews
	
	MsgBox(oView.ViewType.ToString)
	
Next
0 Likes