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:

CaKiwi

Verified Members
  • Posts

    63
  • Joined

  • Last visited

Everything posted by CaKiwi

  1. Thanks for the reply, Roger. Do you have any example source code on how to do this?. Is the source of Zip2Go available? Thanks again. Ian Donaldson
  2. I have a MasterCAM part file which uses custom tool profiles. In my NetHook, how do I determine that a tool uses a custom profile, how do I find the name of the file containing the custom profile and how do I extract the profile from the file. Thanks in advance
  3. It does not work for me. All I need is a function with the one line declaring TpList. It gets the following error in a pop up window when it exits the function: Run Time Check Failure #2 - Stack around the variable 'TpList' was corrupted. I tried compiling with and without debug and running with and without a part loaded. I am running the latest SDK with X4. If I don't declare and assign TpList but instead just use TpMainGrpMgr.GetMainGrpList() directly it work fine. The code gremlins must be really chuckling over this. I don't get a failure when I do something that should fail and do get a failure when I do something that should work.
  4. @Sigmawave Here's how I now handle traversing operation groups for versions X through X4. I have a separate VS project for each and define the appropriate compile time variable VER_Xn in each project. code: #if defined(VER_X) || defined(VER_X2) #define GROUP_LIST group_list #endif #if defined(VER_X3) || defined(VER_X4) #define GROUP_LIST op_group #endif GROUP_LIST *getNextGroup(GROUP_LIST *pGroup, int ix) { #if defined(VER_X) || defined(VER_X2) if (ix == 0) { return group_list_ptr; } if (pGroup != NULL) { return pGroup->next_ptr; } #endif #ifdef VER_X3 if (ix < TpMainGrpMgr.m_MainGrpList.GetSize()) { return TpMainGrpMgr.m_MainGrpList.GetAt(ix); } #endif #ifdef VER_X4 if (ix < TpMainGrpMgr.GetMainGrpList().GetSize()) { return TpMainGrpMgr.GetMainGrpList().GetAt(ix); } #endif return NULL; } // Calling the function GROUP_LIST *p1; p1 = getNextGroup(NULL, 0); // First group p1 = getNextGroup(p1, ix); // Subsequent groups I also use the compile time variables for other changes for each release. I use VS 2003 for X, VS 2005 for X2 and X3 and VS 2008 for X4. I agree with Roger that you will not be able to use VS 2008 for them all. @Roger Sorry, I somehow missed the Whats New doc and it does seem to tell me all I needed to know. That said, yes, change happens but we work with a number of CAD/CAM systems and the others all do a better job of isolating users of their API from internal changes. But I greatly appreciate your assistance with this problem. Do you have any thoughts on the memory corruption I mentioned in my previous post? Thanks again.
  5. The code worked fine for me. When I called pGroup = TpMainGrpMgr.GetMainGrpList().GetAt(ix1++); after processing the last group, pGroup was set to NULL without any error. But I will change my loop to check for the number of groups. The reason I did it that way was that the code needs to work for X, X2, X3 and X4. For X and X2 I use the following code in the same loop within compile time variables group_list *pGroup; group_list pGroup = group_list_ptr; while (pGroup) { /* ... */ pGroup2 = pGroup2->next_ptr; } I will need to change this code to get a count of the number of groups. Is there a way to get the number of groups in X and X2 without traversing the list and counting them? What didn't work for me was creating a function which declared and assigned a tpGrpList even without any other code e.g. void func() { tpGrpList TpList = TpMainGrpMgr.GetMainGrpList(); } This fails with an error exiting func saying that the stack has been corrupted around TpList. It is a nuisance for us when the code is changed for every release of MasterCAM without any warning or documentation that I know of. I hope that the nethook interface will be more stable for future releases. Thanks again for the help.
  6. Thanks for the reply, Roger. I used code similar to this code: op_group *pGroup = TpMainGrpMgr.GetMainGrpList().RetrieveFirstOperationGroup(); ix1 = 1; while (pGroup) { /* ... */ pGroup = TpMainGrpMgr.GetMainGrpList().GetAt(ix1++); } But I found that I get memory corruption problems if I declare and intiialize a group list as follows: code: tpGrpList TpList = TpMainGrpMgr.GetMainGrpList(); op_group *pGroup = TpList.RetrieveFirstOperationGroup(); ix1 = 1; while (pGroup) { /* ... */ pGroup = TpList.GetAt(ix1++); } It is of only academic interest as I have it working but I wonder if you have any thoughts on why this is.
  7. In X3 my C code cycled through groups as follows: code: extern DllImpExp TpGrpMgr TpMainGrpMgr; op_group *pGroup = TpMainGrpMgr.m_MainGrpList.GetAt(0); int i = 0; while (pGroup != NULL) { ... i++; pGroup = TpMainGrpMgr.m_MainGrpList.GetAt(i); } This code get an error in X4: error C2039: 'm_MainGrpList' : is not a member of 'TpGrpMgr' How do I do the same thing in X4? Thanks
  8. I have just heard from CNC support that the tlno field replaced the slot field in X3 but there is a bug in X3 where it sometimes contains the wrong number. It will be fixed in X3 MU1
  9. Sigmawave, I tried the tlno field but, as I mentioned in my original post, it usually does not contain the same number as the old slot field in version X2.
  10. In X2 I used the following code to get tool numbers from the slot field of binaryNCI.u.m20004. In X3, the slot field no longer exists. There is a new field tlno but it sometimes contains the correct numbers and somtimes contains different numbers. Any help greatly appreciated. code: nci_manager(operIdent, NCIMGR_RD_SOS, &binaryNCI, &filePosit, &goodSoFar); while (goodSoFar) { nci_manager(operIdent, NCIMGR_RD, &binaryNCI, &filePosit, &goodSoFar); if (goodSoFar) { codeValue = binaryNCI.gcode; switch (codeValue) { .... case NCI_TOOL_INFO: slot20004 = binaryNCI.u.m20004.slot; break; .... } } } [ 10-14-2008, 05:24 PM: Message edited by: CaKiwi ]
  11. Thanks for the help, Roger. It is working well for me
  12. Thanks for the response Takashi. I'm sorry I haven't got back to you sooner but I have been working on other problems. I have experimented with using named_view_manager and found the using VWMGR_SELECT for the mode argument allows the user to select a view. However, the view structure returned has an m field which gives the X, Y and Z rotation of the view but does not contain the origin of the view. Is there a way to get this information? Thanks
  13. Is it possible to allow the user to pick a WCS from the screen? Alternatively, is there a way to get a list of the names of all WCS's in the model along with their matrix values? Thanks
  14. Thanks for the responses Takashi, I tried your code in a test case and it worked fine, thanks. Now I have to make the changes in my application. Roger, now that I understand the changes required a bit better, it won't be as bad as I first thought although not trivial because of the design of my application. One more question. The field in the nci_mill_20004 structure formerly known as slot now seems to be named tlno. Is this the same field and are there any more similar changes? Thanks again.
  15. Sorry, I meant CHook. I'm sure I have the latest X3 SDK, I just downloaded it this morning. I looked briefly at the doc you mentioned and it looks like it will require a considerable amount of work for me to do the conversion, as I maintain pointers to items in the list. If there is any way to use the old method in the mean time it would be very helpful. Edit: Also do you have any code examples using the new methods?
  16. I am trying to upgrade my X2 nethook to X3 and I am getting some syntax errors. The first is that group_list_pointer is no longer defined. It was previously defined in the include file groups_ch.h. Is there now a different way of traversing through the goups? Also, is there any documentation on how to upgrade to X3 Thanks.
  17. I am back working on this problem. I am now using the MasterCAM X2 SDK and VS 2005. MasterCAM no longer crashes when the store_note function is called but the note does not get stored. This code works fine in MasterCAM X using VS 2003. Any suggestions greatly appreciated.
  18. Thanks MasterShake. This project is on the back burner at the moment, but I'll let you know what happens when I get back to it
  19. Are there any functions in the SDK to allow the user to pick a solid model and to tessellate it? Can you point me to nay sample code? Thanks in advance.
  20. Thanks again for the responses. One more question: can I use VS2005 for X?
  21. Thanks for the response, Roger. By "compiled in X" I meant linked using the libraries from the X SDK. Do I need to download and use the X2 SDK? If it it linked with the X2 libraries will it run under X? Also, I am using VS2003. Do I need to use VS2005? Thanks again for the help
  22. This is how I did it in C code: ent entity; MC_BOOL chkvis; MC_BOOL succf; char *cptr, *cptr2; DB_LIST_ENT_PTR ptr, found_ptr; ushort sel_mask; ulong ent_mask; chkvis = false; sel_mask = 0; ent_mask = N_ID; ptr = db_start; while (1) { get_raw_ent (chkvis, &ptr, &found_ptr, &entity, sel_mask, ent_mask, &succf); if (!succf) break; cptr = (char *) mTableFindData (entity.u.n.mtid); if (strncmp(cptr, "xxx", 3) == 0) { ... break; } }
  23. The following code to store a note works fine in X SP2 but X2 crashes shortly after the routine is exited code: { ent entity; int len; int lev; char txt[256]; char *cptr; ulong mtid; DB_LIST_ENT_PTR ptr; attributes new_attrib; MC_BOOL succf; lev = 3987; strcpy(txt, "Test Note"); len = strlen(txt) + 1; InitNOTE(&entity); cptr = (char *) mTableAlloc(len, &mtid); /* allocate table item */ entity.u.n.mtid = mtid; /* assign memory table */ strcpy(cptr, txt); /* copy string */ /* Create new note */ new_attrib.width = 0; new_attrib.style = 0; new_attrib.pen = 0; new_attrib.pstyle = 0; new_attrib.filler = 0; store_ent (&entity, &ptr, 0, 0, lev, new_attrib, &succf); } A message window pops up with the error "Mastercam X2 has encountered a problem and needs to close" The Net Hook is written in C# and it calls this routine in a dll written in C. It was compiled in X and is being run under X2. Any help greatly appreciated.
  24. 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.
  25. 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

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