Cancel
Showing results for 
Search instead for 
Did you mean: 

Tool path's motions

Siemens Creator Siemens Creator
Siemens Creator

Hi,

 

I'm trying to get tool path's motions (Linear \ Circular \ Helical), but I'm facing a problem while doing so.

For some reason, I get a "Tool path event is not of the correct type" exception, even that I checked before I asked for the value.

 

The code:

 

Path path = SomeOperation.getPath(); // the tool path.
int motionCounter = path.numberOfToolpathEvents(); // number of tool path events.
for (int i = 1; i <= motionCounter; i++)
{
	IsToolpathEventAMotionData current = path.isToolpathEventAMotion(i);
	if(current.answer)
	{
		try
		{
			if(current.motionshape.equals(CamPathMotionShapeType.LINEAR))
			{
				System.out.println("*Linear*");
				PathLinearMotion linearMotion = path.getLinearMotion(i);	
			}
			else if(current.motionshape.equals(CamPathMotionShapeType.CIRCULAR))
			{
				System.out.println("*Circular*");
				PathCircularMotion Circular = path.getCircularMotion(i);	
			}
			else if(current.motionshape.equals(CamPathMotionShapeType.HELICAL))
			{
				System.out.println("*Helical*");
				PathHelixMotion helixMotion = path.getHelixMotion(i);	
			}
			else
			{
						System.out.println("*OTHER!*");
			}
		}
		catch(Exception exception)
		{
					System.out.println(exception.getMessage());
		}
	}

 

The output:

*Linear*
*Linear*
Tool path event is not of the correct type.
*Linear*
*Linear*
*Linear*
*Linear*
Tool path event is not of the correct type.

 

 

 

 

 

JAVA

NX 11.0

4 REPLIES

Re: Tool path's motions

Have you reviewed this thread?  It looks like the same issue. I posted sample code there on how to deal with the different motion types.

Mark Rief
Retired Siemens

Re: Tool path's motions

Siemens Creator Siemens Creator
Siemens Creator

Thanks, but I already saw this thread.

It doesn't explain why I keep getting an exception even it passed all the validity checks.

 

Edit:

After some debug I saw that the motions that doing the problems are "System" CamPathToolpathEventType. 
Is there another way to get the value of those motions?

 

In other words:
How do I get the value of a SYSTEM motion?

Re: Tool path's motions

Tal,

I don't understand what you are expecting to get from a SYSTEM event. But for sure, Path.IsToolpathEventAMotionData should be false for a SYSTEM event. 

In your code above, we have a couple suggestions. First, comment out the code that is getting the motion data. If the problem goes away, uncomment the code and do a dispose for each motion type.

If that does not fix the problem, since you work for us, contact me directly and I'll set up an internal meeting, since I have the folks who write the CAM API sitting right here. 

Mark Rief
Retired Siemens

Re: Tool path's motions

Experimenter
Experimenter

Hi, Sir

I am now want to get the path data, like the tool center point, the tool axis vector, with the NXopen C++, How can I do this? Which kind of Classes, menbers or functions should I use? Thank you.