- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone.
Drawing automation rules that work in the assembly environment.
In the BOM structure, I would like to skip the structure rules below and perform them.
1. The inseparable structure type.
2. The phantom structure type.
3. The purchased structure type.
4. The reference structure type.
5. Subparts created in Frame Generator.
6. Assemblies and subparts created from bolted connections.
I would like to skip the above 6 and run the rule.
Is it possible?
--------------------------------
Sub Main
Dim doc As AssemblyDocument = ThisDoc.Document
Dim def As AssemblyComponentDefinition = doc.ComponentDefinition
' Specify the desired drawing template address
Dim templateFileName As String = "C:\Standard.dwg"
Dim dDoc As DrawingDocument = ThisApplication.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject, templateFileName)
Dim sheet As Sheet = dDoc.ActiveSheet
FillSheet(sheet, doc)
For Each refDoc As Document In doc.AllReferencedDocuments
Dim newSHeet = dDoc.Sheets.Add()
newSHeet.Size = DrawingSheetSizeEnum.kA3DrawingSheetSize
FillSheet(newSHeet, refDoc)
Next
End Sub
Private Sub FillSheet(sheet As Sheet, doc As Document)
sheet.Name = doc.DisplayName
' Set drawing layout unit
Dim sheetW4 = sheet.Width / 5
Dim sheetH4 = sheet.Height / 5
Try
sheet.AddBorder("basic")
sheet.AddTitleBlock("ISO")
Catch
End Try
Try
' Specify front view position
Dim position As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(sheetW4, sheetH4*2)
Dim baseView As DrawingView = sheet.DrawingViews.AddBaseView(doc, position, 1, ViewOrientationTypeEnum.kFrontViewOrientation, DrawingViewStyleEnum.kHiddenLineDrawingViewStyle)
Dim scale = CalculateScale(baseView)
baseView.Scale = scale
' Specify side view position
position = ThisApplication.TransientGeometry.CreatePoint2d(sheetW4 * 3, sheetH4*2)
Dim view = sheet.DrawingViews.AddProjectedView(baseView, position, DrawingViewStyleEnum.kFromBaseDrawingViewStyle, scale)
scale = Math.Min(scale, CalculateScale(view))
' Specify top view position
position = ThisApplication.TransientGeometry.CreatePoint2d(sheetW4, sheetH4 * 4)
view = sheet.DrawingViews.AddProjectedView(baseView, position, DrawingViewStyleEnum.kFromBaseDrawingViewStyle, scale)
scale = Math.Min(scale, CalculateScale(view))
' Specify isometric view position
position = ThisApplication.TransientGeometry.CreatePoint2d(sheetW4 * 3.5, sheetH4 * 3.5)
view = sheet.DrawingViews.AddProjectedView(baseView, position, DrawingViewStyleEnum.kShadedDrawingViewStyle, scale)
scale = Math.Min(scale, CalculateScale(view))
baseView.Scale = scale
view.Scale = scale
Catch ex As Exception
MsgBox("Something went wrong while creating sheet for model: " & doc.DisplayName)
Return
End Try
End Sub
' Specify drawing layout size ratio
Private Function CalculateScale(view As DrawingView) As Double
Dim scaleX = view.Parent.Width / view.Width / 3
Dim scaleY = view.Parent.Height / view.Height / 3
Return Math.Min(scaleX, scaleY)
End Function
--------------------------------
Solved! Go to Solution.