Adding the 'View Identifier' to a view label using ilogic

Adding the 'View Identifier' to a view label using ilogic

andrewdroth
Advisor Advisor
527 Views
8 Replies
Message 1 of 9

Adding the 'View Identifier' to a view label using ilogic

andrewdroth
Advisor
Advisor

I can't seem to work out how to add the view label property 'View Identifier' to a view label using ilogic. I can add part iproperties just fine, but this one is allusive.

It needs to be the linked parameter like when a view is created, not a copy of the string.

andrewdroth_0-1739217149392.png

 

 

 

I wish we had something like this to work with.
https://forums.autodesk.com/t5/inventor-ideas/capture-ilogic-drawing-annotation-code-directly-from-o...


Andrew Roth
rothmech.com

YouTube IconLinkedIn Icon


IV2025 Pro
Apple IIe Workstation
65C02 1.023 MHz, 64 KB RAM
Apple DOS 3.3
0 Likes
Accepted solutions (1)
528 Views
8 Replies
Replies (8)
Message 2 of 9

Curtis_Waguespack
Consultant
Consultant

@andrewdroth , I had an example for extracting view label code on here at one point. I think one of these "archived" links might be it, but can't tell. Maybe @Tarek_K can bring them back. Tarek can you please take a look when you have a chance:

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

https://forums.autodesk.com/t5/inventor-forum/inventor-2014-detail-multiple-parts-on-a-single-sheet/...

 

 

In the mean time let me dig through my examples and see it I have a copy of this, if not I'll recreate it... if someone doesn't beat me to it.

 

 

EESignature

0 Likes
Message 3 of 9

andrewdroth
Advisor
Advisor

Thanks @Curtis_Waguespack ! 😁

Less so, AutoDesk... 😠


Andrew Roth
rothmech.com

YouTube IconLinkedIn Icon


IV2025 Pro
Apple IIe Workstation
65C02 1.023 MHz, 64 KB RAM
Apple DOS 3.3
Message 4 of 9

Curtis_Waguespack
Consultant
Consultant
Accepted solution

@andrewdroth, okay I didn't find what I was looking for but threw this together from memory and another example. 

 

Post back if this isn't what you're after.

 

Hope this helps,

Curtis

 

use this utility rule to extract the formatted text, for use in your real rule

Dim oView As DrawingView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select View")
oStringScale = oView.Label.FormattedText
InputBox("Copy this formatted text", "iLogic", oStringScale)

 

Curtis_Waguespack_2-1739219788478.png

 

 

And then you can use the extracted formatted text to do something like this to set the view string

 

Dim oViews As DrawingViews
Dim oView As DrawingView

For Each  oSheet As Sheet In  ThisDoc.Document.Sheets
	oViews = oSheet.DrawingViews
	For Each oView In oViews
		oView.ShowLabel = True
		oViewString = "<DrawingViewName/>" & "<Br/>" & "Hello World"
		'add to the view label
		oView.Label.FormattedText = oViewString
	Next
Next

 

Curtis_Waguespack_1-1739219629967.png

 

EESignature

0 Likes
Message 5 of 9

Curtis_Waguespack
Consultant
Consultant

Here is some help info on Formatted Text... it's really buried in the API help, so you kinda' gott'a "know it's there to know it's there" but it's something to be aware of as well. https://help.autodesk.com/view/INVNTOR/2025/ENU/?guid=GUID-915B75BA-4696-4fc7-A2C6-54B2BACDE7E1

 

Also, keep in mind you can add style overrides, etc, and then the previous utility rule will extract that formatting for you... for the most part ( just noticed the color override didn't extract).

 

Curtis_Waguespack_1-1739220161207.png

 

Curtis_Waguespack_2-1739220178059.png

 

 

EESignature

0 Likes
Message 6 of 9

andrewdroth
Advisor
Advisor

Excellent, that is exactly what I was looking for. Thank you!


Andrew Roth
rothmech.com

YouTube IconLinkedIn Icon


IV2025 Pro
Apple IIe Workstation
65C02 1.023 MHz, 64 KB RAM
Apple DOS 3.3
Message 7 of 9

Tarek_K
Autodesk
Autodesk

Note - even if it seems not needed already anymore but the referred topics are back @Curtis_Waguespack 

You found a post helpful? Then feel free to give likes to these posts!
Your question got successfully answered? Then just click on the 'Mark as solution' button. 


Tarek Khodr
Community Manager

Message 8 of 9

harshkumar_patelGP698
Autodesk
Autodesk

How can I change the Visibility of View label using api ?

0 Likes
Message 9 of 9

WCrihfield
Mentor
Mentor

Hi @harshkumar_patelGP698.  This was sort of shown within the second portion of Curtis' earlier reply (Message 4), but you would have to set the DrawingView.ShowLabel property to True or False.  Below is another example code which iterates through each sheet, then each view on each sheet, and makes sure the view label is shown.  There are some settings which help with where it will be located by default when it first shows, but we can also move its location if needed (DrawingView.Label.Position property).

Dim oDDoc As DrawingDocument = TryCast(ThisDoc.Document, Inventor.DrawingDocument)
If oDDoc Is Nothing Then Return
Dim oActvSheet As Inventor.Sheet = oDDoc.ActiveSheet
For Each oSheet As Inventor.Sheet In oDDoc.Sheets
	oSheet.Activate()
	For Each oView As DrawingView In oSheet.DrawingViews
		oView.ShowLabel = True
	Next
Next
oActvSheet.Activate()

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)