change paper size name

change paper size name

GSK2019
Enthusiast Enthusiast
233 Views
2 Replies
Message 1 of 3

change paper size name

GSK2019
Enthusiast
Enthusiast

Hi,

 

I am writing a code. And so far everything works besides when you chose: "A0 Custom". That in the drawing paper size it says: "Custom Size (mm)"

Is it possible that it will say: "A0xl"

Sub Main()
	Dim oSheetFormat As New ArrayList
	oSheetFormat.Add("A0 Custom")
	oSheetFormat.Add("A0 Liggend")
	oSheetFormat.Add("A0 Staand")
	oSheetFormat.Add("A1 Liggend")
	oSheetFormat.Add("A1 Staand")
	oSheetFormat.Add("A2 Liggend")
	oSheetFormat.Add("A2 Staand")
	oSheetFormat.Add("A3 Liggend")
	oSheetFormat.Add("A3 Staand")
	oSheetFormat.Add("A4 Liggend")
	oSheetFormat.Add("A4 Staand")
	
oSheetFormatIP = InputListBox("Sheet Format", oSheetFormat, oSheetFormat(0))
		
If oSheetFormatIP = oSheetFormat(0) Then Sheet_A0Xl_Custom(oSheetFormatIP)
If oSheetFormatIP = oSheetFormat(1) Then Sheet_A0_Liggend(oSheetFormatIP)
If oSheetFormatIP = oSheetFormat(2) Then Sheet_A0_Staand(oSheetFormatIP)
If oSheetFormatIP = oSheetFormat(3) Then Sheet_A1_Liggend(oSheetFormatIP)
If oSheetFormatIP = oSheetFormat(4) Then Sheet_A1_Staand(oSheetFormatIP)
If oSheetFormatIP = oSheetFormat(5) Then Sheet_A2_Liggend(oSheetFormatIP)
If oSheetFormatIP = oSheetFormat(6) Then Sheet_A2_Staand(oSheetFormatIP)
If oSheetFormatIP = oSheetFormat(7) Then Sheet_A3_Liggend(oSheetFormatIP)
If oSheetFormatIP = oSheetFormat(8) Then Sheet_A3_Staand(oSheetFormatIP)
If oSheetFormatIP = oSheetFormat(9) Then Sheet_A4_Liggend(oSheetFormatIP)
If oSheetFormatIP = oSheetFormat(10) Then Sheet_A4_Staand(oSheetFormatIP)
End Sub
Sub Sheet_A0Xl_Custom(x)
Lengte = InputBox("Lengte", "Lengte", "Default Entry")
ActiveSheet.ChangeSize(1188, Lengte, moveBorderItems :=True)
End Sub
Sub Sheet_A0_Liggend(x)
	ThisApplication.ActiveDocument.ActiveSheet.Orientation = Inventor.PageOrientationTypeEnum.kLandscapePageOrientation
	ActiveSheet.ChangeSize("A0", moveBorderItems :=True)
End Sub
Sub Sheet_A0_Staand(x)
	ThisApplication.ActiveDocument.ActiveSheet.Orientation = Inventor.PageOrientationTypeEnum.kPortraitPageOrientation
	ActiveSheet.ChangeSize("A0", moveBorderItems :=True)
End Sub
Sub Sheet_A1_Liggend(x)
	ThisApplication.ActiveDocument.ActiveSheet.Orientation = Inventor.PageOrientationTypeEnum.kLandscapePageOrientation
	ActiveSheet.ChangeSize("A1", moveBorderItems :=True)
End Sub
Sub Sheet_A1_Staand(x)
	ThisApplication.ActiveDocument.ActiveSheet.Orientation = Inventor.PageOrientationTypeEnum.kPortraitPageOrientation
	ActiveSheet.ChangeSize("A1", moveBorderItems :=True)
End Sub
Sub Sheet_A2_Liggend(x)
	ThisApplication.ActiveDocument.ActiveSheet.Orientation = Inventor.PageOrientationTypeEnum.kLandscapePageOrientation
	ActiveSheet.ChangeSize("A2", moveBorderItems :=True)
End Sub
Sub Sheet_A2_Staand(x)
	ThisApplication.ActiveDocument.ActiveSheet.Orientation = Inventor.PageOrientationTypeEnum.kPortraitPageOrientation
	ActiveSheet.ChangeSize("A2", moveBorderItems :=True)
End Sub
Sub Sheet_A3_Liggend(x)
	ThisApplication.ActiveDocument.ActiveSheet.Orientation = Inventor.PageOrientationTypeEnum.kLandscapePageOrientation
	ActiveSheet.ChangeSize("A3", moveBorderItems :=True)
End Sub
Sub Sheet_A3_Staand(x)
	ThisApplication.ActiveDocument.ActiveSheet.Orientation = Inventor.PageOrientationTypeEnum.kPortraitPageOrientation
	ActiveSheet.ChangeSize("A0", moveBorderItems :=True)
End Sub
Sub Sheet_A4_Liggend(x)
	ThisApplication.ActiveDocument.ActiveSheet.Orientation = Inventor.PageOrientationTypeEnum.kLandscapePageOrientation
	ActiveSheet.ChangeSize("A4", moveBorderItems :=True)
End Sub
Sub Sheet_A4_Staand(x)
	ThisApplication.ActiveDocument.ActiveSheet.Orientation = Inventor.PageOrientationTypeEnum.kPortraitPageOrientation
	ActiveSheet.ChangeSize("A4", moveBorderItems :=True)
End Sub
0 Likes
234 Views
2 Replies
Replies (2)
Message 2 of 3

Michael.Navara
Advisor
Advisor

This is not possible, because this names are stored internally in Inventor.

If you want to display your custom sheet name, you need to change the sheet property size to prompt string and set them using code.

0 Likes
Message 3 of 3

GeertvanderHeide
Advocate
Advocate

think you have to edit the titleblock to change it everytime you set the sheet size

 

 

dim oDoc as DrawingDocument = ThisDoc.Document
dim oTB as TitleBlock = oDoc.ActiveSheet.TitleBlock
dim oTextBox as TextBox
for a =1 to oTB.definition.sketch.TextBoxes.count
   if oTextBox.Text = "<Sheet Size>" then
     logger.info(a)
     exit for
   end if 
next

dim SheetSizeBox as TextBox = oTB.definition.sketch.TextBoxes.item(a)

SheetSizeBox.Text = "<Sheet Size>"
SheetSizeBox.Text = "A0 x L"

 

 

the first part is just to find the right textbox you want. once you have that one you should be able to call it always with the same number. else build in a safety to check the value in the textbox. 

other thing might be that when you write "<Sheet Size>" to the textbox the link to the normal sheet size can't be found, but that should be tested.

 

0 Likes