Custom Size sheet for 1:1

Custom Size sheet for 1:1

inventor4578
Advocate Advocate
222 Views
2 Replies
Message 1 of 3

Custom Size sheet for 1:1

inventor4578
Advocate
Advocate

Hi,

 

I would like to know if it possible on existing drawing, to change the sheet format with custom size, according to the views overall dimensions + a border (10/20mm or else).

 

I have 3 standards views, ALWAYS in 1:1 format. So sometime i have very large part who can't be in A0.

So i use blank template, with all views in 1:1 and i resize with custom size to be around views.

I would like to make this automatic.

 

Thank you very much,

Regards.

Have nice day.

0 Likes
Accepted solutions (1)
223 Views
2 Replies
Replies (2)
Message 2 of 3

Michael.Navara
Advisor
Advisor
Accepted solution

This simple code can be used for it. It expects that the drawing views are in the first quadrant of the sheet (above the bottom end of paper and right to the left side of the paper).

 

Sub Main()
    Dim oversizeX = 2.0
    Dim oversizeY = 2.0

    Dim drw As DrawingDocument = ThisDoc.Document
    Dim viewBox As Box2d = ThisApplication.TransientGeometry.CreateBox2d()
    Dim drawingViews As DrawingViews = drw.ActiveSheet.DrawingViews
    For Each drawingView As DrawingView In drawingViews

        Dim topRightViewX = drawingView.Position.X + drawingView.Width / 2
        Dim topRoightViewY = drawingView.Position.Y + drawingView.Height / 2
        Dim topRightCorner As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(topRightViewX, topRoightViewY)
        viewBox.Extend(topRightCorner)
    Next

    Dim minSheetWidth = viewBox.MaxPoint.X - viewBox.MinPoint.X
    Dim minSheetHeight = viewBox.MaxPoint.Y - viewBox.MinPoint.Y

    drw.ActiveSheet.Size = DrawingSheetSizeEnum.kCustomDrawingSheetSize
    drw.ActiveSheet.Width = minSheetWidth + oversizeX
    drw.ActiveSheet.Height = minSheetHeight + oversizeY
End Sub

 

 

2024-08-21_16-40-13.png

 

0 Likes
Message 3 of 3

inventor4578
Advocate
Advocate

Hi, it's working good, but is it possible to add more margin ? Thank you very much again

0 Likes