ilogic to change sheet name in drawing

ilogic to change sheet name in drawing

deffysalfauzi
Enthusiast Enthusiast
829 Views
14 Replies
Message 1 of 15

ilogic to change sheet name in drawing

deffysalfauzi
Enthusiast
Enthusiast

Hi, help me. I would like to change my sheet name to be sequentially numbers as shown below. Thanks.

 

FYI,
Nomenclature :
RTU-385-001 - 385-Filter Support BT_Top 2:1

 

Note :
RTU-385 = .ipt > iproperties > project > stock number

<space>-<space> = separator
001,002,003,.... = sequentially numbers as sheet number (3 digit)
385-Filter Support BT_Top 2 = .ipt > iproperties > project > part number
:1,2,3,.... = sheet number

 

Screenshot 2022-11-05 204139.png

0 Likes
Accepted solutions (3)
830 Views
14 Replies
Replies (14)
Message 2 of 15

bradeneuropeArthur
Mentor
Mentor

Via I-logic vba or vb.net?

 

Via I-logic:

Public Sub main
	
	Dim a As Inventor.DrawingDocument = ThisDrawing.Document
	Dim sht As Inventor.Sheet
	Dim shts As Inventor.Sheets
	Dim c2 As Integer = 0
	For Each sht In a.Sheets
		c2=c2+1
		Dim d As Inventor.Document = sht.DrawingViews.Item(1).ReferencedDocumentDescriptor.ReferencedDocument

		Dim c1 As String = d.PropertySets.Item(3).Item("stock number").Value
		
		Dim c3 As String = d.PropertySets.Item(3).Item( "part number").Value
		
		sht.Name = c1 & "-" & "00" & c2 & c3 '& ":" & c2
	Next
	
	
End Sub

 

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 3 of 15

deffysalfauzi
Enthusiast
Enthusiast

Wow thanks very much. How about 3 digit number, start from 001 to 999. Likes this one :

 

RTU-385-001

....

RTU-385-008

RTU-385-009

RTU-385-010

....

RTU-385-999

0 Likes
Message 4 of 15

bradeneuropeArthur
Mentor
Mentor
Hi,
Is the rest of the code fine for you, only the digits from 001 to 999!?

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 15

bradeneuropeArthur
Mentor
Mentor

is this what you need then?

Public Sub Main
	
	Dim a As Inventor.DrawingDocument = ThisDrawing.Document
	Dim sht As Inventor.Sheet
	Dim shts As Inventor.Sheets
	Dim c2 As Integer = 0
	For Each sht In a.Sheets
		c2=c2+1
		Dim d As Inventor.Document = sht.DrawingViews.Item(1).ReferencedDocumentDescriptor.ReferencedDocument

		Dim c1 As String = d.PropertySets.Item(3).Item("stock number").Value
		
		Dim c3 As String = d.PropertySets.Item(3).Item( "part number").Value
		
		
		If c2<999 Then
			
			If c2<99 Then
				If c2<10 Then
			
		sht.Name = c1 & "-" & "00" & c2 & c3 '& ":" & c2
		
		End If
				Else
			
		sht.Name = c1 & "-" & "0" & c2 & c3 '& ":" & c2
		
		End If
			Else
		sht.Name = c1 & "-" & "" & c2 & c3 '& ":" & c2
		
		End If
	Next
	
	
End Sub

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 6 of 15

deffysalfauzi
Enthusiast
Enthusiast

@bradeneuropeArthur wrote:

Via I-logic vba or vb.net?

 

Via I-logic:

Public Sub main
	
	Dim a As Inventor.DrawingDocument = ThisDrawing.Document
	Dim sht As Inventor.Sheet
	Dim shts As Inventor.Sheets
	Dim c2 As Integer = 0
	For Each sht In a.Sheets
		c2=c2+1
		Dim d As Inventor.Document = sht.DrawingViews.Item(1).ReferencedDocumentDescriptor.ReferencedDocument

		Dim c1 As String = d.PropertySets.Item(3).Item("stock number").Value
		
		Dim c3 As String = d.PropertySets.Item(3).Item( "part number").Value
		
		sht.Name = c1 & "-" & "00" & c2 & c3 '& ":" & c2
	Next
	
	
End Sub

 


Screenshot 2022-11-06 223829.png

ilogic from sheet 1 to 15, different from the goal likes this :

RTU-385-001 - 385-Filter Support BT_Top 2:1

....

RTU-385-008

RTU-385-009

RTU-385-010

....

RTU-385-999

 

Note :
RTU-385 = stock number

<space>-<space> = separator
001,002,...,099,...,999 = sequentially numbers same as sheet number (3 digit)
385-Filter Support BT_Top 2 = part number
:1,2,3,.... = sheet number

 

0 Likes
Message 7 of 15

