Roger Martin from CNC Software

CNC Software
  • Content count

  • Joined

  • Last visited

Community Reputation

87 Excellent


About Roger Martin from CNC Software

  • Rank
    Advanced Member

Recent Profile Visitors

3,024 profile views
  1. Roger Martin from CNC Software

    Multi language Application

    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!
  2. Roger Martin from CNC Software

    Accessing non reserved planes with C++ SDK

    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; }
  3. Roger Martin from CNC Software

    c# dynamic keyword equvalent in c++/cli

    Maybe? What is C# dynamic keyword equivalent in C++ CLI?
  4. Roger Martin from CNC Software

    Accessing non reserved planes with C++ SDK

    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”
  5. Roger Martin from CNC Software

    Nethook Nesting : C++/CLI

    No - Memory for a managed type (reference or value type) that is allocated by gcnew, and is deallocated by using (automatic) garbage collection.
  6. Roger Martin from CNC Software

    Nethook Nesting : C++/CLI

    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;
  7. Roger Martin from CNC Software

    Custom Setup Sheet Data from NC FILE C# :

    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; }
  8. Roger Martin from CNC Software

    Chook Question : Simplify Spline

    Converting a single Spline to a single arc? -or- Simplifying a Spline to possibly multiple arcs and/or lines?
  9. NO. The .FT (Function Table) files must be located in Mastercam's \chooks folder. Your add-in DLLs can be located wherever you wish, as the the data in the .FT file tells Mastercam where to find it.
  10. Roger Martin from CNC Software

    Custom Setup Sheet Data from NC FILE C# :

    Peter, STL Container -> Use them. Zaffin's statement here are words of wisdom.
  11. Roger Martin from CNC Software

    NET-Hooks: C# and VB.NET project examples

    Peter, If you have project suggestions, send them to us. - SDK[at]mastercam[dot]com
  12. Roger Martin from CNC Software

    Geometry group managment with Net-HOOK?

    Not to discourage you, as Peter will tell you, a C++\CLI Add-In is a very flexible and powerful way to go. But, I would not consider this a C++ beginner project. If you email me SDK[at]mastercam[dot]com] Company contact info and details of what you're trying to have your add-in do, I can take a look .
  13. Roger Martin from CNC Software

    Geometry group managment with Net-HOOK?

    Right now, you cannot using the NET-Hook API. There is this item in our backlog about this functionality - [S-41011] : NET-Hook API - Add support for creating/manipulating Geometry Groups Are you familiar with C++ programming? Could create a C++/CLI "worker" DLL that your NET-Hook project references and calls to do this work. What version of Mastercam are you running?
  14. Pete, I have no idea what you have going on here. The constructor error make no sense. To be sure that the code in the previous post was not mangled, I copied that code directly from that post to a C++/CLI project (that references the NETHook API). And... It builds, runs and produces the expected result. Tested in Mastercam 2018 and 2020. Expanding it out to include processing of Surfaces/Solids may be a bit more involved. To see exactly what the "type" you're dealing with, add some diagnotics. auto gt = selectedEnts->GetType (); System::Diagnostics::Debug::WriteLine ("gt=> " + gt->ToString ()); if (gt == pointType) {...}
  15. Try this. /// <summary> Get the selected wireframe geometry by type. </summary> /// /// <param name="points"> [out] The points. </param> /// <param name="lines"> [out] The lines. </param> /// <param name="arcs"> [out] The arcs. </param> void SelectedWireframeGeometryByType ( System::Collections::Generic::List<Mastercam::BasicGeometry::PointGeometry ^> ^points, System::Collections::Generic::List<Mastercam::Curves::LineGeometry ^> ^lines, System::Collections::Generic::List<Mastercam::Curves::ArcGeometry ^> ^arcs) { auto pointType = Mastercam::BasicGeometry::PointGeometry::typeid; auto lineType = Mastercam::Curves::LineGeometry::typeid; auto arcType = Mastercam::Curves::ArcGeometry::typeid; auto selectedEnts = Mastercam::Support::SearchManager::GetSelectedGeometry (); // Iterate through each wireframe entity for (auto i = 0; i < selectedEnts->Length; i++) { auto gt = selectedEnts[i]->GetType (); if (gt == pointType) { // dynamic_cast here is like the "as" keyword in C# points->Add (dynamic_cast<Mastercam::BasicGeometry::PointGeometry ^> (selectedEnts[i])); } else if (gt == lineType) { lines->Add (dynamic_cast<Mastercam::Curves::LineGeometry ^> (selectedEnts[i])); } else if (gt == arcType) { arcs->Add (dynamic_cast<Mastercam::Curves::ArcGeometry ^> (selectedEnts[i])); } } } void TestGetByType () { auto points = gcnew System::Collections::Generic::List<Mastercam::BasicGeometry::PointGeometry ^> (); auto lines = gcnew System::Collections::Generic::List<Mastercam::Curves::LineGeometry ^> (); auto arcs = gcnew System::Collections::Generic::List<Mastercam::Curves::ArcGeometry ^> (); SelectedWireframeGeometryByType (points, lines, arcs); auto msg = System::String::Format ("{0} - Points\n{1} - Lines\n{2} - Arcs", points->Count, lines->Count, arcs->Count); System::Diagnostics::Debug::WriteLine (msg); // Using the 'native' MessageBox here just so that we don't need to reference System::WindowsForms. MessageBox (nullptr, CString (msg), _T ("Wireframe Geometry"), MB_ICONINFORMATION); }

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