MANox
Mechanical
- Apr 2, 2007
- 130
Hello,
I have workpart and component in this assembly. Component has Symbolic Thread.
I want add concentric constraint between edge of start face of component, and selected edge in workpart.
Journal select compoenent with function SelectComponent from And it's work good.
And after I want select edge and I use this code:
Generaly, I can find edge.
The problem is:
error message: NXOpen.NXException: The entity is not a valid constraint w NXOpen.Positioning.Constraint.CreateConstraintReference(NXObject movableObject, NXObject geometry, Boolean usesAxis, Boolean isIndirect, Boolean usePortRotate)w NXJournal.Main...
I think I must take geometry from component, not from prototype?
Maybe other error?
I somebody can help me - please help!!!!.
Best regards
MANok
NX2006
TC14
I have workpart and component in this assembly. Component has Symbolic Thread.
I want add concentric constraint between edge of start face of component, and selected edge in workpart.
Journal select compoenent with function SelectComponent from And it's work good.
And after I want select edge and I use this code:
Code:
Dim theComponent As Assemblies.Component = Nothing
If SelectComponent("select a component", theComponent) = Selection.Response.Cancel Then
Return
End If
Dim prototype As Part = theComponent.Prototype
Dim edges() As Edge
Dim edge1 As NXOpen.Edge
For Each feature1 As Features.Feature In prototype.Features
'lw.WriteLine(feature1.GetType.ToString)
If feature1.FeatureType.Equals("SYMBOLIC_THREAD") Then
If feature1.GetType.ToString() = "NXOpen.Features.Feature" Then
'lw.WriteLine(feature1.GetType.ToString())
Dim data As UFModl.SymbThreadData = New UFModl.SymbThreadData()
theUfSession.Modl.AskSymbThreadParms(feature1.Tag, data)
Dim face2 As Face = Utilities.NXObjectManager.Get(data.cyl_face)
edges = face2.GetEdges()
'lw.WriteLine(face2.Tag)
ElseIf feature1.GetType.ToString() = "NXOpen.Features.Thread" Then
'edges = feature1.GetEdges
Dim threadBuilder As ThreadBuilder = workPart.Features.CreateThreadBuilder(feature1)
'Dim face As Face = CType(threadBuilder.CylindricalFace, Face)
Dim startObject1 As SelectDisplayableObject = threadBuilder.StartObject()
Dim selection As DisplayableObject
Dim view1 As NXOpen.View
Dim point1 As Point3d
startObject1.GetValue(selection, view1, point1)
If selection.GetType.ToString = "NXOpen.Face" Then
Dim face As Face = CType(selection, Face)
Dim edge = face.GetEdges
MsgBox(edge.Length)
End If
End If
If Not edges Is Nothing Then
'lw.WriteFullline(edges.Length)
edge1 = edges(0)
End If
End If
Next
Generaly, I can find edge.
The problem is:
Code:
Dim constraintReference1 As NXOpen.Positioning.ConstraintReference = Nothing
constraintReference1 = componentConstraint1.CreateConstraintReference(theComponent, edge1, False, False, False)
error message: NXOpen.NXException: The entity is not a valid constraint w NXOpen.Positioning.Constraint.CreateConstraintReference(NXObject movableObject, NXObject geometry, Boolean usesAxis, Boolean isIndirect, Boolean usePortRotate)w NXJournal.Main...
I think I must take geometry from component, not from prototype?
Maybe other error?
I somebody can help me - please help!!!!.
Best regards
MANok
NX2006
TC14