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:

X C-hook/NETHook generate NCI files


Recommended Posts

Hello all,

 

I am a newbie to C-Hooks, I read through the documentation but I could not find information on how to generate NCI files through C-Hook. I would like to generate this myself so I could add some additional information there for customization.

 

Any information pointers or sample code is helpful. I would prefer NET Hook code and if not C-hook.

headscratch.gif

 

Regards,

Surya.

Link to comment
Share on other sites

For chooks postOps function will generate an nci file. It'd look something like this:

code:

    post_dlg_settings ps;

 

/* create and save nci */

ps.save_nci_file = TRUE;

ps.overwrite_nci = TRUE;

ps.editNCI = FALSE;

 

/* don't create nc */

ps.save_nc_file = FALSE;

ps.overwrite_nc = FALSE;

ps.editNC = FALSE;

 

ps.send_to_machine = FALSE;

 

ps.export_oplist = TRUE;

ps.export_prm = TRUE;

ps.wcs_1014 = FALSE;

ps.descriptor = FALSE;

 

/* generate nci files */

postOps( &ps,

postprocessor,

destinationdir,

FALSE, /* CALL POST DIALOG */

FALSE); /* DISABLE POST BUTTON */

You can later call the run_post_exe_dll function to run it through a post processor.

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

I found that postOps works only if the operation has been selected. The question now is how do I select an operation from a C-hook (operation_manager with OPMGR_GET does not seem to do the trick)?

 

Thanks,

Marko

 

[ 07-26-2006, 08:55 PM: Message edited by: markov ]

Link to comment
Share on other sites

One more thing I have noticed. Try running the following simple C-hook under debugger:

code:

extern "C" __declspec(dllexport) int m_main(int not_used) {

post_dlg_settings p;

 

p.save_nci_file = TRUE;

p.overwrite_nci = TRUE;

p.editNCI = FALSE;

 

p.save_nc_file = TRUE;

p.overwrite_nc = TRUE;

p.editNC = FALSE;

 

p.send_to_machine = FALSE;

 

p.export_oplist = FALSE;

p.export_prm = FALSE;

p.descriptor = FALSE;

p.wcs_1014 = FALSE;

 

MessageBox(NULL, "Checkpoint 1", "CHookTest", MB_OK);

char t1[FILENAME_MAX] = "C:mcamxmillpostsMPFAN.PST", t2[FILENAME_MAX] = "C:mcamxmillnc";

postOps(&p, t1, t2, TRUE, FALSE);

MessageBox(NULL, "Checkpoint 2", "CHookTest", MB_OK);

 

return MC_NOERROR | MC_UNLOADAPP;

}

It reports some kind of heap corruption, although the release version executes apparently OK. Should I be concerned (I think I should)?

 

Marko

Link to comment
Share on other sites

Let me answer the first question myself. Maybe there is a beter way, but I have found the following can select the operation:

code:

operation_manager(&current_op, OPMGR_GET, &o_ptr, &s);

current_op.db.select_flag = TRUE;

operation_manager(&current_op, OPMGR_REWRITE, &o_ptr, &s);

Marko

Link to comment
Share on other sites

something like this will set all unselected operations to selected. I don't have my notes but for some reason I had to call operation_manager to force update something in the operation manager.

code:

op_list *opl;

opl = op_list_ptr;

while (opl != NULL)

{

if (opl->op.db.select_flag == FALSE)

{

MC_BOOL succf = FALSE;

DB_LIST_ENT_PTR eptr;

 

opl->op.db.select_flag = TRUE;

operation_manager( &opl->op, OPMGR_REWRITE, &eptr, &succf);

}

 

/* next operation */

opl = opl->next_ptr;

}

bryan smile.gif

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...