Remove DetailDrawingView text tag

Remove DetailDrawingView text tag

Curtis_Waguespack
Consultant Consultant
668 Views
11 Replies
Message 1 of 12

Remove DetailDrawingView text tag

Curtis_Waguespack
Consultant
Consultant

Can we programmatically remove the view identifier tag from the label of a detail boundary? 

 

I looked at the API for the detaildrawingview but either missed it or there is nothing to help:

https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-6570A69D-075F-4E23-AF01-09F339C493E2

 

I'm drawing a blank on another way to find it.

 

I can do this manually, as shown:

Curtis_Waguespack_0-1724256255582.png

 

This is the desired result

Curtis_Waguespack_1-1724256335323.png

 

 

EESignature

0 Likes
669 Views
11 Replies
Replies (11)
Message 2 of 12

Frederick_Law
Mentor
Mentor

Enter Space as Identifer.  You'll need to "fix" label in the view.

Detail-04.jpg

0 Likes
Message 3 of 12

Curtis_Waguespack
Consultant
Consultant

That would make the view name a space, so that won't work for my needs.

 

I'm looking for access the text/label in the detail fence.  To do this manually we can go to the detail fence object, right click on it and then choose Text. That allows us to delete the view identifier tag, as shown in the original post, and end up with the desired result.

Curtis_Waguespack_0-1724268515473.png

 

I should also mention, I'm looking to do this programmatically, as I create the detail view.

 

Dim oDetailView As DetailDrawingView
oDetailView = oSheet.DrawingViews.AddDetailView(oView2, DPP, 
	kFromBaseDrawingViewStyle, True, DCP, 0.5, , oView2.Scale * 2, True, "A")
	
'remove view identifier tag from the text item of a detail boundary  

 

EESignature

0 Likes
Message 4 of 12

Tiffany_Hayden_
Collaborator
Collaborator

@Curtis_Waguespack 

 

I've had to do this same thing. But to edit that tag instead of blanking it out. I believe the oView.Name is what you are looking for. oView.Name = oView.Name & vbCrLf & "SHT-" & strParentShtNum

 

I believe you can put a vbcrlf as a value instead of a space. I know that is technically a value but it won't be a space. This is not available currently but has been requested many times with Autodesk. So Hopefully they put this functionality in there without having to do a workaround. Let me know if this is what you are looking for. I primarily had to do this with section views in the past. Because the customer wanted the view label to have the sheet number on what shee the view was located. So lets say you had a main view on the first sheet and the section view was on the 3rd sheet. But the tag for the section view was on the first sheet. They wanted the tag on the first sheet for the section view to say SHT 3. For example. 

 

Here's an example. 

 

 

Public Function UpdateViewLabelWithSheetNumber(oView As DrawingView, _
                                               Optional showMessages As Boolean = False, _
                                               Optional onlyViewsToolWasUsedOn As Boolean = False) As Boolean
    ' Function to update the label of a drawing view with its sheet number.
    ' Assumes the view label follows a certain format and updates it accordingly.

    UpdateViewLabelWithSheetNumber = False
    If oView Is Nothing Then Exit Function

    ' Define variables
    Dim sheetNumber As String
    Dim viewLabelFormattedText As String
    Dim viewName As String
    Dim parentViewName As String
    Dim labelSheet As String
    Dim previousLabel As String
    Dim labelParts() As String
    
    ' Check for parent view
    If oView.ParentView Is Nothing Then Exit Function
    
    ' Get the sheet number of the parent view
    sheetNumber = GetSheetNumber(oView.ParentView.Parent)

    ' Retrieve the previous label's formatted text
    previousLabel = oView.Label.FormattedText
    labelParts = Split(previousLabel, "<Br/>")

    ' Set parent view name and label sheet if necessary
    parentViewName = Split(oView.ParentView.Name, vbCrLf)(0)
    If sheetNumber <> GetSheetNumber(oView.Parent) Then
        labelSheet = vbCrLf & "SHT-" & GetSheetNumber(oView.Parent)
    End If

    ' Update the label based on view type
    viewName = If(oView.ViewType = kDetailDrawingViewType, "DETAIL", "VIEW") & " " & parentViewName

    ' Prepare the formatted label text
    viewLabelFormattedText = "<StyleOverride Underline='True'>" & UCase(viewName) & "</StyleOverride>"

    ' Check and append scale information and sheet number if necessary
    If UBound(labelParts) > 0 Then
        For i = 0 To UBound(labelParts)
            If InStr(labelParts(i), "<DrawingViewScale/>") > 0 Then
                labelParts(i) = "<StyleOverride FontSize='0.3048'>SCALE </StyleOverride><DrawingViewScale/>"
            ElseIf InStr(labelParts(i), "SHT") > 0 Then
                labelParts(i) = labelSheet
            End If
        Next
        viewLabelFormattedText = Join(labelParts, "<Br/>")
    End If

    ' Append the sheet line if it's not already in the label
    If InStr(viewLabelFormattedText, "SHT") = 0 And labelSheet <> "" Then
        viewLabelFormattedText = viewLabelFormattedText & "<Br/>" & labelSheet
    End If

    ' Update the view's label with the new formatted text
    oView.Label.FormattedText = viewLabelFormattedText
    
    ' Return True indicating the label was updated
    UpdateViewLabelWithSheetNumber = True
