Simulator

Hi Les,

im trying following Code at SIM and cant change the Layer.

void OnEnter(void)
{
SetDisplayMode(scDISPLAY_FULL);

m_parent->NotifyLua(notifySHOW);
((cSim *)m_parent)->CreateTool(toolPARALLEL);
((cSim *)m_parent)->m_active = true;
m_parent->GlRedraw();

// Begin Inserted ------------------------------------------------------

for( ; ; )
{
if (m_parent->Lock(L"Test") == true) break;
else
{
m_parent->Debug(L"SC-Lock failed");
m_parent->Unlock();
}
}
m_parent->Debug(L"SC-Locked");

// SC crashes
// if(m_parent->SetLayer(L"A new layer1") == true) m_parent->Debug(L"Layer changed");
// else m_parent->Debug(L"Layer not changed");

m_parent->StartTempOutline();
// Set Layer doesnt change Layer, returns false
if(m_parent->SetLayer(L"A new layer1") == true) m_parent->Debug(L"Layer changed");
else m_parent->Debug(L"Layer not changed");


own_scSEGMENT.type = scSEGMENT_LINE;
own_scSEGMENT.start.x = 50;
own_scSEGMENT.start.y = 100;
own_scSEGMENT.end.x = 20;
own_scSEGMENT.end.y = 100;
// AddSegment returns true and will be displayed
if (m_parent->AddSegment( &own_scSEGMENT)== true) m_parent->Debug(L"Add Segment OK");
else m_parent->Debug(L"Add Segment failed");
// also returns false
if(m_parent->SetLayer(L"A new layer1") == true) m_parent->Debug(L"Layer changed");
else m_parent->Debug(L"Layer not changed");

// CopyTempOutline returns false
if (m_parent->CopyTempOutline()== true) m_parent->Debug(L"Copy Temp Outline OK");
else m_parent->Debug(L"Copy Temp Outline failed");
m_parent->EndTempOutline();

for(i=1; i< 65550;i++) // only delay for test
{
for(i1=1; i1 < 5550;i1++)
{}
}
m_parent->Unlock();
m_parent->Debug(L"SC-UnLocked");
// End: Inserted ------------------------------------------------------
}

do you have any idea what is wrong ?

Thank you in advance,


Bernd

I have to admit I have never tried doing that. I would expect problems as the post will already have locked SheetCam. What exactly are you trying to do?

By the way, I received your support file. Unfortunately you didn’t supply an email address so I couldn’t reply.

Hi Les,

I have the post processor enhanced, to generate special g-code instruction for our CNC.
Because of that the machine has only 28kBytes memory to store CNC-programms
and it takes a long time to upload the g-code programs on it.
But this machine knows g-codes for pocketting with a few parameters.
To mill a contour or a special pocket i use a loop, so i need only one XY-plane at my g-code.

I have also enhanced Sim.lua to show whats happening on the special g-codes.
Now i search a way at simulation, to display the milled structure or pocket after the operation is finished and before the next operation begins.
So i have tried it this way. But no problem, i will try it with OpenGL inside SIM, like the own toolpath.

Thank you


Bernd