InsertConstraint

InsertConstraint

Anonymous
Not applicable
496 Views
3 Replies
Message 1 of 4

InsertConstraint

Anonymous
Not applicable
I am trying to create an InsertConstraint between a hole in one component
and another component in an assembly. It always fails. My latest try ended
with an alert box that says "Internal Error: Non Unique instances
Selected.". I am sure that the circular edges are correct for each
component. What could I be doing wrong? The component is already positioned
at the correct point and orientation, I just want them to be constrained.
0 Likes
497 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Randy,

Its difficult to comment without looking at your code and the assembly file.
Here is a sample code that worked fine for me:

Sub test()
Dim aDoc As AssemblyDocument
Dim CO As ComponentOccurrence
Dim ACO As AssemblyComponentDefinition
Dim obj1 As Object
Dim obj2 As Object

Set aDoc = ThisDocument
Set obj1 =
aDoc.ComponentDefinition.Occurrences(1).SurfaceBodies(1).Edges(1)
Set obj2 =
aDoc.ComponentDefinition.Occurrences(2).SurfaceBodies(1).Edges(2)

Set ACO = aDoc.ComponentDefinition
ACO.Constraints.AddInsertConstraint obj1, obj2, True, 0
End Sub

Cheers,
Thilak



"Randy Sanders" wrote in message
news:39352E0E1DC155CE1BE70F7365719BE8@in.WebX.maYIadrTaRb...
> I am trying to create an InsertConstraint between a hole in one component
> and another component in an assembly. It always fails. My latest try ended
> with an alert box that says "Internal Error: Non Unique instances
> Selected.". I am sure that the circular edges are correct for each
> component. What could I be doing wrong? The component is already
positioned
> at the correct point and orientation, I just want them to be constrained.
>
>
0 Likes
Message 3 of 4

jpisarz
Observer
Observer
I had this Problem with a constraint between a face and a workplane. the solution was to create a proxy from the workplane like this:

Set oOldPart = F_InsertNewDialog.BasePlane
oNewPart.CreateGeometryProxy oNewPart.Definition.WorkPlanes.Item(3), oProxy
oDocument.ComponentDefinition.Constraints.AddFlushConstraint oProxy, oOldPart, 0

maybe it's your way too.
0 Likes
Message 4 of 4

jpisarz
Observer
Observer
oops, I think this looks better:


Set oOldPart = F_InsertNewDialog.BasePlane

oNewPart.CreateGeometryProxy oNewPart.Definition.WorkPlanes.Item(3), oProxy

oDocument.ComponentDefinition.Constraints.AddFlushConstraint oProxy, oOldPart, 0
0 Likes