cancel
Showing results for 
Search instead for 
Did you mean: 

Change direction points of a tool path

Valued Contributor
Valued Contributor

Hello,

 

[NX Open - JAVA]

I got an operation and I want to get the points from the tool path, where it change its direction (I'm interesting mainly in the cutting moves). I'll like if someone can please tell me how do I do that.

 

Thanks,

Tom.

13 REPLIES

Re: Change direction points of a tool path

Valued Contributor
Valued Contributor

LONG STORY SHORT:
What is the API to get this coordinates:

2016_10_10_16_13_51_NX_11_Manufacturing_GettingCenter.prt_Modified_.png

Re: Change direction points of a tool path

Esteemed Contributor
Esteemed Contributor

You may have to parse the internal toolpath (although there may be something more elegant out there, I don't know).

For some specific operation types (generic motion, lathe teach mode) you may be able to parse thru the sub-ops, iIF they are all "goto" points.  If they follow a contour, that may not work.

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Re: Change direction points of a tool path

The internal tool path has events, not points. I think you need to use the CAM path class.

Mark Rief
Retired Siemens

Re: Change direction points of a tool path

Esteemed Contributor
Esteemed Contributor

The move collection of a operation contains the path information, but it is not well documented how to work with it.

There might be some examples at the solution center.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: Change direction points of a tool path

Genius
Genius

Hi Tom!

 

I agree with all answers provided here, as Mark said, you should use the CAM-Path class.

Unfortunately Stefan's answers is correct as well, there is little documentation on it,

since the API has been extended on this. I think you will have to use NX 10.0.3 to use

the following stuff.

 

Sorry it's C#, but perhaps it will give you something to start with:

 

 

1) Operation curOperation = ...;
2) Path curPath = curOperation.GetPath();
3) int motionCounter = curPath.NumberOfToolpathEvents;
4) PathLinearMotion pathLinearMotion = curPath.GetLinearMotion(motionIterator);

 

So step by step:

1) You should know the operation you want to work with.

2) Then you can extract the PATH-Class (as Mark said)

3) NumberOfToolpathEvents gives you the total amount of motions in this operation

   (You can iterate over all motions with that integer)

4) Depending on the motions in your operation you will have to use PATHLINEARMOTIONS or

   some other classes (e.g. CIRCULARMOTIONS, etc.)..

 

The object of type PATHLINEARMOTION contains the information, you can use some methods like

(getFeedrate, setFeedrate, Endpoint, etc.).

 

FYI:

Another important note on changing the motions:

There is a way to check the 'type' of ToolpathEvent with

CamPathToolpathEventType myType = curPath.GetToolpathEventType(eventNumber);

So let's say your first ToolpathEvent is a MOTION and you extract it with the code above

as a PATHLINEARMOTION. Then you change the feedrate the ToolpathEventType will be SYSTEM!

This problem is already reported but as far as I know it is not fixed yet. This won't

cause big trouble unless you want to make clean code and do some typecasting/typechecking stuff.

 

Hope that will give you something to start with.

 

Flo

 

Re: Change direction points of a tool path

Valued Contributor
Valued Contributor

Thank you very much, looks great for start with.

I'll update soon.

 

Thanks again!

Re: Change direction points of a tool path

Valued Contributor
Valued Contributor

It's working! BUT yet I got few problems:

 

When it enter to the "SYSTEM" case and I want to get the value I get an exception:

"Tool path event is not of the correct type."

 

switch (path.getToolpathEventType(i).ordinal())
{
  case CamPathToolpathEventType._MOTION:
	PathLinearMotion linearMotion = path.getLinearMotion(i);
	currentPoint = new Point3d(linearMotion.endPoint().x, linearMotion.endPoint().y, linearMotion.endPoint().z);
	break;
  case CamPathToolpathEventType._SYSTEM:
	PathCircularMotion circularMotion = path.getCircularMotion(i);
	urrentPoint = new Point3d(circularMotion.endPoint().x, circularMotion.endPoint().y, circularMotion.endPoint().z);
	break;
  case CamPathToolpathEventType._UDE:
	PathHelixMotion helixMotion = path.getHelixMotion(i);
	currentPoint = new Point3d(helixMotion.endPoint().x, helixMotion.endPoint().y, helixMotion.endPoint().z);
	break;
  default:
	System.err.println("Check the movements types of: " + i_Operation.name());
	isValidValue = false;
	break;
}

I'll appreciate you help please Smiley Happy

Re: Change direction points of a tool path

First - there is a typo - urrentPoint should probably be currentPoint

I'm not sure getCircularMotion is valid for a system event.

Mark Rief
Retired Siemens

Re: Change direction points of a tool path

Valued Contributor
Valued Contributor

Do you have any idea how can I ask for the value of system event?