Help: iLogic Change Label of Drawing Views

Help: iLogic Change Label of Drawing Views

ngdnam88
Advocate Advocate
1,124 Views
8 Replies
Message 1 of 9

Help: iLogic Change Label of Drawing Views

ngdnam88
Advocate
Advocate

Hi All,

Please help me an iLogic Code to change the drawing view name as this picture.

A-001.jpg

I really read some topic that relative to my question (https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/ilogic-code-to-change-view-label-text/m... ) but in this case I only need to change the Label of View: ex. View 1 -> ISOMETRIC VIEW.

Thanks!

0 Likes
Accepted solutions (2)
1,125 Views
8 Replies
Replies (8)
Message 2 of 9

GosponZ
Collaborator
Collaborator
Accepted solution

'This in CAPITAL change for your need. Run rule select which view you need and click on view. Hope it will help
Dim
oList As String() = {"TOP VIEW","FRONT VIEW","FRONT VIEW @ REAR WALL","END VIEW ","EXPLODED VIEW ","BOTTOM VIEW","BACK VIEW","ISOMETRIC","ISOMETRIC-BACK", "ISOMETRIC-BOTTOM", "ISOMETRIC @ SIDE AND REAR WALL", "FLAT PATTERN"} Dim LabelName As String = InputListBox( _ "Select Label Name and then Pick Drawing View", _ oList, "", Title := "Label Names") If LabelName <> "" Then ' Get a drawing view selection from the user Dim oObject As Object oObject = ThisApplication.CommandManager.Pick( _ SelectionFilterEnum.kDrawingViewFilter, "Pick a feature") Dim oView As DrawingView = oObject oView.ShowLabel = True oView.Label.FormattedText = LabelName End If Beep

 

Message 3 of 9

ngdnam88
Advocate
Advocate

Thanks,

But I just wanna change Label Text as in this picture not in the Format Text. Is it possible with iLogic? Thanks,

A-002.jpg

0 Likes
Message 4 of 9

GosponZ
Collaborator
Collaborator

just do if you want what i offer you. You can replace all day long

0 Likes
Message 5 of 9

ngdnam88
Advocate
Advocate

Sorry, maybe my question is not clear.

Please see my picture, I just wanna to change Label Text in the "Model Tree" as this picture:

A-003.jpg

Thank you very much!

0 Likes
Message 6 of 9

A.Acheson
Mentor
Mentor
Accepted solution

Use 

oView.Name

Instead of  

oView.Label

If I am not mistaken the formatted text on the label would be to overwrite the original contents of the label. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 7 of 9

ngdnam88
Advocate
Advocate

Thanks all of you!

It's done now.

0 Likes
Message 8 of 9

maxim.teleguz
Advocate
Advocate

can you share your updated code so we dont go through testing what was changed?

0 Likes
Message 9 of 9

ngdnam88
Advocate
Advocate
Hi,
I just edited GosponZ's + A.Acheson's Codes:

Dim oList As String() = {"TOP VIEW","FRONT VIEW","FRONT VIEW @ REAR WALL","END VIEW ","EXPLODED VIEW ","BOTTOM VIEW","BACK VIEW","ISOMETRIC","ISOMETRIC-BACK", "ISOMETRIC-BOTTOM", "ISOMETRIC @ SIDE AND REAR WALL", "FLAT PATTERN"}
Dim LabelName As String = InputListBox("Select Label Name and then Pick Drawing View", oList, "", Title := "Label Names")
If LabelName <> "" Then
'Get a drawing view selection from the user
Dim oObject As Object
oObject = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Pick a feature")
Dim oView As DrawingView = oObject
oView.ShowLabel = True
oView.Name.FormattedText = LabelName
End If
Beep
0 Likes