Checking Journal Constraints VB
Checking Journal Constraints VB
(OP)
I have been trying to check various sources but haven't found any examples.
Basically I want to put a line, constrained vertically, and set it tangent to an arc in a sketch. Then I want the automation to check for conflicting constraints.
The first part is easy enough, but I haven't been able to find any examples to check for over-constraints or conflicting-constraints.
I found Public Enumeration which looks promising but I'm unsure how to use it.
If anyone has any advice on where I can find additional resources I have checked the following
NX 7.5 Help Library
GTAC http://support.industrysoftware.automation.siemens...
and this site
I am running Windows 7
NX 7.5
Basically I want to put a line, constrained vertically, and set it tangent to an arc in a sketch. Then I want the automation to check for conflicting constraints.
The first part is easy enough, but I haven't been able to find any examples to check for over-constraints or conflicting-constraints.
I found Public Enumeration which looks promising but I'm unsure how to use it.
If anyone has any advice on where I can find additional resources I have checked the following
NX 7.5 Help Library
GTAC http://support.industrysoftware.automation.siemens...
and this site
I am running Windows 7
NX 7.5





RE: Checking Journal Constraints VB
This is the code I have been able to come up with but though I don't get an error the If(sketch1.status.OverConstrained ) always appears to enter the if statement rather than only entering if the sketch is over constrained.
CODE -->
If boolCreateRoot = True then CreateRoot( transform, lineChord, lineTE ) Else CreateVertLine( transform, lineChord, vertLine ) markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Create Geometric Constraints") ConstrainTangent( vertLine, botSpline ) If( sketch1.status.OverConstrained ) 'theSession.UndoLastNVisibleMarks( 1, marksRecycled1, undoUnavailable1 ) 'ConstrainTangent( vertLine, topSpline ) End If End IfAny help would be greatly appreciated.
RE: Checking Journal Constraints VB
CODE -->
'------------------------------------------------------------------------------------------ 'Create the veritical line in subrouting, works well '------------------------------------------------------------------------------------------ CreateVertLine( transform, lineChord, vertLine ) '------------------------------------------------------------------------------------------ 'Set Undo location '------------------------------------------------------------------------------------------ markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Create Geometric Constraints") '------------------------------------------------------------------------------------------ 'Constrain previously created line with spline, works well '------------------------------------------------------------------------------------------ ConstrainTangent( vertLine, botSpline ) Dim stat As Integer '------------------------------------------------------------------------------------------ 'receives no error, I assume GetStatus is being used properly '------------------------------------------------------------------------------------------ status1 = sketch1.GetStatus( stat ) '------------------------------------------------------------------------------------------ 'Check to see if the sketch is over constrained, If statement never entered but no error generated '------------------------------------------------------------------------------------------ If( status1 = sketch1.Status.OverConstrained ) theSession.UndoLastNVisibleMarks( 1, marksRecycled1, undoUnavailable1 ) ConstrainTangent( vertLine, topSpline ) End IfAny help would be greatly appreciated.
I would really appreciate any insight available. Thanks.
RE: Checking Journal Constraints VB
CODE
www.nxjournaling.com
RE: Checking Journal Constraints VB
the If statement is not being entered. I have tried it two different ways.
CODE --> VB
If status1 = sketch.Status.OverConstrained Then theSession.UndoLastNVisibleMarks( 1, marksRecycled1, undoUnavailable1 ) ConstrainTangent( vertLine, topSpline ) End IfCODE --> VB
If stat1 = sketch.Status.OverConstrained Then theSession.UndoLastNVisibleMarks( 1, marksRecycled1, undoUnavailable1 ) ConstrainTangent( vertLine, topSpline ) End Ifboth have the same result, there is no error generated but the if statement is not being entered.
RE: Checking Journal Constraints VB
www.nxjournaling.com
RE: Checking Journal Constraints VB
I have tried to use the inconsistent as well as over and neither gives me an error, though neither enters the If statement either.
RE: Checking Journal Constraints VB
www.nxjournaling.com
RE: Checking Journal Constraints VB
Just got pulled off onto something else so this will now have to wait till I get time again.
RE: Checking Journal Constraints VB
Sketch:001 in the part file is fully constrained, if you run the journal it will try to create a tangent constraint, detect the overconstrained sketch and perform an undo operation. If you edit the p8 dimension to be reference before running the journal, it will successfully create the tangent constraint.
http://files.engineering.com/getfile.aspx?folder=b...
www.nxjournaling.com
RE: Checking Journal Constraints VB
www.nxjournaling.com
RE: Checking Journal Constraints VB
I'm including a picture of the sketch. I have two spline creating an airfoil, I need the vertical line to be set tangent to one of those spline, but depending on the angle of the airfoil changes which spline needs to be selected to set the tangency constraint.
I believe you were right that this should be InconsistentlyContrained, but it is not working and I used the same callout in the if statement as in your example. My best guess is I'm not checking for the right error.
CODE -->
CreateVertLine( transform, lineChord, vertLine ) markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Create Geometric Constraints") ConstrainTangent( vertLine, botSpline ) Dim stat As Integer If sketch1.GetStatus( stat ) = sketch.Status.InconsistentlyConstrained Then theSession.UndoLastNVisibleMarks( 1, marksRecycled1, undoUnavailable1 ) ConstrainTangent( vertLine, topSpline ) End If theSession.ActiveSketch.Update()RE: Checking Journal Constraints VB
Added the callout and now it works.
Thanks for your help you really are a great help.