- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
How to change the sheet scale.?
I am developing a task to automate the transition from 3D model to drawing.
I am placing a model view whose size changes to a fixed sheet size and adjusting the scale of the model view to fit the sheet.
Is there a way to adjust the scale of the sheet size while the sheet size (A1) is fixed? The scale of the model view remains fixed.
It is not a change in the sheet size.
Instead of adjusting the model view scale to the sheet, I am wondering if there is a way to adjust the model view to fit the scale of the sheet itself so that it is located within the sheet.
Is there an i-logic code that can do that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @leebrg. Some of what you said did not make sense, or seemed to contradict itself, so I just wanted to clarify the details.
- A 'Sheet' does not have any 'scale' to it. It only has a Size (from DrawingSheetSizeEnum), Height, & Width.
- You want code that will place a single view of a model into a Sheet in a DrawingDocument.
- That task will most likely be using the DrawingViews.AddBaseView method, but there are lots of similar methods for adding views into a drawing, so not sure at this point.
- While doing that, you want to control the size of the view it places, so that it fits within the Sheet, without changing the size (or orientation) of the Sheet.
- What about the orientation of the model within the view itself?
- We do not know what orientation your sheet is in (portrait or landscape).
- We do not know what direction this view should be looking at the model from.
- We do not know what orientation your model is in, or how you would prefer it to be oriented within the view on the sheet.
- Do you want the code to change the orientation of the view, if that will help it fit into the sheet better?
This task would most likely require some relatively complex code that will measure the overall size of your model, in model space. Determine its orientation based on which directions it is narrowest in, and which it is longest in. Compare that to the size and orientation of the sheet. Determine if it must avoid borders and/or title blocks within the bounds of that sheet. If it must avoid those, then determine what area of the sheet is 'available' for a view, without overlapping the border or title block. Use that interior available space to compare to the model's size & orientation. Do the math to figure out what orientation will fit best, then what scale will be needed, and where within the bounds of that sheet to place the view. Lots of complex stuff to be figured out, and lots of code to make all that happen.
Wesley Crihfield
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Sheet don't have scale. View does.
Sub Main()
Dim oDoc As Document
Dim oIDWFile As DrawingDocument
Dim oSheet As Sheet
Dim oDrawingView As DrawingView
Dim oScale As String
Dim oTime As String
oTime = Now.ToShortDateString
iProperties.Value("Project", "Creation Date") = oTime
oScale = "1 / 10"
oDoc = ThisApplication.ActiveDocument
If oDoc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
oIDWFile = TryCast(oDoc, DrawingDocument)
oSheet = oIDWFile.ActiveSheet
For Each oDrawingView In oSheet.DrawingViews
Logger.Info(oDrawingView.ScaleString)
If (oDrawingView.ViewType = DrawingViewTypeEnum.kStandardDrawingViewType) Or
(oDrawingView.ViewType = DrawingViewTypeEnum.kProjectedDrawingViewType)
'Assignment fail if same scale
If oDrawingView.ScaleString <> oScale
oDrawingView.ScaleString = oScale
End If
End If
Next
oSheet.Update
End If
End Sub