WorkPlanes & WorkAxis in Assemblies

WorkPlanes & WorkAxis in Assemblies

Anonymous
Not applicable
767 Views
2 Replies
Message 1 of 3

WorkPlanes & WorkAxis in Assemblies

Anonymous
Not applicable

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 

 

 

0 Likes
768 Views
2 Replies
Replies (2)
Message 2 of 3

ekinsb
Alumni
Alumni

Work plane and axes behave differently in assemblies than in parts.  The user-interface tends to hide this difference but it's apparent when using the API.  In an assembly, work features are not directly associated to geometry like they are in a part.  For example, if you create a work plane in a part that's offset from a face, the work plane is associatively tied to the face.  In an assembly the association between the face and the work plane is defined by a constraint.  You can see this in the assembly browser.  When creating work features in an assembly you're limited to only using the AddFixed methods and then you'll need to add constraints to get the desired behavior.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
0 Likes
Message 3 of 3

Anonymous
Not applicable

Thank you for your response.

I have been doing some reading on the subject and have discovered the world of Proxy. Need to read more on the subject to get a full understanding of this method and how to use it in Assemblies. Do you have any suggestions? 

0 Likes