How to batch-edit view labels in existing drawing?

How to batch-edit view labels in existing drawing?

hubert.baissac
Participant Participant
2,738 Views
8 Replies
Message 1 of 9

How to batch-edit view labels in existing drawing?

hubert.baissac
Participant
Participant

Hi All,

 

I have in front of me an old company drawing with 23 sheets, and many more base-views with labels. I need to edit these view labels to match our current template's "view label defaults". This will show some model iProperties such as <Part Number>, <Filename> etc.

 

Does anyone know how I can automatically change all the existing view labels to the new format that I want? I know how to do it manually, but that's what I'm trying to avoid in order to save some time. 

 

Thanks in advance for your help.

 

Hubert

 

Autodesk Inventor Professional 2020

64-Bit Edition

Build: 310, Release: 2020.2.1 - Date: Fri 01/10/2020

 

 

Accepted solutions (1)
2,739 Views
8 Replies
Replies (8)
Message 2 of 9

mcgyvr
Consultant
Consultant

You would likely need to use ilogic to loop through each and modify as needed..

This thread should get you started..

https://forums.autodesk.com/t5/inventor-customization/ilogic-code-to-change-view-label-text/td-p/362...

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 3 of 9

johnsonshiue
Community Manager
Community Manager

Hi! Another way to do it is to use the Drawing Batch Update tool included in the SDK tool in C:\Users\Public\Documents\Autodesk\Inventor 2021\SDK.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 4 of 9

hubert.baissac
Participant
Participant

Thanks for that @mcgyvr . I will look into it

0 Likes
Message 5 of 9

hubert.baissac
Participant
Participant

Thanks @johnsonshiue ,

 

I had no idea SDK tools existed. I gave this a go but it looks like the batch update tool will not update existing view labels. Unless I am doing something wrong?

0 Likes
Message 6 of 9

hubert.baissac
Participant
Participant

OK so I've had a go at modifying the iLogic code written by @Curtis_Waguespack on the below forum as directed by @mcgyvr :
https://forums.autodesk.com/t5/inventor-customization/ilogic-code-to-change-view-label-text/m-p/3633...

 

First and foremost I don't have much experience with iLogic, but I have tinkered a bit with it before. The code attached does work, much to my surprise, and is nearly what I'm after. 

 

The only property missing in my labels is <FILENAME>. It's a model property that can easily be added when editing a view label, but I can't find it in the "Inventor iProperty Name Table" (see attached), and therefore I can't refer to it in the iLogic code. 

 

Would anyone have a solution to this?

 

Thanks again

Dim oSSet As SelectSet = ThisDoc.Document.SelectSet
If oSSet.Count = 0 Then
	MessageBox.Show("You must select a drawing view first", "iLogic")
Exit Sub
End If

'Reference to the drawing view from the 1st selected object
Dim oView As DrawingView = TryCast(oSSet.Item(1), DrawingView)

If oView IsNot Nothing Then
oView.ShowLabel = True
'format the model iproperties
oTitle = "<StyleOverride Underline='False' FontSize='0.2'><Property Document='model' PropertySet='Inventor Summary Information' Property='Title' FormatID='{F29F85E0-4FF9-1068-AB91-08002B27B3D9}' PropertyID='2'>TITLE</Property></StyleOverride>"
oDescription = "<Br/><StyleOverride Underline='False' FontSize='0.2'><Property Document='model' PropertySet='Design Tracking Properties' Property='Description' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='29'>DESCRIPTION</Property></StyleOverride>"
oComments = "<Br/><StyleOverride Underline='False' FontSize='0.2'><Property Document='model' PropertySet='Inventor Summary Information' Property='Comments' FormatID='{F29F85E0-4FF9-1068-AB91-08002B27B3D9}' PropertyID='6'>COMMENTS</Property></StyleOverride>"
oPartNumber = "<Br/><StyleOverride Underline='False' FontSize='0.2'><Property Document='model' PropertySet='Design Tracking Properties' Property='Part Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>PART NUMBER</Property></StyleOverride>"
'oStringMass = "<Br/><StyleOverride Underline='False' FontSize='0.35'>EST UNIT MASS = <PhysicalProperty PhysicalPropertyID='72449' Precision='2'>MASS</PhysicalProperty></StyleOverride>"
'oStringScale = "<Br/><StyleOverride FontSize='0.3'>(Scale <DrawingViewScale/>)</StyleOverride>"

'add to the view label
oView.Label.FormattedText = oTitle & oDescription & oComments & oPartNumber    

Else
	MessageBox.Show("The selected object is not a drawing view", "iLogic")
End If


 

0 Likes
Message 7 of 9

mcgyvr
Consultant
Consultant
Accepted solution

@hubert.baissac 

Dim oSSet As SelectSet = ThisDoc.Document.SelectSet
If oSSet.Count = 0 Then
	MessageBox.Show("You must select a drawing view first", "iLogic")
Exit Sub
End If

'Reference to the drawing view from the 1st selected object
Dim oView As DrawingView = TryCast(oSSet.Item(1), DrawingView)

If oView IsNot Nothing Then
oView.ShowLabel = True
'format the model iproperties
oTitle = "<StyleOverride Underline='False' FontSize='0.2'><Property Document='model' PropertySet='Inventor Summary Information' Property='Title' FormatID='{F29F85E0-4FF9-1068-AB91-08002B27B3D9}' PropertyID='2'>TITLE</Property></StyleOverride>"
oDescription = "<Br/><StyleOverride Underline='False' FontSize='0.2'><Property Document='model' PropertySet='Design Tracking Properties' Property='Description' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='29'>DESCRIPTION</Property></StyleOverride>"
oComments = "<Br/><StyleOverride Underline='False' FontSize='0.2'><Property Document='model' PropertySet='Inventor Summary Information' Property='Comments' FormatID='{F29F85E0-4FF9-1068-AB91-08002B27B3D9}' PropertyID='6'>COMMENTS</Property></StyleOverride>"
oPartNumber = "<Br/><StyleOverride Underline='False' FontSize='0.2'><Property Document='model' PropertySet='Design Tracking Properties' Property='Part Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>PART NUMBER</Property></StyleOverride>"
oFileName = "<Br/><StyleOverride Underline='False' FontSize='0.2'>" & oSSet.Item(1).ReferencedFile.DisplayName & "</StyleOverride>"


'add to the view label
oView.Label.FormattedText = oTitle & oDescription & oComments & oPartNumber & oFileName   

Else
	MessageBox.Show("The selected object is not a drawing view", "iLogic")
End If

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 8 of 9

mcgyvr
Consultant
Consultant

@hubert.baissac  And if what you really wanted was the filename and Windows path of the file then replace the oFileName line in the code above with this..

 

oFileName = "<Br/><StyleOverride Underline='False' FontSize='0.2'>" & oSSet.Item(1).ReferencedFile.FullFileName & "</StyleOverride>"


-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 9 of 9

hubert.baissac
Participant
Participant

@mcgyvr Legend! That does exactly what I want it to. 

Thanks for your help, this will speed things up dramatically.

0 Likes