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:

Edit Bnci and Post with C-Hook


htmos6
 Share

Recommended Posts

Hello,

I've come across various issues related to modifying Bnci files, and I've successfully addressed many of them. However, I'm currently facing challenges when it comes to implementing these modifications into existing operations. Despite making changes in the Bnci file, the alterations appear as "dead sections" when I regenerate the Bnci file to validate my work.

My objective is to effectively apply these changes to operations. Specifically, when I generate the NC file, any feed rate modifications, such as adding new line and changing its feedrate to "5493," do not seem to reflect in the actual NC file. Successfully accomplishing this would allow me to simulate and verify my changes at the end.

For instance, I want to insert additional points between existing ones in the toolpath or modify the feed rates of existing points. Subsequently, I aim to simulate these changes to ensure the successful insertion of points. In the simulation tool, it should be easy to observe the updated values of x, y, z, and feed rate.

Screenshot 2023-11-20 123623.png

Part of my code given below. What is your suggestion to solve that issue? 

Explanation of the code:
I copy bnci line which is a linear feed move type of operation. I change its feedrate. Then, I insert it after the existing original line. For the result, insertion is successful. However, changes cannot be seen if you generate NC file. Because of that, I cannot observe new feedrate values on the simulation too. However, changes can be seen as a "dead section" inside the Bnci file.

Is there any solution for that issue? Important issue in here is that I need to insert additional points between existing points. 

Example : 

Old Toolpath: A -- B -- C

New Toolpath: A -- A.i -- A.ii -- B -- B.i -- B.ii -- C

A.i, A.ii, B.i, B.ii are new points added between existing ones. 

for (auto const& opId : opIds)
{
CBnciReadWrite bnciWriter;
int numOfAddedLines = 0;
bool needToOverwrite = false;
auto currentOperation = TpMainOpMgr.GetMainOpList().OpByID(opId);
bnciWriter.ReadSection(currentOperation->op_idn, false);
auto bnciLines = bnciWriter.GetData();for (int index = 0; index < bnciLines.size(); index++)
{

CBnciReadWrite::BnciLinePtr bnciLine = bnciLines[index];

switch (bnciLine->gcode)
{

…………

case NCI_LINEAR: // 1 (mill nci – linear feed move)

{
bnciLine->u.m1.feed = 6767; // Feed rate
 
if (fpos == -9999)
{
fpos = bnciWriter.RewriteLine(*bnciLine, true); // Feed rate is updated as 6767.00. Rewrite the line to Bnci.
 
CBnciReadWrite::BnciLinePtr bnciLineSptr = CBnciReadWrite::MakeBnciSptr(*bnciLine); // Copy Bnci Line
 
bnciLineSptr->u.m0.feed = 5493; // Change specific parameter of the Bnci line for testing
 
bnciWriter.InsertAt(numOfAddedLines + index + 1, *bnciLineSptr); // Insert new line just after copied line
 
numOfAddedLines += 1;
needToOverwrite = true;
}
 
break;

}

………..

}

if (needToOverwrite)
{
int x = bnciWriter.RewriteSection(false, false, false);
this->m_opId = opId;
this->LoadOperation();
this->Regen(); // Regenerate current operstion
}

}

Thank you everyone for their time and consideration.

 

 

Link to comment
Share on other sites

Sorry, but why are you using an external process to add point when Mastercam has everything needed in every toolpath to accomplish this task and have it come correctly from the software? What process are you using to look ahead and back in the code to make sure these added points don't conflict with the correct running of the machine?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

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