How to name .nc files without having to use 4 digit numbers?

How to name .nc files without having to use 4 digit numbers?

smunzer8ZZFW
Enthusiast Enthusiast
2,085 Views
22 Replies
Message 1 of 23

How to name .nc files without having to use 4 digit numbers?

smunzer8ZZFW
Enthusiast
Enthusiast

Hello, I am helping teach a CIM course and the Post processors we use in Fusion 360 will not allow us to post gcode that is not named with a 4 digit number. is there a way to change this?

 

thank you in advance. 

0 Likes
2,086 Views
22 Replies
Replies (22)
Message 2 of 23

seth.madore
Community Manager
Community Manager

If you use NC Programs, you're given the ability to create a file that has a name, not a number.

Single click on the Setup and then Right Click > Create NC Program

From there, you're given a new UI, and just enter in the fields accordingly


Seth Madore
Customer Advocacy Manager - Manufacturing


Message 3 of 23

smunzer8ZZFW
Enthusiast
Enthusiast

This can be done directly from fusion 360 manufacture tab when creating the .nc file?

0 Likes
Message 4 of 23

smunzer8ZZFW
Enthusiast
Enthusiast

this is the error I receive. 

0 Likes
Message 5 of 23

ltomuta
Advisor
Advisor

Change just the file name and let the name/number be a number ltomuta_0-1675326017456.png

You can also alphanumeric values for both, like I have, but that requires post processor edits 

ltomuta_1-1675326195746.png

 

Message 6 of 23

programming2C78B
Advisor
Advisor

in my case at least, this would save a file called 1111.nc and only have a header inside the text. I want to make gcode simply called "dovetail.nc" instead of 001

EDIT: Maybe something changed, but File Name now does work as it should! 

Please click "Accept Solution" if what I wrote solved your issue!
0 Likes
Message 7 of 23

seth.madore
Community Manager
Community Manager

What post processor are you using?


Seth Madore
Customer Advocacy Manager - Manufacturing


0 Likes
Message 8 of 23

ltomuta
Advisor
Advisor

File name change works as it should for me and that should not be post processor specific. Maybe OS specific? On Windows seems to be OK.

0 Likes
Message 9 of 23

smunzer8ZZFW
Enthusiast
Enthusiast

this is the post I am using, I haven't tried editing this post, but there is a program name variable that calls for it to be an integer. I am running the most recent version of fusion on windows 10 @ltomuta @programming2C78B . I will attach the post below. the post is for a pre-ngc haas mini mill however the mini mill is still capable of recieving nc files with names as that is how we do it in mastercam. 

0 Likes
Message 10 of 23

ltomuta
Advisor
Advisor

See the attached file with the minimum required change. Not fully tested though, the Autodesk Post Processor Utility extension still does not allow testing with an alphanumeric program name. The gist of it is this (plus setting

programNameIsInteger to false at the top of the file):

ltomuta_0-1675366283861.png

 

0 Likes
Message 11 of 23

ltomuta
Advisor
Advisor

Oh, btw. the above code change won't work on Mac, for some reason try/catch does not work on that platform. If you are on Mac, comment out this line, like so:

 

    try {
      //programId = getAsInt(programName); 
    } catch (e) {

The rest of the changes remain valid.

 

0 Likes
Message 12 of 23

smunzer8ZZFW
Enthusiast
Enthusiast

@seth.madore @ltomuta 

I found if you just remove both of those blocks of code that you posted above the post works fin wand allows you to name it wat you want. 

edit: you also have to remove at the beginning of the post the code line that says File name as integer = true;

0 Likes
Message 13 of 23

ltomuta
Advisor
Advisor

Deleting that code is like breaking up with your girlfriend just so that you don't get her pregnant. It works, but ... 🙂

0 Likes
Message 14 of 23

smunzer8ZZFW
Enthusiast
Enthusiast

I understand the sentiment, but I have tried everything else. If you have a better option I’m all ears. 

0 Likes
Message 15 of 23

ltomuta
Advisor
Advisor
0 Likes
Message 16 of 23

smunzer8ZZFW
Enthusiast
Enthusiast

The edits on the HAAS edited post are not working on the HAAS lathe post would you be able to see if I did something wrong. I also am trying to get it too work on my Centroid and AXYZ post but they are all stating the Same error now that is MaximumlineLength is not defined. I appreciate the time you are taking to help with this, I am new to post processor editing but I am helping teach a CIM course and include fusion, we only used to use mastercam. 

0 Likes
Message 17 of 23

ltomuta
Advisor
Advisor

@smunzer8ZZFW wrote:

... they are all stating the same error now that is MaximumlineLength is not defined.


That's because MaximumlineLength is not defined in those post-processors. But you don't need it. You keep each post-processor's own implementation and only tweak the parts that are blocking your use of alphanumeric names.

1. Set 
programNameIsInteger to false

2. Initializes programId = 1010 with a number. If machines want a number, give them one. Same one all the time it that's not a problem for the machines.

3. Only return an error inside that catch if you changed programNameIsInteger back to true for some reason, so 

    } catch (e) {
      // well, program name only has too be a number if programNameIsInteger says so
      if(programNameIsInteger) {
      error(localize("Program name must be a number."));
        return;
      } else {
        // it's fine, programId 1010 set above will do
        
      }

    }

 

Leave the rest of the code as already written in the post. It is fine as is.

By making the changes above you have ensued that the code works regardless of the value you set for your program's name. If you call it "MyProgram" it will output a file named MyProgram.nc with the first line being O1010. If you call it "2020" (a number) it will create a file named 2020.nc with the first line being 02020. So total flexibility with just a few changes.


 

0 Likes
Message 18 of 23

smunzer8ZZFW
Enthusiast
Enthusiast

UPDATE: i have redefined the naming convention based on the methods that the forest post used it. I write in a set default header for the machine pendant to recognize. what do you think about this? 

0 Likes
Message 19 of 23

smunzer8ZZFW
Enthusiast
Enthusiast

The solution I added above will actually comment out the program name so that in the MDI you can see your name, that function is the same on the haas post you edited. I used the method screen shotted above in my other posts and they seem to be working fine. 

0 Likes
Message 20 of 23

ltomuta
Advisor
Advisor

Hard coding the program name/number header the way you did it has no advantage whatsover over setting the value in programId as I have already  shown you twice.

var programId = 1010;

But it is your post, your choice.