Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello
I got this rule from a cool guy
this rule is purpose to generate drawing with file in every class
Sub Main()
Dim doc As AssemblyDocument = ThisDoc.Document
Dim def As AssemblyComponentDefinition = doc.ComponentDefinition
Dim dDoc As DrawingDocument = ThisApplication.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject)
Dim sheet As Sheet = dDoc.ActiveSheet
FillSheet(sheet, doc)
For Each refDoc As Document In doc.AllReferencedDocuments
Dim newSHeet = dDoc.Sheets.Add()
FillSheet(newSHeet, refDoc)
Next
End Sub
Private Sub FillSheet(sheet As Sheet, doc As Document)
sheet.Name = doc.DisplayName
Dim sheetW4 = sheet.Width / 4
Dim sheetH4 = sheet.Height / 4
Dim position As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(sheetW4, sheetH4)
Dim baseView As DrawingView = sheet.DrawingViews.AddBaseView(doc, position, 1, ViewOrientationTypeEnum.kFrontViewOrientation, DrawingViewStyleEnum.kHiddenLineDrawingViewStyle)
Dim scale = CalculateScale(baseView)
position = ThisApplication.TransientGeometry.CreatePoint2d(sheetW4 * 3, sheetH4)
Dim view = sheet.DrawingViews.AddProjectedView(baseView, position, DrawingViewStyleEnum.kFromBaseDrawingViewStyle)
scale = Math.Min(scale, CalculateScale(view))
position = ThisApplication.TransientGeometry.CreatePoint2d(sheetW4, sheetH4 * 3)
view = sheet.DrawingViews.AddProjectedView(baseView, position, DrawingViewStyleEnum.kFromBaseDrawingViewStyle)
scale = Math.Min(scale, CalculateScale(view))
position = ThisApplication.TransientGeometry.CreatePoint2d(sheetW4 * 3, sheetH4 * 3)
view = sheet.DrawingViews.AddProjectedView(baseView, position, DrawingViewStyleEnum.kFromBaseDrawingViewStyle)
scale = Math.Min(scale, CalculateScale(view))
baseView.Scale = scale
End Sub
Private Function CalculateScale(view As DrawingView) As Double
Dim scaleX = view.Parent.Width / view.Width / 2
Dim scaleY = view.Parent.Height / view.Height / 2
Return Math.Min(scaleX, scaleY)
End Function
I've run this rule and there is error on 26row
Could any guy help me?
additionally it generate sheet with size A and i use size A3 usually can i change this setting?
and I will use this like run this rule and generate sheets and copy these sheets then past it on my drawing file that I'm working
but the style is not updated so line color is not fit like below
above is a drawing made from sheet generated by rule
above is pasted on my working drawing file
above is a style I use usually on my working drawing file
Solved! Go to Solution.