Sheet Name (number) Hide Page Prefix Zero

Sheet Name (number) Hide Page Prefix Zero

Anonymous
Not applicable
706 Views
5 Replies
Message 1 of 6

Sheet Name (number) Hide Page Prefix Zero

Anonymous
Not applicable

Reference Post: Sheet name (number)

 

Hi there,
I want to make something similar, but I cant "hide" de letter after the sheet number arrives to 10.

 

Example: I define 1 custom iProperty called "page" with number "0".

 

My First Page is: page<sheet number>

 

It will give me 01... OK! 😉 Then...

 

02, 03, 04, etc... 09... 010 ???

 

I want to hide the "page" custom iProperty when the number is < or = 10.

 

Im trying some codes but I cant reach it there 😞

 

help?

 

MANY THANKS 😉

0 Likes
Accepted solutions (1)
707 Views
5 Replies
Replies (5)
Message 2 of 6

tdant
Collaborator
Collaborator

I think I understand the problem. Create and iLogic rule and paste this code inside:

 

For Each sheet As Sheet In ThisApplication.ActiveDocument.Sheets
	Dim sheetNumArr As Array = Split(Sheet.Name, ":")
	
	If UBound(sheetNumArr) > 0 Then	
		Dim rightMost As Integer = CInt(sheetNumArr(UBound(sheetNumArr)))
	
		If rightMost < 10 Then
			page = "0" & CStr(rightMost)
		Else
			page = CStr(rightMost)
		End If
	End If
Next

Click "Save and Run" and check the values of "page".

Message 3 of 6

Anonymous
Not applicable

It works but the "iproperty" will be always 0...

 

I create new pages and then the page number 10, is "010"... I want to remove the "0" Robot wink

 

The only solution that I make is this:

  

Dim oSheet As Sheet
Dim SheetNumber As String
Dim List As New ArrayList

List.add("page")
	
oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")

i = 1

For Each oCustProp In oCustomPropertySet

	If List.Contains(oCustProp.Name) Then
	
		For Each oSheet In ThisApplication.ActiveDocument.Sheets
	

			SheetNumber  = Mid(oSheet.Name, InStr(1, oSheet.Name, ":") + 1)

								
				If SheetNumber < 10 Then
					ActiveSheet.TitleBlock = "Legenda_1_completa"
					iProperties.Value("Custom", "page") = "0"

				ElseIf SheetNumber >= 10 Then
					ActiveSheet.TitleBlock = "Legenda_2_completa"

				End If
				
			 i=1+1

		Next
	
						oDoc = ThisDoc.Document
						SheetNumber  = Mid(oDoc.ActiveSheet.Name, InStr(1, oDoc.ActiveSheet.Name, ":") + 1)
						
						If SheetNumber < 10 Then
							ActiveSheet.TitleBlock = "Legenda_1_completa"
							iProperties.Value("Custom", "page") = "0"
						
ElseIf SheetNumber >= 10 Then
							ActiveSheet.TitleBlock = "Legenda_2_completa"
		
						End If
	
	End If

Next

But I use 2 Title Blocks... It seams that I have to make like this Smiley Frustrated

0 Likes
Message 4 of 6

bradeneuropeArthur
Mentor
Mentor

Can you please make a screenshot of your drawing with the layout you need?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 6

Curtis_Waguespack
Consultant
Consultant

Hi @Anonymous,

 

I'm not sure I understand the need for the number or how it will be used, but this simple ilogic rule increments the sheet name with a leading zero for all numbers less than 10.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

sPrefix = "Page "

i = 1
'rename all sheets incrementing suffix
For Each sheet As Sheet In ThisApplication.ActiveDocument.Sheets
sheet.Name = sPrefix + If(i < 10, "0" + CStr(i), CStr(i))
i = i + 1
Next

 

 

EESignature

0 Likes
Message 6 of 6

tdant
Collaborator
Collaborator
Accepted solution

I think what the OP wants is to edit the sheet property "Sheet Number" to include leading zeroes up to 2 digits.

 

From what I can tell, the API doesn't allow access to that property, and anything that can be controlled via the API can't be effectively used in the title block. Unless there's a way to  use something like Drawing.AttributeSets in place of "sheet number" in the title block, I think we're out of luck.