Message 1 of 2

Not applicable
09-18-2017
08:13 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have the following code that is giving me fits. I am trying to constrain a part. It Fails at oPart.CreateGeometryProxy() the error is
"Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))" For some reason it does not like oProxyPlane.
Thanks in advance
Kevin
SyntaxEditor Code Snippet
Dim oAsmDoc as AssemblyDocument = ThisApplication.ActiveDocument Dim oAsmCompDef As AssemblyComponentDefinition = oAsmDoc.ComponentDefinition Dim oTG As TransientGeometry = ThisApplication.TransientGeometry Dim oMatrix As Matrix = ThisApplication.TransientGeometry.CreateMatrix 'set references for Assembly planes Dim oMasterPlaneYZ As WorkPlane = oAsmCompDef.Workplanes(1) 'Dim oMasterPlaneXZ As WorkPlane = oAsmCompDef.Workplanes(2)'Dim oMasterPlaneXY As WorkPlane = oAsmCompDef.Workplanes(3) Dim oPart = ComponentOccurence oPart = oAsmCompDef.Occurrences.Item(1) oPart.Grounded = False ' define part planes Dim oPartPlane As WorkPlane = oPart.Definition.WorkPlanes(1) ' define proxies Dim oProxyPlane As WorkPlaneProxy = Nothing Call oPart.CreateGeometryProxy(oPartPlane, oProxyPlane) Call oAsmCompDef.Constraints.AddMateConstraint(oMasterPlaneYZ, oProxyPlane, 0)
Solved! Go to Solution.