Verified Members
  • Content count

  • Joined

  • Last visited

Community Reputation

147 Excellent


About Zaffin_D

  • Rank

Recent Profile Visitors

1,101 profile views
  1. I'm unfamiliar with how you are determining the arc's direction. Below is something that works in my testing as long as the sweep's not 180 degrees (it will fail if the sweep is 180). I'm not sure how helpful it will be. extern "C" __declspec(dllexport) int ArcDirectionEntry (int param) { // Must call this prior to accessing any Resources in the C-Hook DLL ! ChangeResCl res (GetChookResourceHandle ()); LPCTSTR prompt(_T("Select a Chain")); CHAIN* selectedChain = nullptr; auto result = chain_1(prompt, &selectedChain); if (result == CHAIN_OK && &selectedChain != nullptr) { auto selectedChainPointer = selectedChain->start; p_3d arcStartVector; p_3d arcEndVector; p_3d crossProduct; double arcSweep; while (selectedChainPointer != nullptr) { auto entityPointer = selectedChainPointer->e_ptr->eptr; if (entityPointer->id == A_ID) { if (selectedChainPointer->ep_n) { arcStartVector = entityPointer-> - entityPointer->; arcEndVector = entityPointer-> - entityPointer->; } else { arcStartVector = entityPointer-> - entityPointer->; arcEndVector = entityPointer-> - entityPointer->; } crossProduct = Cross(arcStartVector, arcEndVector).NormalizeThis(); arcSweep = entityPointer-> * (180.0 / PI); arcSweep = (int)(arcSweep * 1000.0) / 1000.0; if (crossProduct[2] < 0.0) { if (arcSweep <= 180.0) { ::MessageBox(get_MainFrame()->GetSafeHwnd(), _T("CW ARC FOUND!"), _T("ArcDirection"), MB_OK); } else { ::MessageBox(get_MainFrame()->GetSafeHwnd(), _T("CCW ARC FOUND!"), _T("ArcDirection"), MB_OK); } } else if (crossProduct[2] > 0.0) { if (arcSweep >= 180.0) { ::MessageBox(get_MainFrame()->GetSafeHwnd(), _T("CW ARC FOUND!"), _T("ArcDirection"), MB_OK); } else { ::MessageBox(get_MainFrame()->GetSafeHwnd(), _T("CCW ARC FOUND!"), _T("ArcDirection"), MB_OK); } } else { ::MessageBox(get_MainFrame()->GetSafeHwnd(), _T("crossProduct = 0; arc direction could not be obtained."), _T("ArcDirection"), MB_OK); } } selectedChainPointer = selectedChainPointer->next; } free_chain(&selectedChain); } return MC_NOERROR | MC_UNLOADAPP; }
  2. double StringManipulation::StringToDouble(StringType input) { CString c_str = input.c_str(); // Convert a TCHAR string to a LPCSTR CT2CA pszConvertedAnsiString(c_str); // construct a std::string using the LPCSTR input std::string strStd(pszConvertedAnsiString); return atof(strStd.c_str()); /*c_str is needed to convert string to const char*/ } int StringManipulation::StringToInt(StringType input) { CString c_str = input.c_str(); // Convert a TCHAR string to a LPCSTR CT2CA pszConvertedAnsiString(c_str); // construct a std::string using the LPCSTR input std::string strStd(pszConvertedAnsiString); return atoi(strStd.c_str()); /*c_str is needed to convert string to const char*/ } These functions smell funny; atoi and atof both return 0 on failure and that's not great. Consider using std::stoi or std::stod. They accept a std::string or std::wstring so there is no need to do whatever your doing to convert the input. They also throw an exception on failure rather than an ambiguous value.
  3. Zaffin_D

    5ax DWO on Heidenhain TNC530i

    Not much more to it. PLANE VECTOR requires two vectors defined by the values BX, BY, BZ (the base vector) and NX, NY, NZ (the normal vector). The normal vector is the Z vector of the tool plane. I can't remember, but I think the base vector is the X vector of the tool plane, but it could be the Y vector; it's been awhile.
  4. Zaffin_D

    5ax DWO on Heidenhain TNC530i

    Can I ask why you are programming for COR? It seems that your issue would solve itself if you used the PLANE functions. WESC is not something the 530 offers out of the box. As you may or may not be aware you can not add a secondary axis (a or b) value in the preset table and have M128 or the PLANE function work. I thought Hermle had a cycle 300-something to work around this but I was a Mikron guy. Cycle 7 or TRANS DATUM if the machine is newer.
  5. Zaffin_D

    5ax DWO on Heidenhain TNC530i

    What manuals are you looking at? I've always found Heidenhain manuals to be excellent. Anyway, you can define a plane in several ways. The old way was cycle 19, but you should be using the PLANE function if it's available. The PLANE function has several options for how to define a plane... Spatial angles Projection angles Euler angles ZXZ Two vectors Three points The plane function also allows you to specify other options... SEQ + or -; this chooses the rotation solution MOVE, TURN, STAY. MOVE will move the rotary axes and the tool when the command is executed. TURN will move only the rotary axes. STAY will do the math but will not cause motion. A retract can also be specified TABLE ROT or COORD ROT; move the rotaries or move the coordinate system The above lists are not exhaustive. When I was an AE for Mikron spatial angles were the most popular. If you have a BC machine, SPA would be 0, SPB would be the B-axis angle, and SPC would be the C-axis angle. On the machine this works great, but in the post this involves some mapping/rotating because the two angles don't fully define a plane. The code would look something like this... PLANE SPATIAL SPA+0 SPB-45 SPC+0 SEQ- TURN MBMAX FMAX TABLE ROT So that says I want to define the plane by spatial angles(PLANE SPATIAL); set the B-axis at 45 degrees(SPA+0 SPB-45 SPC+0); choose the negative solution(SEQ-); move only the rotaries(TURN); before you move, retract along the tool axis to the limit switch(MBMAX); do everything at max feed rate(FMAX); rotate the table(TABLE ROT). The above is from memory, it's best to build a few cycles at the control; it walks you through every step. Heidenhain also offers a free simulator. I personally like the two vectors method because Mastercam gives you the toolplane matrix. Hope that helps.
  6. Assuming you mean the MP post docs, this is likely specific to your reseller. The post docs for 2020 are available, but their format has changed. Gone is the bulky .PDF; for 2020 and beyond the post docs are in (a much improved) .HTML format.
  7. This appears to do a bit more than rename e$. It appers to allow the user to add a end of line string to every output line in one place. For example if you wanted to add '*' to the end of every string you could do the following. pe '*', e$ Even if the post isn't encrypted this seems to have value, no? I'm not a post expert so I'll differ to you; objectively whats wrong with the above? How would you handle this? What standards would you like to see set in regards to MP posts? Software development is an art as much as it is a science; a standard in something so abstract seems like telling a painter they can only paint black circles on a white background. How can innovation happen if everyone is required to do the same thing?
  8. The number of entities in an operation is stored in parameter 15083. Are you talking about the angle between holes in 3D space or the XY plane? For 3D space you'll need to determine the vector of a hole, then use the below formula to determine the angle. If you want the angle between holes in the XY plane atan2 should work.
  9. Zaffin_D

    Python Scripts For Mastercam Nethook Mc2020

    I think this is a great idea. However I couldn't get it to work in 2020. Are you interested in any constructive feedback regarding the execution?
  10. I think I see what's going on here; by non-reserved plane you mean a view that doesn't appear in the view manager? For example the view of a rotated arc? You should be able to get the arc's view matrix by using the get_view_matrix function.
  11. Zaffin_D

    Siemens 3x mill post

    You should head over to Mastercam's tech exchange and download the Siemens 3x_4x mill post; the post you have is the older unsupported version.
  12. Zaffin_D

    Siemens 3x mill post

    Are you using the Siemens 3x post (older, no longer supported by CNC) or the Siemens 3x_4x post (currently supported)? Also not every Siemens control is supported, what control are you using?
  13. Zaffin_D

    Long Post Times

    Is a rapid move being wrapped? If so it's a post issue. @Chally72 can get it to the right team I'm sure.
  14. What version of Mastercam are you using? In Mastercam 2020 the GetPlanePtrByID() function works as expected in my testing. Can you share a file? C++, Why are you using a char array? And why so big? 5000 bytes of continuous memory seems excessive.
  15. Typically I create a global alias for the variable and format it, but you can also use the new address function nwadrs( ); just remember to set the format back after output.

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