WorkPlanes & WorkAxis in Assemblies

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This is my first macro that I am programming so please excuse the simplicity of the question. I am struggling with WorkPlanes & WorkAxis in assemblies. I am able to create them in part mode but not in assembly mode. Below is part of my code that is attempting to create these features.
'*******************************************
' OPENS A NEW ASSEMBLY
'******************************************
Dim oDoc2 As AssemblyDocument
Set oDoc2 = ThisApplication.Documents.Add(kAssemblyDocumentObject, ThisApplication.FileManager.GetTemplateFile(kAssemblyDocumentObject))
Dim oAsmCompDef As AssemblyComponentDefinition
Set oAsmCompDef = oDoc2.ComponentDefinition
Set oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
'*******************************************
' GET YZ PLANE
'******************************************
Dim oPlane1 As WorkPlane
Set oPlane1 = oAsmCompDef.WorkPlanes.Item(1)
'*******************************************
' CREATE A NEW WORKPLANE 5 INCHES AWAY FROM YZ PLANE
'******************************************
Dim oWPlane1 As AssemblyWorkPlaneDef
'Set oWPlane1 = oAsmCompDef.WorkPlanes.AddByPlaneAndOffset(oAsmCompDef.WorkPlanes(2), (5 * 2.54))
'*******************************************
' CREATE A NEW WORKAXIS THAT INTERSECTS THE NEW WORKPLANE AND THE YZ PLANE
'******************************************
'Dim oWorkAxis1 As WorkAxis
'Set oWorkAxis1 = oAsmCompDef.WorkAxes.AddByTwoPlanes(oPlane1, oWPlane1, False)
Any help would be appreciated
Thank you for your time
WailGM