×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Java: CurveCurvatureAnalysisBuilder - get the min bend radius

Java: CurveCurvatureAnalysisBuilder - get the min bend radius

Java: CurveCurvatureAnalysisBuilder - get the min bend radius

(OP)
I am using the CurveCurvatureAnalysisBuilder in code and want to get the minimum radius that this builder creates.

I can get the builder to do the analysis and if I run my code and go into NX, the result is there in the 3D view.

The issue is that I can not figure out the method calls that are needed to get the actual result.

commit() returns null.
post commit allows this method to return a result:
builder.getCommittedObjects(); // this is an array of 1 CurveCurvatureAnalysis object.

Here is my method that does the work so far:
	private Double ascertainMinRadius(Edge edge) throws NXException, RemoteException {
	    nxopen.Session theSession = (nxopen.Session)nxopen.SessionFactory.get("Session");
	    nxopen.Part workPart = theSession.parts().work();

	    CurveCurvatureAnalysisBuilder builder =
	    		workPart.analysisManager().analysisObjects().createCurveCurvatureAnalysisBuilder(null);

	    try {
		    builder.combRange().start().expression().setRightHandSide("0");
		    builder.combRange().start().expression().setRightHandSide("0");
		    builder.combRange().center().expression().setRightHandSide("50");
		    builder.combRange().center().expression().setRightHandSide("50");
		    builder.combRange().end().expression().setRightHandSide("100");
		    builder.combRange().end().expression().setRightHandSide("100");
		    builder.combOptions().setAnalysisType(nxopen.geometricutilities.CombOptionsBuilder.AnalysisTypes.RADIUS);
		    builder.combRange().start().expression().setRightHandSide("0");
		    builder.combRange().start().setParameterUsed(false);
		    builder.combRange().center().expression().setRightHandSide("50");
		    builder.combRange().center().setParameterUsed(false);
		    builder.combRange().end().expression().setRightHandSide("100");
		    builder.combRange().end().setParameterUsed(false);
		    builder.setReverseDirection(1);


		    EdgeTangentRule edgeTangentRule = workPart.scRuleFactory().createRuleEdgeTangent(edge, null, true, 0.5, false, false);
		    nxopen.SelectionIntentRule [] rules1  = new nxopen.SelectionIntentRule[1];
		    rules1[0] = edgeTangentRule;
		    builder.selectedCurves().replaceRules(rules1, false);
		    builder.combRange().start().update(nxopen.geometricutilities.OnPathDimensionBuilder.UpdateReason.PATH);
		    builder.combRange().end().update(nxopen.geometricutilities.OnPathDimensionBuilder.UpdateReason.PATH);



		    builder.combOptions().setMinimumLabelEnabled(true);
		    builder.combOptions().setAnalysisType(nxopen.geometricutilities.CombOptionsBuilder.AnalysisTypes.CURVATURE);
		    builder.combOptions().setScaleFactor(1.04);
		    builder.combOptions().setDensity(10000); // 10,000 max value.  This is the highest accuracy.
		    builder.combOptions().setIntermediateDensity(0); // this does nothing but setting anyway (with high density, this should be low, like 0 or 1)


		    builder.commit(); // return null.

		    nxopen.NXObject [] objects1 = builder.getCommittedObjects();
		    for (NXObject nxObject : objects1) {
		    	CurveCurvatureAnalysis curveCurvatureAnalysis = (CurveCurvatureAnalysis) nxObject;
		    	String name = curveCurvatureAnalysis.name();
		    }
		    // WHAT DO I DO HERE?
		    // WHAT DO I DO HERE?
		    // WHAT DO I DO HERE?
		} finally {
	    	builder.destroy();
	    }

	    return 1e-6;
 

RE: Java: CurveCurvatureAnalysisBuilder - get the min bend radius

As far as I can see, this builder object doesn't give you the minumum radius.

I couldn't find an NXOpen.UF function to do this, either, though I vaguely recall that there is one.

If there are no suitable functions, you'll have to write your own. Just calculate the radius of curvature at a large nunber of points along the curve.

RE: Java: CurveCurvatureAnalysisBuilder - get the min bend radius

(OP)
I did go down the route you mentioned but performance was bad.

So, I did more digging and stumbled upon the answer (awesome documentation for NX, right).

		UFSession ufs = (UFSession)SessionFactory.get("UFSession");
		UFModlGeneral modlGeneral = ufs.modlGeneral();

		minRadius = Double.MAX_VALUE;

		for(int i = 0; i < samples; i++) {
			double sample = i/(samples-1.0);
			AskCurvePropsData curveProps = modlGeneral.askCurveProps(edge.tag(), sample);
			minRadius = Math.min(minRadius, curveProps.radOfCur);
		} 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources