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:

markov

Verified Members
  • Posts

    102
  • Joined

  • Last visited

Everything posted by markov

  1. I have an operation library file with several groups, each group containig several operations. I want to import all operations from a group specified by a user. There is a function grplib_list that I thought would help do just that, so I have tried the following: code: char *operation_library = "C:McamxMillOpsRDEFAULT.OPERATIONS"; group_list *l = grplib_list( operation_library, // I: source file name GROUP_OPERATIONS, // I: GROUP_ALL, GROUP_GEOMETRY, GROUP_OPERATIONS, etc &succf); // O: TRUE = group info read ok It does return the groups list, but my problem is that long n_ents and emap *e members of the group_list structure are empty, and I would expect them to hold all operations in the group. Then I tried the same code on Mastercam 9, and the function did populate those members. But, I am not sure the values were correct, or maybe I just do not know how to use them, because I tried the following: code: operation op; long fpos; memset(&op, 0, sizeof op); op.op_idn = l->e[0].ent_idn; library_manager (OP_ID, operation_library, &op, &op.op_idn, LIBMGR_GET, &fpos, &succf); and got "Access violation exception". Failing that I tried getting just the list of operations from the library: code: op_list *op_head = 0; list_manager (OP_ID, operation_library, LSTMGR_GET, (void**)&op_head); It again returned nothing on Mastercam X, and caused "Access violation exception" on Mastercam 9. So what am I doing wong here? Thanks
  2. Yes, once you store them into the database with appropriate flags (ALIVE_BIT as in the example), they will also show on the screen - exluding the problem that MasterShake has reported.
  3. You specify the level when you call "store_ent" function, as you can see in the Roger's example. I am not sure what else you want, it does not get any easier than that!
  4. Be careful, unless you have some allocation happening between a_2d *arc; and (*arc).r = 0.5; you will corrupt application's memory. You probably want to change the first line to a_2d arc; and call the funnction with like this constr_circle(end_pt, c, cw, min_radius, &arc, &succf); Notice that I have fixed "succf" argument too, so just be sure you declare it as MC_BOOL succf; Now back to the message, I think you did not type it correctly. It says that it can not covert the argument from one type to another, where both types are the same! Can you just "cut & paste" it to avoid mistakes? Marko
  5. I forgot to mention in the above post that you need to create an operation after the first run in order to reproduce the problem. There is no problem if you do "File->New" before the second run, which means it is not equivalent to calling "dbinit" from a C-hook. So what other functions can we use to start fresh? Marko
  6. Roger, There is a problem with your code. If you add a "dbinit" call to the beining of the C-hook, you can not run it twice (there is an error message poping up). It seems that either "dbinit" does not know how to clean the groups properly, or we need a modification to the code. Marko
  7. Somehow I am afraid that may not be a good idea, who knows what else they initialize in the function. I found this morning that I can disable prompt in the settings, which may be acceptable, but I would still rather use a programatic solution. I could also change the setting from within a C-hook, call operation_manager and then restore, but I do not know how to access it either. Marko
  8. OK, I have installed MR2 SDK, and the sample program is working. Now, how can I gen directory name with machine definitions? I can not hardcode the path name, it may differ from one installation to another. Marko
  9. How can I prevent operation_manager(...,OPMGR_INIT,...) from prompting for NC filename? In other words, can I set it from a C-hook without user's intervention? Thanks Marko
  10. 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
  11. 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
  12. 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 ]
  13. Nice, more undocumented functions! Fortunately, it is working except that "SetActiveMachine" does not exist in the "MCMachineDef.lib" library. I suppose it is a new function in MR2 SDK that I have not installed yet. Thanks, Marko
  14. So, any solutions yet on how to programatically create a machine group? I can not add tools and operations without one, and I do not want to ask from my C-Hook users to manually create it if it is going to the same one every time, and I already know which one.
  15. quote: I am not sure this is what your are looking for but are you looking to make access to your c-hooks on the toolbar?I do not want to start the C-hook from the ribbon bar, if that is what you are suggesting. quote: I do not believe there is anyway to get the query boxes that come active with a c-hook to move into the toolbar.This is more what I had in mind: instead of a dialog box, the controls of my C-hook would reside in the ribbon bar.
  16. A simple question (I do not know if the answer is simply though): How do I put a control (input box, drop down list, ...) into the ribbon bar from a C-hook?
  17. Hi T.J., I installed servicepack001-update003, and as anticipated my HASP was not recognised any more. HASP driver fix was hanging, so I tried to unistall X, and got error 1603. I "managed" to unistall it with Microsoft Windows Installer CleanUp Utility, but I now get the error when I try to install Mastercam X from scratch. I created the log file as you suggested, but I do not see anything in it. Would you care to take a look? Thanks, Marko
  18. Perfect, so both were features, and everything is working as designed. In any case, do we need an updated SDK for SP1, or the old one is still OK? Thank you very much Marko
  19. Speaking of real "C" hooks (not C# or VB), I have few observations/questions. I used the stub generated by the c-hook wizard without any modification, and it did not run: the message box mentioned the incompatible version number. So I created a small driver, loaded one of the provided c-hooks, called "m_version" function, and there it was: the version number should be 1001, but the macro C_H_VERSION has the value of 1000. I suppose the 1001 means version 10, service pack 1, but the SDK files have not been updated. Or is there a newer SDK, which I have not got yet? My second observation is that when the dummy c-hook (with modified version number) terminates, the DLL is not unloaded properly, and is still locked. Is this a feature that would speed up subsequent loading, and if so can it be disabled? It is a big problem during the development, I can not rebuild it without shutting down the Mastercam. Marko
  20. Thanks, I shall check it again when I get to the right computer. But don't those functions need a list of groups as an input argument? I may be wrong here, I do not remember what exactly I saw when I was browsing through the header files the other day.
  21. How do I access operation groups from a C-hook? Namely, I want to rename existing groups and create new groups. Thanks
  22. I have finally had a chance to play with this again. First of all I managed to double click "properly" and get the content of the binary nci. What I found was interesting: After the C-hook terminates, this is what is in the nci file: Contents of binary NCI file * = dead sections Line# Fpos Op# Gcode NCI **** DIRTY NCI! ***** 0 0 OP1 G-2 SOS - start of nci section 1 21 OP1 G1006 I'm a little teapot short and stout 2 152 OP1 G-3 EOS - end of nci section When I regenerate toolpath, the content changes: Contents of binary NCI file * = dead sections Line# Fpos Op# Gcode NCI * 0 0 OP1 G-2 SOS - start of nci section * 1 21 OP1 G1006 I'm a little teapot short and stout * 2 152 OP1 G-3 EOS - end of nci section 3 170 OP1 G-2 SOS - start of nci section 4 191 OP1 G1006 Manual Entry 5 322 OP1 G-3 EOS - end of nci section What has happened here? And here is my simplified C-hook code: #include #include "m_vars.h" #include "m_init.h" #include "m_assoc.h" static void error(const char *s, ...) { char buffer[100]; va_list ap; va_start(ap, s); vsprintf(buffer, s, ap); va_end(ap); MessageBox(0, buffer, "Error", MB_ICONASTERISK); } static void test_nci_mgr (boolean *succf) { operation op; nci_bin n; db_ptr_type e_ptr; long fpos = 0; fpos = 0; // set binary nci file ptr to the end of the binary nci file nci_manager (0, NCIMGR_FEND, &n, &fpos, succf); if (!*succf) { error("NCIMGR_FEND"); return; } // make a manual entry operation using the 1st tool found in the database memset (&op, 0, sizeof (operation)); op.opcode = TP_MANUAL_ENTRY; // add a comment strncpy (op.comment, "I'm a manual entry operation", COMMENT_SIZE-1); // OPMGR_INIT_ADD writes the 'start of section' - // no need to call nci_manager (NCIMGR_WR_SOS) - OPMGR_INIT does not write the sos operation_manager (&op, OPMGR_INIT_ADD, &e_ptr, succf); if (!*succf) { error("OPMGR_INIT_ADD"); return; } nci_manager (op.op_idn, NCIMGR_WR_SOS, &n, &fpos, succf); // write some comments to the binary nci memset (&n, 0, sizeof (nci_bin)); n.gcode = NCI_COMMENT; n.op_idn = op.op_idn; n.tp_ent_idn = 0; strncpy (n.u.m1005.comment, "I'm a little teapot short and stout", COMMENT_SIZE-1); nci_manager (op.op_idn, NCIMGR_WR, &n, &fpos, succf); if (!*succf) { error("NCIMGR_WR 1"); return; } // now write the 'end of section' marker for the new operation memset (&n, 0, sizeof (nci_bin)); nci_manager (op.op_idn, NCIMGR_WR_EOS, &n, &fpos, succf); if (!*succf) { error("NCIMGR_WR_EOS"); return; } // or you could write the end of section with the operation_manager as shown // operation_manager (&op, OPMGR_NCI_ACCEPT, &e_ptr, succf); } void CH_ENTRY m_main(long *ptrs) { boolean succf; if (!open_app(ptrs)) return; test_nci_mgr (&succf); close_app(ptrs); }
  23. BTW, "mvukovic" is my alternate user id. It is sort of work/home thing: I could not remember this one when I created it, and later I found information at my work computer.
  24. Yes, I tried, but even with a double-click with the right button while holding shift and ctrl keys I still get the standard pop-up context menu. Was this feature supported in version 8 (that is what I used for my experiments)? In addition to not having errors reported, I have another reason to believe that something actually gets written into the file: fpos parameter gets bigger after every write operation. Now it is just the metter of getting all this stuff back! I was trying to write comments (1005) into the file because that was the simplest test, and it was already supplied as a sample. I am going to try with some real operation next, hoping that is is just the comments that do not work! Marko

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