Failing when changing spindle speed between operations

Failing when changing spindle speed between operations

InfoGZ52M
Enthusiast Enthusiast
512 Views
7 Replies
Message 1 of 8

Failing when changing spindle speed between operations

InfoGZ52M
Enthusiast
Enthusiast

When I edit the spindle speed between 2 similar or identical operations, the post fails and produces this error message:

 

###############################################################################
Error: Mismatching arguments for invocation of 'string FormatNumber.format(Number) const' (Value is not a number.).
Error at line: 406 (dynapath-B6GX5.cps)
Error in operation: '2D Pocket3 (3)'
Failed while processing onSection() for record 1636.
###############################################################################

Error: Failed to invoke function 'onSection'.
Error: Failed to invoke 'onSection' in the post configuration.
Error: Failed to execute configuration.
Stop time: Sunday, June 22, 2025 4:54:17 PM
Post processing failed.

 

I've been comparing this post with others that do work OK and I'm stumped. I've attached a sample model, the post, the code produced, and the error log.

 

In the model I changed the feed between 2Dpocket 1 and 2, and changed the spindle speed between pocket 2 and 3. It processes the feed change OK, but not the spindle speed, it fails before processing pocket 3. I can post process the model OK with other posts for other machines. What did I do wrong here?

 

 Model - https://a360.co/44ebF4A

0 Likes
Accepted solutions (1)
513 Views
7 Replies
Replies (7)
Message 2 of 8

rohit_maneYV8C9
Autodesk
Autodesk

Hello @InfoGZ52M ,
The value of lengthOffset is not updated, which causes a runtime error because its current value is undefined. Therefore, along with the firstToolNumber variable, you must also update the lengthOffset variable at line number 405 in your post.

var lengthOffset = section.getTool().lengthOffset;

 

0 Likes
Message 3 of 8

InfoGZ52M
Enthusiast
Enthusiast

I added that line to my post, now it post processes that test model. I used it to make code for a production part and it failed again. I worked on the test model to reproduce the problem, I added a cycle with a different new tool. Now it fails like the production part fails. Those files are attached to this post.

https://a360.co/44ebF4A

Next post shows a new problem I discovered while testing.

0 Likes
Message 4 of 8

InfoGZ52M
Enthusiast
Enthusiast

I then discovered that the new post when it does not fail and creates a complete program, it makes an error in the tool number of the last tool changed. I suppressed the 3rd cycle in the model, this allowed the post to make a complete program without failing. In this program, line N189 should have T0120, not T0101. T0101 applies the tool offsets for tool 01 to the current tool in the spindle which is tool 20. This nearly crashed the machine. The rest of this program seems OK. I tried the post with other models with multiple tools and it seems to always work OK except for the last tool offset call. Model and program file and post attached.

https://a360.co/46mztFP

0 Likes
Message 5 of 8

rohit_maneYV8C9
Autodesk
Autodesk

Hello @InfoGZ52M ,
The code in the post-processor uses the variable lengthOffset, which is declared at line 338. However, this variable is not updated when there is a change in spindle speed or direction. To address this, you should either move the update outside of the current conditional block or ensure it is updated again, as shown in the image. Adding the line at 397 will effectively resolve both issues.

rohit_maneYV8C9_0-1751278431781.png

Refer to the following details to identify the tools used in different operations:

  • getPreviousSection().getTool() returns the tool used in the previous operation.

  • tool refers to the current tool.

  • getNextTool(tool.number) returns the tool used in the next operation.

 

0 Likes
Message 6 of 8

InfoGZ52M
Enthusiast
Enthusiast

I edited the post per your instructions and it no longer fails. I does still post the wrong tool offset info at the last toolchange.

I've attached the edited post and it's output. On line N271 The T word should be T0120, not T0101. T0120 preloads the first tool (01) into the toolchange shuttle then enters the offsets for tool 20 into the control. Tool 20 was inserted on line N270 with T2000. Later, the M6 on line N292 puts the first tool (01) back into the spindle to keep the spindle taper clean.

0 Likes
Message 7 of 8

rohit_maneYV8C9
Autodesk
Autodesk
Accepted solution

Comment out line number 406, which we added earlier, as shown in the image.

Message 8 of 8

InfoGZ52M
Enthusiast
Enthusiast

That fixed it. Thank you for your help!

0 Likes