Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can I resize a drawing from format DIN A1 to DIN A3, including all views?

0 REPLIES 0
Reply
Message 1 of 1
julian.toll
166 Views, 0 Replies

How can I resize a drawing from format DIN A1 to DIN A3, including all views?

julian.toll
Observer
Observer

Hello,

 

I need to write a Powershell script which changes the size of a drawing from A1 to A3.

This is my original test drawing, (in this case sheetsize C):

juliantoll_0-1686121122766.png

juliantoll_3-1686121222869.png

 

With these lines I change the sheet size, but the Views remain unaffected:

 

$doc.ActiveSheet.Size = [Inventor.DrawingSheetSizeEnum]::kA3DrawingSheetSize
$doc.ActiveSheet.Orientation = [Inventor.PageOrientationTypeEnum]::kLandscapePageOrientation
The result is this:
 juliantoll_1-1686121156503.png

 

Then I loop through all views and try to change their position and scale, in order to have them inside my new, smaller sheet:
 
for ($i = 1; $i -le $originalSheet.DrawingViews.Count; $i++) {
    try {
        $v = $originalSheet.DrawingViews.Item($i)
        $scale = ($v.Scale / $originalHeight * 28) # 28 = height of A3 Landscape
        $v.Scale = $scale
        $pos = $v.Position  
        $xPos = $($v.Position.X / $originalWidth * 42) # 42 = width of A3 Landscape
        $yPos = $($v.Position.Y / $originalHeight * 28) # 28 = height of A3 Landscape
        [double[]]$coord = @($xPos,$yPos)
        $pos.PutPointData($coord)
        $v.Position = $pos
    }
    catch {
        Write-Host "View Nr. $i : failed"
    }
 
This is the result:
juliantoll_2-1686121189637.png

 

My sample drawing has 4 drawing views, two of them are projected views.
My problem is, that the projected views keep their distance from their "source-view", so they are outside of my sheet at the end
 
Does anyone know how I can move all views of any type to the right position?
 
Thanks in advance
0 Likes

How can I resize a drawing from format DIN A1 to DIN A3, including all views?

Hello,

 

I need to write a Powershell script which changes the size of a drawing from A1 to A3.

This is my original test drawing, (in this case sheetsize C):

juliantoll_0-1686121122766.png

juliantoll_3-1686121222869.png

 

With these lines I change the sheet size, but the Views remain unaffected:

 

$doc.ActiveSheet.Size = [Inventor.DrawingSheetSizeEnum]::kA3DrawingSheetSize
$doc.ActiveSheet.Orientation = [Inventor.PageOrientationTypeEnum]::kLandscapePageOrientation
The result is this:
 juliantoll_1-1686121156503.png

 

Then I loop through all views and try to change their position and scale, in order to have them inside my new, smaller sheet:
 
for ($i = 1; $i -le $originalSheet.DrawingViews.Count; $i++) {
    try {
        $v = $originalSheet.DrawingViews.Item($i)
        $scale = ($v.Scale / $originalHeight * 28) # 28 = height of A3 Landscape
        $v.Scale = $scale
        $pos = $v.Position  
        $xPos = $($v.Position.X / $originalWidth * 42) # 42 = width of A3 Landscape
        $yPos = $($v.Position.Y / $originalHeight * 28) # 28 = height of A3 Landscape
        [double[]]$coord = @($xPos,$yPos)
        $pos.PutPointData($coord)
        $v.Position = $pos
    }
    catch {
        Write-Host "View Nr. $i : failed"
    }
 
This is the result:
juliantoll_2-1686121189637.png

 

My sample drawing has 4 drawing views, two of them are projected views.
My problem is, that the projected views keep their distance from their "source-view", so they are outside of my sheet at the end
 
Does anyone know how I can move all views of any type to the right position?
 
Thanks in advance
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report