How to change a text into upper case in a Drawing File

How to change a text into upper case in a Drawing File

deffysalfauzi
Enthusiast Enthusiast
275 Views
1 Reply
Message 1 of 2

How to change a text into upper case in a Drawing File

deffysalfauzi
Enthusiast
Enthusiast

Question

How to change a text into upper case in this ilogic. example in Project & Part Number in iProperties Model.

 

Based on this post

https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/ilogic-to-change-sheet-name-in-drawi... 

 

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("Project").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

 

Screenshot 2022-11-25 222616.png

0 Likes
276 Views
1 Reply
Reply (1)
Message 2 of 2

JelteDeJong
Mentor
Mentor

Strings have a method ToUpper. I think that is what you are looking for.

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("Project").Value
		c1.ToUpper()

		Dim c3 As String = d.PropertySets.Item(3).Item("Part Number").Value
		c3.ToString()

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

End Sub

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com