CaKiwi
Verified Members-
Posts
63 -
Joined
-
Last visited
Recent Profile Visitors
CaKiwi's Achievements
Newbie (1/14)
0
Reputation
-
Cycling throught groups in X4
CaKiwi replied to CaKiwi's topic in Mastercam C-Hook, NET-Hook and VBScript Development
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. -
Cycling throught groups in X4
CaKiwi replied to CaKiwi's topic in Mastercam C-Hook, NET-Hook and VBScript Development
@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. -
Cycling throught groups in X4
CaKiwi replied to CaKiwi's topic in Mastercam C-Hook, NET-Hook and VBScript Development
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. -
Cycling throught groups in X4
CaKiwi replied to CaKiwi's topic in Mastercam C-Hook, NET-Hook and VBScript Development
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. -
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
-
Tool Numbers in X3
CaKiwi replied to CaKiwi's topic in Mastercam C-Hook, NET-Hook and VBScript Development
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 -
Tool Numbers in X3
CaKiwi replied to CaKiwi's topic in Mastercam C-Hook, NET-Hook and VBScript Development
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. -
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 ]
-
Picking a WCS
CaKiwi replied to CaKiwi's topic in Mastercam C-Hook, NET-Hook and VBScript Development
Thanks for the help, Roger. It is working well for me -
Picking a WCS
CaKiwi replied to CaKiwi's topic in Mastercam C-Hook, NET-Hook and VBScript Development
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 -
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
-
Upgrading to X3
CaKiwi replied to CaKiwi's topic in Mastercam C-Hook, NET-Hook and VBScript Development
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. -
Upgrading to X3
CaKiwi replied to CaKiwi's topic in Mastercam C-Hook, NET-Hook and VBScript Development
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?
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.