VB.Net - Drawing Sheet Size

VB.Net - Drawing Sheet Size

premysl.misun
Advocate Advocate
1,314 Views
7 Replies
Message 1 of 8

VB.Net - Drawing Sheet Size

premysl.misun
Advocate
Advocate

Hi Everyone,

 

I have program in VB.Net to change drawing sheet format. It works but only for A4 format is OK - this format I need portrait. For A3, A2, A1 and A0 I need landscape of this format. How can I change it?

 

Here is code (I probably need to change kA3DrawingSheetSize to antoher name, but I do not know how):

 

    Private Sub FormatA3_Click(sender As System.Object, e As System.EventArgs) Handles FormatA3.Click

        Dim oDoc As Inventor.DrawingDocument = _invApp.ActiveDocument

        Dim oSheet As Sheet
        oSheet = oDoc.ActiveSheet

        'get current size
        Dim Size As DrawingSheetSizeEnum
        Size = oSheet.Size

        'set new size
        oSheet.Size = DrawingSheetSizeEnum.kA3DrawingSheetSize

        'update sheet to see results
        oSheet.Update()


    End Sub

 

 

I tried kA4DrawingSheetSize, kA3DrawingSheetSize, kA2DrawingSheetSize, kA1DrawingSheetSize and kA0DrawingSheetSize but all are portraits.

 

 

Thank you very much for your answer.

 

Premysl

0 Likes
Accepted solutions (1)
1,315 Views
7 Replies
Replies (7)
Message 2 of 8

Jef_E
Collaborator
Collaborator

It seems to me that the changing of size works? Only the orientation is failing you?

 

Change the orientation by:

 

Sheet.Orientation Property

Parent Object: Sheet

 

Description

Gets or sets the orientation of the sheet as it is viewed or printed.

 

Syntax

Sheet.Orientation() As PageOrientationTypeEnum

 

Version

Introduced in Inventor version 4

 

 

PageOrientationTypeEnum Enumerator

 

Description

Page Orientation style.

 

Methods

Name Value Description
kDefaultPageOrientation 10241 Specifies the default setting. The more strongly typed value is returned in a query.
kLandscapePageOrientation 10242 Page is oriented as a Landscape.
kPortraitPageOrientation 10243 Page is oriented as a Portrait.

 

Version

Introduced in Inventor version 4



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
Message 3 of 8

Anonymous
Not applicable

Hi,

 

you must also use -> oSheet.Orientation = Inventor.PageOrientationTypeEnum.kLandscapePageOrientation

 

kind regards,

 

Geert

Message 4 of 8

t_hascj
Autodesk
Autodesk
Accepted solution

Hi Premysl,

 

You can change orientation by property Orientation.

'default orientation
oSheet.Orientation = PageOrientationTypeEnum.kDefaultPageOrientation
'page is oriented as a Landscape
oSheet.Orientation = PageOrientationTypeEnum.kLandscapePageOrientation
'page is oriented as a Portrait
oSheet.Orientation = PageOrientationTypeEnum.kPortraitPageOrientation


S pozdravom,
Jaroslav



Message 5 of 8

premysl.misun
Advocate
Advocate

Thank you, works good 🙂

0 Likes
Message 6 of 8

Jef_E
Collaborator
Collaborator

Just for curiosity, was my answer insufficient to solve the problem?



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
0 Likes
Message 7 of 8

premysl.misun
Advocate
Advocate

I am not a software enginner and for me was much easier to copy other commands and put it to my program. And it was mcuh quicker than try it by another way.

0 Likes
Message 8 of 8

Jef_E
Collaborator
Collaborator

But my answer is 100% the same 😄 just not oSheet.orientation but sheet.orientation

 

I always post a reference from the API as answer as for me it's the most clear and you can learn the most from it, maybe I should stop doing this?



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2