How can I display the values of my custom sheet size in my Drawing title block ???
If I define a custom Size, then "Custom Size mm or in" appears in the title block.
Solved! Go to Solution.
Solved by pierre.masson. Go to Solution.
Solved by pierre.masson. Go to Solution.
Here’s a small Ilogic Solution. This one is not based on Iproperties, but on prompted entries.
This is more flexible if you have multiple drawing sheet.
First you need to create a custom Title block named CustomSheet. Instead of having <Sheet size> as sheet property in the title block, you need to place another Text box with prompted entry (that I named “Format”).
Then you can create a new Ilogic Rule like that :
Dim odrawdoc As DrawingDocument
odrawdoc = ThisApplication.ActiveDocument
startsheet = ActiveSheet.Name
For i = 1 To odrawdoc.Sheets.Count
oname =odrawdoc.sheets.item(i).Name
ActiveSheet = ThisDrawing.Sheet(oname)
ActiveSheet.SetTitleBlock("CustomSheet", odrawdoc.sheets.item(i).Width & "x" & odrawdoc.sheets.item(i).Height)
Next i
InventorVb.DocumentUpdate()
ActiveSheet = ThisDrawing.Sheet(startsheet)
This will implement your title block in all your drawing pages, with the size of your page in mm or in.
You can trigger this event each time you save your drawing for example.
Please pay attention, the values
odrawdoc.sheets.item(i).Width and height are given in CM.
You will need to adapt it to you units.
Hi All
Based on some feedbacks I had, I did a more complete Rule.
You still need to create a custom Title block named CustomSheet. Instead of having <Sheet size> as sheet property in the title block, you need to place another Text box with prompted entry (that I named “Format”).
The rule will scan through the pages and only if you have a custom sheet size, it will load the new titleblock. The Sheet Dimensions will be based on the units you are using in your documents. We are only using mm or Inches, you would need to adapt the code if you want to use other units.
DimodrawdocAsDrawingDocument
odrawdoc=ThisApplication.ActiveDocument
startsheet=ActiveSheet.Name
Fori=1Toodrawdoc.Sheets.Count
oname=odrawdoc.sheets.item(i).Name
ActiveSheet=ThisDrawing.Sheet(oname)
IfActiveSheet.Size="Custom"Then
uom=ThisDoc.Document.UnitsOfMeasure
If(uom.LengthUnits=UnitsTypeEnum.kMillimeterLengthUnits)Then
Dimension=Round(odrawdoc.sheets.item(i).Width*10,2)&"x"&Round(odrawdoc.sheets.item(i).Height*10,2)
ActiveSheet.SetTitleBlock("CustomSheet", Dimension&" mm")
ElseIf(uom.LengthUnits=UnitsTypeEnum.kInchLengthUnits)Then
Dimension=Round(odrawdoc.sheets.item(i).Width*0.3937,2)&"x"&Round(odrawdoc.sheets.item(i).Height*0.3937,2)
ActiveSheet.SetTitleBlock("CustomSheet", Dimension&" in")
Else
MsgBox("Units of Documents not recognized, it must be either mm or Inches. No Change in Titleblock will be performed")
GotoLBL
EndIf
EndIf
Nexti
InventorVb.DocumentUpdate()
LBL:
ActiveSheet=ThisDrawing.Sheet(startsheet)