End Function

 

 

 

 

 

 

Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 5 of 12

Curtis_Waguespack
Consultant
Consultant

@Tiffany_Hayden_ , thanks for the reply. 

 

Unfortunately, I don't think the name gives me access to what I'm after. Infact we want to preserve the view name. 

 

See this quick video, where the detail view boundary/fence is selected and Text is chosen from the context menu. And then in the resulting Format Text window the <VIEW IDENTIFIER> tag is deleted.

 

I'm trying to replicate this same workflow via automation, but I'm not seeing how we access the detail view fence text or detail view boundary text, or whatever it would be called.

 

 

EESignature

0 Likes
Message 6 of 12

Frederick_Law
Mentor
Mentor

Don't think there is access to them.

ilogic SelectionSet return "nothing" on the fence.

Message 7 of 12

Tiffany_Hayden_
Collaborator
Collaborator

You can wipe it by doing this. The name is the tag. The View Identifer in the Edit view controls the tag so if you get rid of it it gets rid of the view name. They are not separate objects. It would be good if they were. 

 

The view label formatted text controls the label on the base view. activedetail.Label.FormattedText So it will preserve the name of the view. And can be altered with additional information if needed. 

 

 

 

Sub ClearDetail()
    Dim activeDoc As DrawingDocument: Set activeDoc = ThisApplication.ActiveDocument
    Dim activeSheet As Sheet: Set activeSheet = activeDoc.activeSheet
    Dim activeDetail As DetailDrawingView
    Dim dwgViews As DrawingViews: Set dwgViews = activeSheet.DrawingViews
    Dim dwgView As DrawingView
    
    
    For Each dwgView In dwgViews
        If dwgView.ViewType = kDetailDrawingViewType Then
            Set activeDetail = dwgView
            Exit For
        End If
    
    
    Next
    
    activeDetail.Name = vbCrLf



End Sub

 

 

 

Tiffany_Hayden__0-1724333916039.png

 

Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 8 of 12

Curtis_Waguespack
Consultant
Consultant

@Frederick_Law , I think you're right I noticed that last night when looking at this using this snippet.

 

Dim oApp As Inventor.Application = ThisApplication
Dim oDoc As Document = oApp.ActiveDocument
Dim oSelectSet As SelectSet = oDoc.SelectSet

Dim Types As ObjectTypeEnum() = [Enum].GetValues(GetType(ObjectTypeEnum))

For Each obj As Object In oSelectSet
	Try
		oType = obj.Type
	Catch
		Logger.Info("Can not get type from selected object")
		Continue For
	End Try

	For Each Type As ObjectTypeEnum In Types
		If obj.Type = Type Then
			logger.info(Type.ToString)
		End If
	Next
Next

 

 

EESignature

Message 9 of 12

Curtis_Waguespack
Consultant
Consultant

@Tiffany_Hayden_ , The text object in the boundary/fence is a separate object from the view name. It simply references the name. We're not looking to modify the view name in any way, but simply clear the text object of the boundary/fence.

 

I also investigated setting the style of this object so that we could use a tiny text style to effectively hide the text, but as Frederick_Law mentioned it seems as though it's not accessible via the API. 

 

Curtis_Waguespack_0-1724335926421.png

 

 Not the answer we were hoping for, but I think this has helped me confirm that I wasn't overlooking something.

EESignature

0 Likes
Message 10 of 12

Tiffany_Hayden_
Collaborator
Collaborator

@Curtis_Waguespack I've noticed when it comes to tags that they aren't available in the API. Section views are the same way sadly. I see an idea board post in your future! lol Hope you were able to find a work around for your needs. 

Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 11 of 12

Frederick_Law
Mentor
Mentor

You can try:

Get <ViewIndentifier> value: ViewID = <ViewIndentifier>

Change View label text to: "Detail " + ViewID

Set <ViewIndentifier> to space: <ViewIndentifier> = " "

0 Likes
Message 12 of 12

Frederick_Law
Mentor
Mentor

@Curtis_Waguespack wrote:

I think you're right I noticed that last night when looking at this using this snippet.

 


Even debug in VS got Nothing.

Don't if there is a sketch or text object somewhere in the sheet or view.

The fence does have points.

0 Likes