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:

Leaderboard

Popular Content

Showing content with the highest reputation on 06/21/2020 in all areas

  1. Thank you both very much!! I just had many hours of hitting my head against wall, but at least figured out how to modify the tools. I will try out the code above tomorrow and have no doubt that it works. It took a while to figure out changes must be done on cloned object and they need to be reset for changes to take effect. And in case it helps some other C-hook newbie extern "C" __declspec(dllexport) void UpdateToolCoolantFromOperation(long opID) { using namespace Cnc::Tool; const operation* op = TpMainOpMgr.GetMainOpList().OpByID(opID); if (op == nullptr) return; std::vector<TlAssemblyCPtr> assemblies = GetAssemblies(); TlAssemblyCPtr opAssembly = FindAssemblyForOperation(assemblies, op); if (opAssembly == nullptr) return; // Perform changes on cloned object TlAssemblyPtr newAssembly = opAssembly->Clone(); TlToolMillPtr millTool = newAssembly->GetMillTool(); if (millTool == nullptr) return; TlHolderPtr holder = newAssembly->GetMainHolder(); if(holder != nullptr) holder->SetName(_T("Test holder")); //DebugBox(CString("Old name: ") + millTool->GetName()); millTool->SetName(_T("Test mill tool")); millTool->SetToolNumber(123); newAssembly->SetName(_T("Test assembly")); // OK! //newAssembly->SetToolNumber(123); Will be overwritten by SetMainTool() TlCoolant tlCool; // 0 = ON, 1 = WITH tlCool.SetFloodState(0); tlCool.SetFloodTime(1); tlCool.SetMistState(0); tlCool.SetMistTime(1); tlCool.SetToolState(0); tlCool.SetToolTime(1); millTool->SetCannedTxtCoolant(tlCool); // TlCoolant is auto-converted to array // Must reset for changes to take effect newAssembly->SetMainTool(millTool); if(holder != nullptr) newAssembly->SetMainHolder(holder); // Update database if (GetToolSystem()->Update(newAssembly)) { DebugBox(_T("OK")); } }
    2 points
  2. SlaveCam got it. You need to reset the main tool to the cloned assembly for the changes to stick. void OperationService::SetToolCoolant(int opID) { auto op = TpMainOpMgr.GetMainOpList().OpByID(opID); if (op != nullptr) { auto toolSystem = Cnc::Tool::GetToolSystem(); auto toolAssembly = Cnc::Tool::TlAssemblyCPtr(); if (toolSystem->Find(op->tl.slot, toolAssembly)) { auto toolAssemblyClone = toolAssembly->Clone(); if (toolAssemblyClone->HasMainTool()) { auto millTool = toolAssemblyClone->GetMillTool(); Cnc::Tool::TlCoolant tlCool; tlCool.SetFloodState(0); tlCool.SetFloodTime(1); tlCool.SetMistState(0); tlCool.SetMistTime(1); tlCool.SetToolState(0); tlCool.SetToolTime(1); millTool->SetCannedTxtCoolant(tlCool); toolAssemblyClone->SetMainTool(millTool); toolSystem->Update(toolAssemblyClone); } } } } The TlCoolant class is much more friendly than a vector. Sadly I knew about it less than a year ago; my memory isn't what it used to be. Makes me think that there has to be a friendlier way to update the operation coolant.
    1 point
  3. Have you tested this? I had the below function for setting a tool's coolant, but no matter what I do the coolant won't stick. void OperationService::SetToolCoolant(int opID) { auto op = TpMainOpMgr.GetMainOpList().OpByID(opID); if (op != nullptr) { auto toolSystem = Cnc::Tool::GetToolSystem(); auto toolAssembly = Cnc::Tool::TlAssemblyCPtr(); if (toolSystem->Find(op->tl.slot, toolAssembly)) { if (toolAssembly->HasMainTool()) { auto millTool = toolAssembly->GetMillTool(); std::vector<short> cannedTextCoolant(20); cannedTextCoolant[0] = -3101; cannedTextCoolant[1] = -4103; cannedTextCoolant[2] = -5105; millTool->SetCannedTxtCoolant(cannedTextCoolant); toolSystem->Update(toolAssembly->Clone()); } } } } I'm also totally wrong about the right most digits. They do have something to do with on and off; new theory below. 01 and 02 sets ON and OFF for Coolant 1 03 and 04 sets ON and OFF for Coolant 2 ...skip a few... 19 and 20 sets ON and OFF for Coolant 10 So to set Coolant 5 to ON and Before, use -3109.
    1 point
  4. Yeah, every major manufacturer I spoke with suggested a "special", but I would rather go off the shelf. Unfortunately I can't switch to a different insert as this is a "locked process". Thanks guys
    1 point
  5. I've read this whole thread at least 4 or 5 times and I believe I'm getting dumberer every time.
    0 points

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