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:

Roger Martin from CNC Software

CNC Software
  • Posts

    2,870
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Roger Martin from CNC Software

  1. Norbert, Try this function - DLLImport bool screen_to_bitmap_file (TCHAR *pFileName, bool thumbnail = true); It is the native (C++) method that the NET-Hook API is using via - bool FileManager.SaveToBitmap (string FilePath, bool Thumbnail)
  2. That I cannot say. What it will be is the (virtually) same time as you would get from Setup Sheet for those operations.
  3. The CycleTime add-in can be used with or without a post processor. When using it with a post, you are calling it from the PST and you get the back the time that you can then output in comments in the NC file. You can also get times running this add-in from Mastercam’s user interface. You add the CycleTime Add-In command to the UI and when run it will get the time for all ‘selected’ (and clean!) operations. The times that it gets are the same has what you would see if you did a Setup Sheet. See the CycleTime.pdf for more details.
  4. By this I assume he is referring to the Comment "box" on the Tool page within the operation’s parameters. You can certainly do that, but to enter that text with less clicking. In the toolpath tree, either... Do a single left-click on the operation’s name and wait a second. (The "name" to the right of the folder icon in the tree.) -or- With the toolpath name selected (highlighted), press F2 An edit box will appear where you can enter the desired "comment" text.
  5. The arcs in your chain are in View #21 and #22. How did they get there? If you create new “Plane from Geometry? and select one of the arcs and display the plane’s gnomon, you will see the issue. You can "Transform-Translate to Plane" to reorient them to Top. First, create a point at the center of the left-end arc. We will use that as the Rotation Center Point. Now do the Translate to Plane… Select the arcs to be moved. For the Source Plane select the “Unnamed plane ##” at the bottom of the list. (If may already be the Source setting as it read it from the selected geometry.) For the Destination Plane select “Top”. Now in Center of Rotation select the center point you created for both the Source and Destination, Click OK (green check) to perform the Translate operation. You can verify the arcs with Analyze (F4) to confirm that they are now in View #1 (Top). Now do Rechain All in the operation to select the relocated geometry. Regenerate the path and you should get G2/G3 arc motion in the NC output .
  6. NET-Hook API Docs On the "Welcome to the Mastercam NET-Hook API" page you will see a link to the ToolNetAPI docs. Check the "Version History" page of the ToolNetApi docs. public TlToolMill GetMillingTool(Operation operation) { // Prior to Mastercam 2021 -> //var toolSystem = TlToolFunctions.GetToolSystem(); // In Mastercam 2021 the 'TlToolFunctions' has been replaced with 'TlServices' // and now you can retrieve the 'tool systems' or // create 'factories' using the methods exposed in this service. var toolSystem = TlServices.GetIToolSystem(); var toolAssembly = new TlAssembly(); toolSystem.Find(operation.OperationTool.Slot, ref toolAssembly); return toolAssembly.GetMillTool(); }
  7. A "manager" type pane requires a C-Hook solution. I have a sample project that was done for Mastercam 2019. Shoot me your email with company contact info. to -> SDK [at] mastercam [dot] com
  8. Peter(s), If you would like a copy of the C++/CLI project I gave to LMVUICHARD Send me an email -> SDK[at]mastercam[dot]com
  9. SearchManager in the NET-Hook API currently only supports Mill type operations. A simple C++/CLI project that creates an interop DLL that your NET-Hook add-in can use would be simple to create. You would add a reference to this DLL. just like you do for the NETHook3_0.DLL to get access to the functionality in the standard API. I have such a project. If you email -> SDK.mastercam.com and let us know you company contact information and what version of Mastercam this is for, I can probably set you up. It appears you are looking for these data items in each operation - Operation Name (comment) Operation ID (number) Operation Type ("type" code) Operation Tool Number (and probably also the Tool Slot Number) “Toolpath Visibility” status “IsDirty” status “Selected” status “Posting” status (Is the operation ghosted?) *Are there more?
  10. The SelectionManager.BoxSelectGeometry method does not provide access to the (2) corners of the user sketched window. There is the SelectionManager::WindowSelect method where your NET-Hook supplied the corner of the window. The first question would be, exactly what are you wanting to do using the UIEventData Class? (You almost always use this along with a modeless dialog.) I have a (C#) NET-Hook project the uses a GetEvent loop. If you email us with your company contact to [email protected] we can get you a copy of this sample project.
  11. Not sure what you are referring to here. You mean call a function in the DLL between the AfxLoadLibrary that loaded it and the and AfxFreeLibrary that unloads it? If so, I don't see how that would make any difference.
  12. I don't believe so. Mastercam is concerned the the DLL specified in the FT file Now depending on how any other DLLs the (FT listed) DLL uses and how they are loaded/referenced may have an effect. There are 2 versions of RunUserApp in the SDK . (Declared in interfaces\GUI\RunApp_CH.h)
  13. #if defined(_AFXEXT) || defined(_AFXDLL) // Use the AFX versions of LoadLibrary/FreeLibrary #else // Use the standard versions of LoadLibrary/FreeLibrary #endif Maybe this? - If a DLL is referenced (loaded) in a Function Table (FT) file, it cannot be unloaded while Mastercam is running.
  14. Though I cannot say I know exactly what you're doing here. It seems like a lot of code for just for doing: LoadLibrary / GetProcAddress BTW - If you're running this in a Mastercam add-in, your add-in is "MFC", so it's better to use -> AfxLoadLibrary & AfxFreeLibrary https://docs.microsoft.com/en-us/cpp/build/loadlibrary-and-afxloadlibrary?view=vs-2019 This - #ifdef UNICODE //Test to see if we're using wchar_ts or not. LPCWSTR lpszFuncName = NULL; #else LPSTR lpszFuncName = NULL; #endif Could be replaced with -> LPCTSTR lpszFuncName = NULL; LPCTSTR - An LPCWSTR if UNICODE is defined, an LPCSTR otherwise. https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types
  15. Marie, Yes, I did and I forwarded it to our Tool Team. It's my understanding that someone on that Team will be contacting you.
  16. Marie, Send us details of what you are wanting to do with Tools, along with your company contact information to -> [email protected]
  17. Yes, if it cannot find the Resources specified in the FT file if will complain about that in the LOG. Something like -> ERROR (L49,C:\Program Files\Mastercam 2020\Mastercam\CHOOKS\MC_MultilingualAPP.ft): Unable to open resource module CHOOKS\PROJECT_NAME.dll. Yes, here I've launched a NET-Hook Add-In (RunUserDefined is the method that was called in the DLL) -> NET-Hook function launched: C:\Program Files\Mastercam 2020\Mastercam\CHOOKS\NETHOOKSATELLITEASSEMBLYLANGUAGES.dll::RunUserDefined You'll get something very similar for a C-Hook Add-In. Have you tried running your add-in in DEBUG? If you set a breakpoint on in the entry point function of you add-in, it should get hit.
  18. LMVUICHARD, The different language-specific resources can be -> In separate satellite DLLs placed in sub-folders such as "en-US" and "fr-FR", or they can by embedded directly into the NET-Hook add-in DLL. How you retrieve those resources will depend on which method you use. Either through you dealer create a support ticket, or email us directly sdk[at]mastercam[dot]com with you company contact information so we can create the ticket, and we can help you out!
  19. This will work in Mastercam 2019 This exact code will not be valid for Mastercam 2020/2021. It will very similar in 2020/2021, but getting the list of Planes to search is done differently. /// <summary> Gets the Plane ID of the "named" Plane for a View number. </summary> /// /// <remarks> A View# may not necessarily have an associated "named" Plane! </remarks> /// /// <param name="viewNumber"> The View Number to search for. </param> /// /// <returns> The Plane ID (0 = no match found). </returns> long GetPlaneID (short viewNumber) { auto id = 0; PLANES_NAMED_PTR_ARRAY planesArray; auto count = Planes.GetPlanes (planesArray); for (auto i = 0; i < count; ++i) { auto plane = planesArray.GetAt (i); if (plane->GetShortViewNo () == viewNumber) { id = plane->GetLongID (); break; } } (id > 0) ? TRACE (_T ("View#:%i matches named Plane ID#:%i"), viewNumber, id) : TRACE (_T ("No named Plane match found for View#:%i"), viewNumber); return id; }
  20. Maybe? What is C# dynamic keyword equivalent in C++ CLI? https://stackoverflow.com/questions/15359802/what-is-c-sharp-dynamic-keyword-equivalent-in-c-cli
  21. Planes Always remember that -> View ID != Plane ID What you see in the Planes Manager are the “named” Planes. An arc does not necessarily have a “named” Plane associated with it! If you pass a valid Plane ID, you will get the Plane. It appears that that you are probably passing the “View Number” from the arc entity. const Plane *arcPlane = Planes.GetPlanePtrByID(22); //get Plane No. 22 That’s either - not going to retrieve anything, and the acrPlane will be null, (Which you should always check before attempting to dereference a pointer.) or you could possibly get Plane that is not associated with the view that arc in is. To get a “named” Plane you pass the “ID”, which for the View Number “22” you show would be “52”
  22. No - Memory for a managed type (reference or value type) that is allocated by gcnew, and is deallocated by using (automatic) garbage collection.
  23. Your array items are null - array<Mastercam::Nesting::NestingPart^>^ partArray; // Not gcnew initialized nestingfile->PartArray = partArray; array<Mastercam::Nesting::NestingSheet^>^ sheetArray; // Not gcnew initialized nestingfile->SheetArray = sheetArray;
  24. Instead of you stepping though all of the entities, let Mastercam do that work for you. get_raw_ent is just like get_ent, except you can control whether of not the entities must be visible to be "seen" by the get functionality. Both only retrieve ALIVE entities of the requested type. std::vector<DB_LIST_ENT_PTR> GetAllSolids () { std::vector<DB_LIST_ENT_PTR> dblistptrvector; auto onlyVisible = false; auto succf = false; ent entity; DB_LIST_ENT_PTR foundPtr; DB_LIST_ENT_PTR eptr = db_start; do { get_raw_ent (onlyVisible, &eptr, &foundPtr, &entity, 0, SOLID_ID, &succf); if (succf) { if (sel_bit_is_off (&entity, BLANK_BIT)) { dblistptrvector.push_back (foundPtr); } } } while (succf); if (!dblistptrvector.empty ()) { repaint_graphics (); } return dblistptrvector; }

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