- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to get a number of parts into an assembly and constrain then the two origin planes, however the line "Call oOcc.CreateGeometryProxy(oFace1, oOccFaceProxy)" is causing an error.
Any help would be appreciated.
Public Function ConstrainPart(oOcc As ComponentOccurrence, ByRef oFace1 As Face, ByRef oFace2 As Face, ByVal Offset As Integer) As Boolean
' Make sure the occurrence is not grounded.
If oOcc.Grounded Then
oOcc.Grounded = False
End If
' Get the component definition of the occurrence. This could be a
' part or assembly component definition depending on if the occurrence
' is a part or subassembly.
Dim oOccDef As PartComponentDefinition
Set oOccDef = oOcc.Definition
' Get the assembly component definition. This assumes the occurrence is
' is with respect to the top-level assembly.
Dim oAsmDef As AssemblyComponentDefinition
Set oAsmDef = oOcc.ContextDefinition
' Create a proxy for this work plane.
Dim oOccFaceProxy As FaceProxy
Call oOcc.CreateGeometryProxy(oFace1, oOccFaceProxy)
' Create the constraint.
Call oAsmDef.Constraints.AddFlushConstraint(oAsmDef.WorkPlanes.Item(1), oOccFaceProxy, 0)
Call oOcc.CreateGeometryProxy(oFace2, oOccFaceProxy)
Call oAsmDef.Constraints.AddFlushConstraint(oAsmDef.WorkPlanes.Item(2), oOccFaceProxy, Offset)
ConstrainPart = True
End Function
Solved! Go to Solution.