I'm trying to flip a part by converting its constraint object type from Mate to Flush. Seems simple enough but I can't figure out the requirements of the ConvertToMateConstraint method.
Could anyone explain its use or point me towards an example?
Yes, sorry for not providing a code example to begin with.
Here's the non-working code in VBA...
Public Sub FlipCon()
Dim oDoc As AssemblyDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oAsmCompDef As AssemblyComponentDefinition
Set oAsmCompDef = oDoc.ComponentDefinition
Dim oAsmCons As AssemblyConstraints
Set oAsmCons = oAsmCompDef.Constraints
Dim oCon As AssemblyConstraint
Dim oFace1 As Face
Dim oFace2 As Face
For Each oCon In oAsmCons
Set oFace1 = oCon.EntityOne
Set oFace2 = oCon.EntityTwo
If oCon.Type = kMateConstraintObject Then
oCon.ConvertToFlushConstraint(oFace1, oFace2, 0)
ElseIf oCon.Type = kFlushConstraintObject Then
oCon.ConvertToMateConstraint(oFace1, oFace2, 0)
I skipped the bias points as they're listed as option. I'm assuming I'm not using the correct object type for EntityOne/EntityTwo, but if they're not the same type as was already used in the constraint then what else would they be?
I tried simply oCon.ConvertToMateConstraint(oCon.EntityOne, oCon.EntityTwo, 0) , but failed similarly.
Does Offset require a numerical Parameter object or something...?