Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Toolpath filename in SDK


Recommended Posts

Can anyone tell me where I can find the toolpath filename in the SDK.

 

I have found a field in the group_list structure called Group->og1.pg1.tpname but it always seems to contain MACHINE_GROUP_n no matter what filename was given to the tool path when it was posted.

 

If I use the list_manager() to access the op_list, there is a field Oplist->op.cmn.nci_name which contains the NCI filename which has the correct filename but with a different directory and an nci extension.

 

Also where do I find the directory that the toolpath was saved in.

 

When I post process the toolpath, the directory always defaults to mcamxmillnc. Is there a way to change this default?

 

Thanks

Link to comment
Share on other sites

This function is in MachineDefFilesAndPaths_CH.h, which is included by m_machinedef.h. It does what you're looking for. Incidentally, you're working too hard... there's a nicer way to get the NCIFile

 

code:

// Return the active NC file name

// String is empty, if it can't be found

DllImpExp CString& NCFile (

group_list *pTpGroup = NULL, // I: toolpath group to get file for

LPTSTR path = NULL, // O: path to file

LPTSTR fname = NULL, // O: file name

LPTSTR ext = NULL); // O: extension

To change the directory you're posting to, you'll probably want this guy:

code:

// Define the active NC path

// String is empty, if it can't be found

DllImpExp MC_BOOL SetNCPrefix (

LPCTSTR path, // I: new path

group_list *pTpGroup = NULL); // I: toolpath group to set path for

It's in the same place.

 

You're going to also want this:

code:

// Return the active NCI file name

// String is empty, if it can't be found

DllImpExp CString& NCIFile (

group_list *pTpGroup = NULL, // I: toolpath group to get file for

LPTSTR path = NULL, // O: path to file

LPTSTR fname = NULL, // O: file name

LPTSTR ext = NULL); // O: extension

The defaults on all of these work nicely for the active MD. Actually, I'd recomend opening the MachineDefFilesAndPaths_CH.h header from the sdk and reading through it. It's an absolute lifesaver.

 

Hope this helps

 

________________________

Jon Griffin

Software Engineer

CNC Software

Link to comment
Share on other sites

Thanks for the response.

 

The NCFile() routine works ok for a machine Group which only has 1 operation or for a Machine Group which has more than one operation and all the toolpath files have the same name. However, if you have a machine group which has more than 1 operation each with a differently named toolpath file, the NCFile() routine returns what seems to be a default filename (MACHINE_GROUP_1 in my case). I am looking for a way to get the filename for each of the operations.

 

Thanks.

Link to comment
Share on other sites
  • 2 weeks later...

CaKiwi

 

 

I'm not an expert on this by any means, but I'll chime in anyway. wink.gif

quote:

If I use the list_manager() to access the op_list, there is a field Oplist->op.cmn.nci_name which contains the NCI filename which has the correct filename but with a different directory and an nci extension.


I believe you're on the correct course, but I'm curious about "..but with a different directory".

 

Oplist->op.cmn.nci_name

 

Gets you the NCI, as the 'nci_name' would sugggest.

That pathfilename gets "tranformed" into the toolpath output name by replacing the .NCI extension with the 'NC file extension' in the active Machine/Control Definition.

* It is defined on Files topic page (lower left) in the Control Definition.

There of course is a way to retrieve this 'NC file extension'.

 

Maybe to clarify (to me) what exactly you're trying to get.

 

Run Zip2Go on your sample MCX. Now double click on the 'Zip2Go_(your filename here).txt file.

Look down thru the report and note the toolpath filenames listed for each operation.

 

Is this the data you're looking for ?

Link to comment
Share on other sites

Thank for the response, Roger.

 

I ran Zip2Go and the toolpath filenames listed in the report are the ones I want. They are the default filenames used when the operations are post processed. For example,

 

C:mcamxMILLNCMACHINE_GROUP_1_1.NC

C:mcamxMILLNCMACHINE_GROUP_1_2.NC

C:mcamxMILLNCMACHINE_GROUP_2_1.NC

C:mcamxMILLNCMACHINE_GROUP_2_2.NC

C:mcamxMILLNCMACHINE_GROUP_2_3.NC

 

in the following snippet from the Zip2Go file.

 

It seems like I can get the file base name from the NCI file and the extension from a global variable (I forget which one at the moment, but I have used it before). My only questions are how do I get the directory and is this really the easiest way to do this?

 

OP1

Circle Mill

C:mcamxMILLNCMACHINE_GROUP_1_1.NC

 

OP1

Pocket (Standard)

C:mcamxMILLNCMACHINE_GROUP_1_2.NC

 

OP2 Flip Part

Manual Entry (M00 (FLIP PART - USE HOLES TO HOLD PART )

C:mcamxMILLNCMACHINE_GROUP_2_1.NC

 

OP2 Flip Part

Pocket (Standard) - Pocket on Bottom

C:mcamxMILLNCMACHINE_GROUP_2_2.NC

 

OP2 Flip Part

Contour (2D) - Profile on Bottom

C:mcamxMILLNCMACHINE_GROUP_2_3.NC

Link to comment
Share on other sites

Here's what I'm doing to get the NC program filename

 

1) Looping through the operation list and extracting the base file name from the nci file in the op.cmn.nci_name field.

 

2) Calling NCFile() and extracting the directory from the filename returned.

 

3) Creating the full file name by concatenating the directory obtained in step 2, the file name obtained in step 1 and the nc_suffix variable.

 

If anyone has a simpler way, I would be happy to hear from them.

Link to comment
Share on other sites
  • 1 year later...

Hello. I have 1 operation in my file that contains three different postOps that I do for different geometry orientations for one chook. I need to change the NC name so that when I run postOps these names will be different. So I am querying the name, using NCFile function. Then I'd like to use op.cmn.nci_name to change the operation's NC name. Then I can postOps unique names. However, I don't understand how to use this:

 

char fname[260] = {"C:mcamxRPRoughingtest.nc"};

op.cmn.nci_name = fname;

 

This returns an error. I don't understand how to use this. Any help?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...