deffysalfauzi
Enthusiast
Enthusiast

@bradeneuropeArthur wrote:

is this what you need then?

Public Sub Main
	
	Dim a As Inventor.DrawingDocument = ThisDrawing.Document
	Dim sht As Inventor.Sheet
	Dim shts As Inventor.Sheets
	Dim c2 As Integer = 0
	For Each sht In a.Sheets
		c2=c2+1
		Dim d As Inventor.Document = sht.DrawingViews.Item(1).ReferencedDocumentDescriptor.ReferencedDocument

		Dim c1 As String = d.PropertySets.Item(3).Item("stock number").Value
		
		Dim c3 As String = d.PropertySets.Item(3).Item( "part number").Value
		
		
		If c2<999 Then
			
			If c2<99 Then
				If c2<10 Then
			
		sht.Name = c1 & "-" & "00" & c2 & c3 '& ":" & c2
		
		End If
				Else
			
		sht.Name = c1 & "-" & "0" & c2 & c3 '& ":" & c2
		
		End If
			Else
		sht.Name = c1 & "-" & "" & c2 & c3 '& ":" & c2
		
		End If
	Next
	
	
End Sub

result from ilogic :

kode2.png

can you change the code.

 

***Sorry, my English is not good enough

 

0 Likes
Message 8 of 15

bradeneuropeArthur
Mentor
Mentor

This will finally do the trick:

Public Sub Main
	
	Dim a As Inventor.DrawingDocument = ThisDrawing.Document
	Dim sht As Inventor.Sheet
	Dim shts As Inventor.Sheets
	Dim c2 As Integer = 0
	For Each sht In a.Sheets
		c2=c2+1
		Dim d As Inventor.Document = sht.DrawingViews.Item(1).ReferencedDocumentDescriptor.ReferencedDocument

		Dim c1 As String = d.PropertySets.Item(3).Item("stock number").Value
		
		Dim c3 As String = d.PropertySets.Item(3).Item( "part number").Value
		
		
		
		
			
		If c2>0 And c2<9 Then
		sht.Name = c1 & "-" & "00" & c2 & c3 '& ":" & c2
	ElseIf c2>99 And c2 <999
		sht.Name = c1 & "-" & "" & c2 & c3 '& ":" & c2
	ElseIf c2>9 And c2<99
		sht.Name = c1 & "-" & "0" & c2 & c3 '& ":" & c2
	End If

		
		
			
	Next
	
	
End Sub

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 9 of 15

deffysalfauzi
Enthusiast
Enthusiast

@bradeneuropeArthur wrote:

This will finally do the trick:

 

 

Public Sub Main
	
	Dim a As Inventor.DrawingDocument = ThisDrawing.Document
	Dim sht As Inventor.Sheet
	Dim shts As Inventor.Sheets
	Dim c2 As Integer = 0
	For Each sht In a.Sheets
		c2=c2+1
		Dim d As Inventor.Document = sht.DrawingViews.Item(1).ReferencedDocumentDescriptor.ReferencedDocument

		Dim c1 As String = d.PropertySets.Item(3).Item("stock number").Value
		
		Dim c3 As String = d.PropertySets.Item(3).Item( "part number").Value
		
		
		
		
			
		If c2>0 And c2<9 Then
		sht.Name = c1 & "-" & "00" & c2 & c3 '& ":" & c2
	ElseIf c2>99 And c2 <999
		sht.Name = c1 & "-" & "" & c2 & c3 '& ":" & c2
	ElseIf c2>9 And c2<99
		sht.Name = c1 & "-" & "0" & c2 & c3 '& ":" & c2
	End If

		
		
			
	Next
	
	
End Sub

 

 


code3.png

Sheet:9 ?

 

change to this ?

ElseIf c2>=9 And c2<99
0 Likes
Message 10 of 15

bradeneuropeArthur
Mentor
Mentor
Accepted solution

we come closer:

Public Sub Main
	
	Dim a As Inventor.DrawingDocument = ThisDrawing.Document
	Dim sht As Inventor.Sheet
	Dim shts As Inventor.Sheets
	Dim c2 As Integer = 0
	For Each sht In a.Sheets
		c2=c2+1
		Dim d As Inventor.Document = sht.DrawingViews.Item(1).ReferencedDocumentDescriptor.ReferencedDocument

		Dim c1 As String = d.PropertySets.Item(3).Item("stock number").Value
		
		Dim c3 As String = d.PropertySets.Item(3).Item( "part number").Value
		
		If c2>0 And c2<10 Then
		sht.Name = c1 & "-" & "00" & c2 & c3 '& ":" & c2
	ElseIf c2>99 And c2 <1000
		sht.Name = c1 & "-" & "" & c2 & c3 '& ":" & c2
	ElseIf c2>9 And c2<100
		sht.Name = c1 & "-" & "0" & c2 & c3 '& ":" & c2
	End If

		
		
			
	Next
	
	
