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):
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:
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:
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