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:

MRB

Verified Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Everything posted by MRB

  1. Thanks, John. That works. (btw, I have been opening Mastercam with the proper icon, and doing a File->Merge as a work around the problem) This might also be the answer to other issues I have been having regarding 5-axis toolpaths - I was not able to regenerate the Curve 5-axis toolpath after selecting other Tool Axis Control lines. Thanks, MRB
  2. I'm getting a warning "Five-axis option not available. Contact your Mastercam dealer" when I try to select any of the 5-axis Mill Toolpaths. First I made a couple 5-axis Curve toolpaths sucessfully. I then saved and closed out of Mastercam session. When I opened the same file again, and clicked on Toolpaths->Multiaxis->Curve to start a 3rd toolpath in the same 'Toolpath Group' I got the above warning and was not able to proceed. Any ideas on what causes this error and how to get around it? Thanks in advance for your help. MRB
  3. We've been developing chooks, and there were compatibility issues with some of them. I regenerated all the chooks again, and now everything works fine. Thanks.
  4. When I try to open Mastercam X by double-clicking on the icon it crashes with no errors. It seemed to work fine for me until last week. I've not changed any settings or anything else since last use. Any ideas ?? Thanks in advance. MRB
  5. I'm trying to write a chook that would select a line and modify its endpoint dynamically, or by sketching/selecting a point in graphics space. This functionality would be similar to Mastercam's 'Edit->Modify NURBS' functionality. I'm searching for chook functions that would help me do this. Currently, I'm using point_proc(), and it doesn't sketch a point in desired 3d space. The point_proc() method gives a point that is lying in a plane normal to the selected original line. ------------------------------------------- //Select the line select_ent("Select a line to modify", &oEntity, &oDBEntity, oPtSelect, dTParam, ALIVE_BIT, ALL_ENTITIES_MASK, select_color, &bSuccess); // Get the curve endpoints p_3d aStartPoint, aEndPoint; curve_endpoints(&oEntity, aStartPoint, aEndPoint); // Ask for new point while(true) { ent oLineVector; DB_LIST_ENT_PTR d_ptr; char Option; p_3d oNewSelectedPoint; Point_proc ("Select new position, Escape to finish", &Option, oNewSelectedPoint, &bSuccess); if(!bSuccess) break; oLineVector.id = L_ID; vec_3d(aStartPoint[X], aStartPoint[Y], aStartPoint[Z], oLineVector.u.li.e1); vec_3d(oNewSelectedPoint[X], oNewSelectedPoint[Y], oNewSelectedPoint[Z], oLineVector.u.li.e2); store_ent(&oLineVector, &d_ptr, 0, main_color, main_level, main_attrib, &bSuccess); repaint_graphics(); } ----------------------------------------- Thanks in advance for any help.
  6. I'm moving this question the Developer's forum
  7. Thanks for replying, Pete. It's good to know that there's a now a Developer's forum. I should have pasted my entire code before. I did make a line using oNewSelectedPoint, but the point is not in the desired 3d space. Let's say I was to tweak the endpoint such that the new line is only 5 degrees from the original line. The point_proc() method is giving me a point which is lying in a plane normal to the selected original line. ------------------------------------------- //Select the line select_ent("Select a line to modify", &oEntity, &oDBEntity, oPtSelect, dTParam, ALIVE_BIT, ALL_ENTITIES_MASK, select_color, &bSuccess); // Get the curve endpoints p_3d aStartPoint, aEndPoint; curve_endpoints(&oEntity, aStartPoint, aEndPoint); // Ask for new point while(true) { ent oLineVector; DB_LIST_ENT_PTR d_ptr; char Option; p_3d oNewSelectedPoint; oint_proc ("Select new position, Escape to finish", &Option, oNewSelectedPoint, &bSuccess); if(!bSuccess) break; oLineVector.id = L_ID; vec_3d(aStartPoint[X], aStartPoint[Y], aStartPoint[Z], oLineVector.u.li.e1); vec_3d(oNewSelectedPoint[X], oNewSelectedPoint[Y], oNewSelectedPoint[Z], oLineVector.u.li.e2); store_ent(&oLineVector, &d_ptr, 0, main_color, main_level, main_attrib, &bSuccess); repaint_graphics(); } --------------------------------------- Should I be converting the new point to View or World coordinates, or is there a different method that needs to be used. Is there a way to do this dynamically? Thanks again Pete.
  8. I want to write a chook that would select a line and modify its endpoint in real time, or by sketching/selecting a point in graphics space. This functionality would be similar to Mastercam's 'Edit->Modify NURBS' functionality. I'm searching for chook functions that would help me do this. Currently, I'm using point_proc(), and it doesn't sketch a point in desired 3d space. Please let me know how I can do this. Thanks very much. ------------------------------------------- Code so far select_ent("Select a line", &oEntity, .....); p_3d aStartPoint, aEndPoint; curve_endpoints(&oEntity, aStartPoint, aEndPoint); while(true) { p_3d oNewSelectedPoint; point_proc ("Pick new position, Escape to finish", &Option, oNewSelectedPoint, &bSuccess); //Make and store new line using above point } ---------------------------------
  9. Thanks Mick. I'm finding now that the line does get deleted, but the image still remains on the graphics screen. Repaint and Clear screen functions doesn't quite clean up that line. Also, at this point the "Screen statistics" gives incorrect info. But when I change to a different level and switch back to the original one, the line gets erased and screen statistics icon works fine. ------------------------------------- Sub Main() Dim objLineVector Dim intLineVectorPtr Set objLineVector = New McLn With objLineVector .X1 = 0 .Y1 = 0 .Z1 = 0 .X2 = 0 .Y2 = 0 .Z2 = 1 End With intLineVectorPtr = CreateLine(objLineVector, mcCONSTRUCTION_COLOR_CURRENT, mcCONSTRUCTION_LEVEL_CURRENT) SetCPlaneNumber(0) ' Set CPlane = 3D to work in coordinate system's 3D space ' -- Clean up DeleteEntity(intLineVectorPtr) End Sub _________________________________________
  10. Yes, a line does get created and has a valid pointer. But it doesn't get deleted. I'll try updating to 10.0.14.31. The script works fine in V9. Thanks!
  11. Hi, I'm currently working on SP1 10.0.14.19 version. Is the vbscript DeleteEntity() function working properly? When I create a Line and delete it, the line doesn't get deleted. Also, Mastercam "screen statistics" function gives incorrect number of entities after running the following code: intNewLineVectorPtr = CreateLine(objNewLineVector, mcCONSTRUCTION_COLOR_CURRENT, mcCONSTRUCTION_LEVEL_CURRENT) DeleteEntity(intNewLineVectorPtr) Please let me know. Thanks!
  12. When using 5-axis multisurface toolpath in version X the "Simulate Rotary Axis" function doesn't rotate the part about the C (or any) axis, instead the tool moves around the part. Looks like a bug that needs fixing. Thanks Greg and Dacey.
  13. Hello All, It seems to me the "Simulate rotary axis" function is not working while backplotting. This used to work in V9. I'm not sure if I'm missing something. Thanks!
  14. I appreciate your prompt reply. Thanks a lot!! So in general, are all VBS commands supported in X (and may be in the future)? Would you recommend Nethook or VBS to make simpler programs?
  15. Most of my vbscripts written for V9 do not work in X. I'm having problems with AskForEntiy() in particular. Are all the VBscript commands (from V9) offered in X, or some of them are not supported anymore? Many previously supported commands are missing in the latest VBScript.htm help file. Also, I would like to get started with c-hook and .NET programming. Are these SDK included with the installation CD /or where should I get this information. Thanks in advance.
  16. I was finally able to make a release DLL version without any errors or warnings. I had ignored a few libraries (MSVCRT, mfcs42d.lib) in the project settings while debugging the code. I got rid of that, and everything is working fine now. Thanks for your help. MRB.
  17. I commented out the following code ----------------------------------- code: /* static AFX_EXTENSION_MODULE ShapesDLL = { NULL, NULL }; extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { // Remove this if you use lpReserved UNREFERENCED_PARAMETER(lpReserved); if (dwReason == DLL_PROCESS_ATTACH) { TRACE0("SHAPES.DLL Initializing!n"); // Extension DLL one-time initialization if (!AfxInitExtensionModule(ShapesDLL, hInstance)) return 0; // Insert this DLL into the resource chain // NOTE: If this Extension DLL is being implicitly linked to by // an MFC Regular DLL (such as an ActiveX Control) // instead of an MFC application, then you will want to // remove this line from DllMain and put it in a separate // function exported from this Extension DLL. The Regular DLL // that uses this Extension DLL should then explicitly call that // function to initialize this Extension DLL. Otherwise, // the CDynLinkLibrary object will not be attached to the // Regular DLL's resource chain, and serious problems will // result. new CDynLinkLibrary(ShapesDLL); } else if (dwReason == DLL_PROCESS_DETACH) { TRACE0("SHAPES.DLL Terminating!n"); // Terminate the library before destructors are called AfxTermExtensionModule(ShapesDLL); } return 1; // ok } */ ----------------------------------- And added this code mentioned in the Shapes.cpp example: code: // Note! // // If this DLL is dynamically linked against the MFC // DLLs, any functions exported from this DLL which // call into MFC must have the AFX_MANAGE_STATE macro // added at the very beginning of the function. // // For example: // // extern "C" BOOL PASCAL EXPORT ExportedFunction() // { // AFX_MANAGE_STATE(AfxGetStaticModuleState()); // // normal function body here // } // // It is very important that this macro appear in each // function, prior to any calls into MFC. This means that // it must appear as the first statement within the // function, even before any object variable declarations // as their constructors may generate calls into the MFC // DLL. // // Please see MFC Technical Notes 33 and 58 for additional // details. // ///////////////////////////////////////////////////////////////////////////// // CShapesApp BEGIN_MESSAGE_MAP(CShapesApp, CWinApp) //{{AFX_MSG_MAP(CShapesApp) // NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code! //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CShapesApp construction CShapesApp::CShapesApp() { // TODO: add construction code here, // Place all significant initialization in InitInstance } ///////////////////////////////////////////////////////////////////////////// // The one and only CShapesApp object CShapesApp theApp;
  18. I commented out the following code ----------------------------------- code: /* static AFX_EXTENSION_MODULE ShapesDLL = { NULL, NULL }; extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { // Remove this if you use lpReserved UNREFERENCED_PARAMETER(lpReserved); if (dwReason == DLL_PROCESS_ATTACH) { TRACE0("SHAPES.DLL Initializing!n"); // Extension DLL one-time initialization if (!AfxInitExtensionModule(ShapesDLL, hInstance)) return 0; // Insert this DLL into the resource chain // NOTE: If this Extension DLL is being implicitly linked to by // an MFC Regular DLL (such as an ActiveX Control) // instead of an MFC application, then you will want to // remove this line from DllMain and put it in a separate // function exported from this Extension DLL. The Regular DLL // that uses this Extension DLL should then explicitly call that // function to initialize this Extension DLL. Otherwise, // the CDynLinkLibrary object will not be attached to the // Regular DLL's resource chain, and serious problems will // result. new CDynLinkLibrary(ShapesDLL); } else if (dwReason == DLL_PROCESS_DETACH) { TRACE0("SHAPES.DLL Terminating!n"); // Terminate the library before destructors are called AfxTermExtensionModule(ShapesDLL); } return 1; // ok } */ ----------------------------------- And added this code mentioned in the Shapes.cpp example: code: // Note! // // If this DLL is dynamically linked against the MFC // DLLs, any functions exported from this DLL which // call into MFC must have the AFX_MANAGE_STATE macro // added at the very beginning of the function. // // For example: // // extern "C" BOOL PASCAL EXPORT ExportedFunction() // { // AFX_MANAGE_STATE(AfxGetStaticModuleState()); // // normal function body here // } // // It is very important that this macro appear in each // function, prior to any calls into MFC. This means that // it must appear as the first statement within the // function, even before any object variable declarations // as their constructors may generate calls into the MFC // DLL. // // Please see MFC Technical Notes 33 and 58 for additional // details. // ///////////////////////////////////////////////////////////////////////////// // CShapesApp BEGIN_MESSAGE_MAP(CShapesApp, CWinApp) //{{AFX_MSG_MAP(CShapesApp) // NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code! //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CShapesApp construction CShapesApp::CShapesApp() { // TODO: add construction code here, // Place all significant initialization in InitInstance } ///////////////////////////////////////////////////////////////////////////// // The one and only CShapesApp object CShapesApp theApp;
  19. Using MSVC++ 6.0 Created a single project with the MFC AppWizard DLL (as an extension DLL though ). I have commented out the code that comes with the "extension DLL". My project settings look similar, except that I had _AFXEXT added to preprocessor defs. I got rid of that and tried to rebuild release DLL and got similar results (29 errors). [if I choose to ignore the "Debug Assertion failed" error in MasterCAM, the Shapes dialog box does pop up and I can create shapes]
  20. I'm not sure how to use the code tag, but hope this works. I think I copied the content of the Shapes.cpp file 'as is' from the given example code. So, I'll insert only the start and the end of the code here. ---------------------------------------------- code: // Shapes.cpp : Defines the initialization // #include "stdafx.h" #include <math.h> #undef EXPORT extern "C" { #include "m_vars.h" #include "m_math.h" #include "m_menu.h" #include "m_graph.h" #include "m_io.h" #include "m_db.h" #include "m_chain.h" #include "m_undo.h" #include "m_ncvars.h" #include "m_nc.h" #include "m_init.h" void __declspec(dllexport) m_main(long *ptrs); } #include "shapes.h" #include "shapedlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif BEGIN_MESSAGE_MAP(CShapesApp, CWinApp) //{{AFX_MSG_MAP(CShapesApp) // NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code! //}}AFX_MSG_MAP END_MESSAGE_MAP() /////////////////////////////////////////////// // CShapesApp construction CShapesApp::CShapesApp() { // TODO: add construction code here, // Place all significant initialization in InitInstance } /////////////////////////////////////////// // The one and only CShapesApp object CShapesApp theApp; // compute unit length axis vectors from an angle static void compute_axis_vectors ( real angle, // I: angle defining the x axis p_2d v_x, // O: x unit vector p_2d v_y) // O: y unit vector { vec (cos (angle), sin(angle), v_x); vec (-v_x[Y], v_x[X], v_y); } and so on... // Purpose: main function static void chook_main (void) { boolean show_dialog; short f_key; Cshapedlg dlg; // Enable use of the MFC dynamically linked libraries AFX_MANAGE_STATE( AfxGetStaticModuleState() ); show_dialog = TRUE; undo_hold(); while (TRUE) { if (show_dialog) { if (dlg.DoModal() == IDOK) // run the dialog create_shape (dlg.m_create_n, dlg.m_shape_n, dlg.m_width, dlg.m_height, dlg.m_angle * D2R, dlg.m_create_point); else // Cancel break; } cleartextall(); menu (TEXT_HDR, MENU_1); // Display the Option / Create menu f_command (&f_key, 1); // Get user's selection if (f_key != 1) break; } } // Purpose: Entry point for C-Hooks programs extern "C" void CH_ENTRY m_main (long *ptrs) { if (open_app (ptrs)) chook_main(); close_app (ptrs); } -------------------------------------- While I was pasting this code for you, I was also trying to rebuild Shapes.dll, and it worked. I don't know how that happened. Anyway, I now get an error -- "Debug Assertion failed" File: afxwin1.inl, line 22 when I try to run the debug version of Shapes.dll in MasterCAM. And ofcourse, I get many linker errors when trying to build a release version. PLease let me know if any of this makes sense to you. Thank you, I appreciate your help.
  21. Hi All, I'm just starting on c-hooks for MasterCAM. I tried to copy & implement the SHAPES example and have followed all the steps, including VC++ project settings, and have referred to previous threads on this topic. I'm still not able to figure out how to get rid of the following errors: --------------------Configuration: Shapes - Win32 Debug-------------------- Linking... mfcs42d.lib(dllmodul.obj) : error LNK2005: __pRawDllMain already defined in Shapes.obj mfcs42d.lib(dllmodul.obj) : warning LNK4006: __pRawDllMain already defined in Shapes.obj; second definition ignored Creating library Debug/Shapes.lib and object Debug/Shapes.exp Debug/Shapes.dll : fatal error LNK1169: one or more multiply defined symbols found Error executing link.exe. Shapes.dll - 2 error(s), 1 warning(s) --------------------------------- Can anyone help solve this problem? Thanks very much!

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