End Sub

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 11 of 15

deffysalfauzi
Enthusiast
Enthusiast

code4.png

can you give a (space)-(space) like this " - " without quote between like this c2 & c3

c2 & " - " & c3

 

		sht.Name = c1 & "-" & "00" & c2 & c3 '& ":" & c2
	ElseIf c2>99 And c2 <1000
		sht.Name = c1 & "-" & "" & c2 & c3 '& ":" & c2
	ElseIf c2>9 And c2<100
		sht.Name = c1 & "-" & "0" & c2 & c3 '& ":" & c2

 

0 Likes
Message 12 of 15

bradeneuropeArthur
Mentor
Mentor
Accepted solution
Public Sub Main
	
	Dim a As Inventor.DrawingDocument = ThisDrawing.Document
	Dim sht As Inventor.Sheet
	Dim shts As Inventor.Sheets
	Dim c2 As Integer = 0
	For Each sht In a.Sheets
		c2=c2+1
		Dim d As Inventor.Document = sht.DrawingViews.Item(1).ReferencedDocumentDescriptor.ReferencedDocument

		Dim c1 As String = d.PropertySets.Item(3).Item("stock number").Value
		
		Dim c3 As String = d.PropertySets.Item(3).Item( "part number").Value
		
		If c2>0 And c2<10 Then
		sht.Name = c1 & " - " & "00" & c2 & " - " & c3 '& ":" & c2
	ElseIf c2>99 And c2 <1000
		sht.Name = c1 & " - " & "" & c2& " - " & c3 '& ":" & c2
	ElseIf c2>9 And c2<100
		sht.Name = c1 & " - " & "0" & c2& " - " & c3 '& ":" & c2
	End If
		
	Next
	
	
End Sub

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 13 of 15

deffysalfauzi
Enthusiast
Enthusiast
Accepted solution

kode4edit.png

 
Public Sub Main
	
	Dim a As Inventor.DrawingDocument = ThisDrawing.Document
	Dim sht As Inventor.Sheet
	Dim shts As Inventor.Sheets
	Dim c2 As Integer = 0
	For Each sht In a.Sheets
		c2=c2+1
		Dim d As Inventor.Document = sht.DrawingViews.Item(1).ReferencedDocumentDescriptor.ReferencedDocument

		Dim c1 As String = d.PropertySets.Item(3).Item("stock number").Value
		
		Dim c3 As String = d.PropertySets.Item(3).Item( "part number").Value
		
		If c2>0 And c2<10 Then
		sht.Name = c1 & "-" & "00" & c2 & " - " & c3 '& ":" & c2
	ElseIf c2>99 And c2 <1000
		sht.Name = c1 & "-" & "" & c2 & " - " & c3 '& ":" & c2
	ElseIf c2>9 And c2<100
		sht.Name = c1 & "-" & "0" & c2 & " - " & c3 '& ":" & c2
	End If
			
	Next
	
End Sub
0 Likes
Message 14 of 15

deffysalfauzi
Enthusiast
Enthusiast

@bradeneuropeArthur wrote:

we come closer:

Public Sub Main
	
	Dim a As Inventor.DrawingDocument = ThisDrawing.Document
	Dim sht As Inventor.Sheet
	Dim shts As Inventor.Sheets
	Dim c2 As Integer = 0
	For Each sht In a.Sheets
		c2=c2+1
		Dim d As Inventor.Document = sht.DrawingViews.Item(1).ReferencedDocumentDescriptor.ReferencedDocument

		Dim c1 As String = d.PropertySets.Item(3).Item("stock number").Value
		
		Dim c3 As String = d.PropertySets.Item(3).Item( "part number").Value
		
		If c2>0 And c2<10 Then
		sht.Name = c1 & "-" & "00" & c2 & c3 '& ":" & c2
	ElseIf c2>99 And c2 <1000
		sht.Name = c1 & "-" & "" & c2 & c3 '& ":" & c2
	ElseIf c2>9 And c2<100
		sht.Name = c1 & "-" & "0" & c2 & c3 '& ":" & c2
	End If

		
		
			
	Next
	
	
End Sub

Based on this code, I changed and added a space between C2 and C3. thanks

 

		sht.Name = c1 & "-" & "00" & c2 & " - " & c3 '& ":" & c2
	ElseIf c2>99 And c2 <1000
		sht.Name = c1 & "-" & "" & c2 & " - " & c3 '& ":" & c2
	ElseIf c2>9 And c2<100
		sht.Name = c1 & "-" & "0" & c2 & " - " & c3 '& ":" & c2
Message 15 of 15

deffysalfauzi
Enthusiast
Enthusiast

Thank you very much. Exported to AutoCAD so it looks like this.

THANKS.png

0 Likes