Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Friends: thank you in advance. When making drawings, the requirement for the model orientation is that: the base view has to show the dashboard of the panel (see attached image). i.e. the panel dash faces front within base view. I am wondering how I should do this through VBA.
My thought was to find the a plane parallel to panel dash and check its orientation and see if it is parallel to front view, right view or top view in TOP ASSEMBLY. (the dash will always be parallel to one of the three views) Right now, I got the XY plane of a panel subassembly called "xx screen" (variable "owp" in my code). The thing is that I don't know how to check the orientation of it. My owp.plane.normal=(0,0,1), but I believe this is in the local axis system of ("xx screen"). How can I check its orientation in terms of top assembly's XYZ?
Sub Createdrawing()
Dim oAssyDoc As AssemblyDocument
Set oAssyDoc = ThisApplication.ActiveDocument
Dim oPart As ComponentOccurrence
Dim oAssyDoc As AssemblyDocument
Set oAssyDoc = ThisApplication.ActiveDocument
Dim oPart As ComponentOccurrence
For Each oPart In oAssyDoc.ComponentDefinition.Occurrences
If (InStr(oPart.Name, "Control Panel") <> 0) And oPart.DefinitionDocumentType = kAssemblyDocumentObject Then
For Each oPart1 In oPart.Definition.Occurrences
If (InStr(oPart1.Name, "Door Assembly") <> 0) And oPart1.DefinitionDocumentType = kAssemblyDocumentObject Then
For Each opart2 In oPart1.Definition.Occurrences
If (InStr(opart2.Name, "Screen") <> 0) And opart2.Suppressed = False Then
Dim owp As WorkPlane
Set owp = opart2.Definition.WorkPlanes.Item("XY Plane") ' Front Plane of Panel
End If
Next
End If
Next
If (InStr(oPart.Name, "Control Panel") <> 0) And oPart.DefinitionDocumentType = kAssemblyDocumentObject Then
For Each oPart1 In oPart.Definition.Occurrences
If (InStr(oPart1.Name, "Door Assembly") <> 0) And oPart1.DefinitionDocumentType = kAssemblyDocumentObject Then
For Each opart2 In oPart1.Definition.Occurrences
If (InStr(opart2.Name, "Screen") <> 0) And opart2.Suppressed = False Then
Dim owp As WorkPlane
Set owp = opart2.Definition.WorkPlanes.Item("XY Plane") ' Front Plane of Panel
End If
Next
End If
Next
End If
Next
Next
Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.Documents.Open("W:\AMICO SOURCE\AMICO SOURCE 3.0\Templates\AIR - 60Hz.dwg")
Dim oSheet As Sheet
Set oSheet = oDoc.Sheets.Item(1)
Dim oPoint1 As Point2d
Set oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(12.5, 16)
Set oDoc = ThisApplication.Documents.Open("W:\AMICO SOURCE\AMICO SOURCE 3.0\Templates\AIR - 60Hz.dwg")
Dim oSheet As Sheet
Set oSheet = oDoc.Sheets.Item(1)
Dim oPoint1 As Point2d
Set oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(12.5, 16)
Dim oView1 As DrawingView
Set oView1 = oSheet.DrawingViews.AddBaseView(oAssyDoc, oPoint1, 0.1, kFrontViewOrientation, kShadedDrawingViewStyle)
...
end sub
Solved! Go to Solution.