To change drawing sheet size to Custom - 24 x 36

To change drawing sheet size to Custom - 24 x 36

RoyWickrama_RWEI
Advisor Advisor
1,631 Views
5 Replies
Message 1 of 6

To change drawing sheet size to Custom - 24 x 36

RoyWickrama_RWEI
Advisor
Advisor

I would like to incorporate a piece of iLogic coding to change the drawing sheet size. However, to my surprise, it is too hard to get around for 24 x 36 size (it is OK for D, B and A sizes). I spent hours without success.

SyntaxEditor Code Snippet

If ActiveSheet.Size = "Custom" Then
ActiveSheet.ChangeSize("24 x 36 (inches)", MoveBorderItems := True)

 Above, "24 x 36 (inches)" doesn't go through like "A", "B", "D", ...

I appreciate some one help me with a solution. Thanks.

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

t_hascj
Autodesk
Autodesk

Hi,

 

The oDoc member is not initialized.

Dim oDoc As DrawingDocument 	'= ThisApplication.Documents.Open(iDoc)
Dim oSheet As Sheet = oDoc.ActiveSheet

 

Thanks,
Jaroslav

Message 3 of 6

MechMachineMan
Advisor
Advisor
Accepted solution

 

'requires the input width/height in 'cm'
With ThisApplication.ActiveDocument.ActiveSheet .Size = DrawingSheetSizeEnum.kCustomDrawingSheetSize .Height = 24*2.54 .Width = 36*2.54 End With

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 4 of 6

RoyWickrama_RWEI
Advisor
Advisor

Your guidance helped me to reached a workable solution for my need. Thanks a lot.

I will have individual borders and title blocks made to the appropriate sizes with zones.

 

Note: I have a typed array of the available borders in my rule. Please see below:

SyntaxEditor Code Snippet

Dim oSheetFormats As New ArrayList
oSheetFormats.add("24x36-Border")
oSheetFormats.add("D-Size-Border L")
oSheetFormats.add("B-Size-Border L")
oSheetFormats.add("A-Size-Border L")
oSheetFormats.add("A-Size-Border P")

'ThisApplication.ActiveDocument.Sheets.add ()
oSheetFormats_IP = InputListBox("Choose Format:....

I prefer to have the borders read off from the  Drawing Resources > Borders. Could you help.

0 Likes
Message 5 of 6

MechMachineMan
Advisor
Advisor

 

 

Follow the link below. Familiarize yourself with the "general structure" of the API. Enjoy no longer being dependent on forum responses to do very simple tasks with the API!

 

https://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/simplecontent/content/au...

 

http://help.autodesk.com/view/INVNTOR/2018/ENU/?guid=GUID-AA811AF0-2494-4574-8C43-4C22E608252F

 

(ie; to solve this, I looked at the file, found anything related to "border" and traced it all of the way upwards to Application.)

(( BorderDefinition > BorderDefinitions > DrawingDocument > Documents > Application ))

Then, I started with "Application" (working backwards), searched it up in the API, and looked through the available methods/properties until i found the one that returned "Documents".

This gives us "ThisApplication.Documents"

Then I looked at the Documents object in the API link until I found the one that returns DrawingDocument.

I "couldn't" because it's a generic class, but from trial and error of testing the objects, I realized that if I had a Drawing open when I used "ThisApplication.ActiveDocument", then I would have a DrawingDocument.

I continued the same way until I got to border definition, then looked up border definition in the API resource, and found that the Name property is what I wanted.

 

Dim oSheetFormats As New ArrayList
For Each oBorderDef in ThisDoc.Document.BorderDefinitions
oSheetFormats.Add(oBorderDef.Name)
Next

 

 


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 6 of 6

RoyWickrama_RWEI
Advisor
Advisor

Thanks a lot.

 

Also thanks for the advice with the link. I will really do so.

However, I am too tight too because I do with SolidWorks, MathCAD and Overland Belt Analyst plus more.

 

Will make it

 

Thanks.

0 Likes