Beispiel #1
0
void FreesteelWindow::addPathxSeries(PathXSeries* xser)
{
	GSTtoolpath* tp = new GSTtoolpath();
	tp->ftpaths.push_back(*xser);
	tp->UpdateFromPax();
	add(tp);
}
Beispiel #2
0
GSTtoolpath* MainFrame::SelectedBoundary() const
{
    int ix = 0;

    while (ix < gst->gstees.size())
    {
        GSTbase *gb = gst->gstees[ix];
        GSTtoolpath *gstbdy = dynamic_cast<GSTtoolpath *>(gb);
        if ((gstbdy != NULL) && (gstbdy->GetVisibility()))
            return gstbdy;

        ++ix;
    }

    return NULL;
}
Beispiel #3
0
void MainFrame::OnMachiningAreaclear(wxCommandEvent& WXUNUSED(event) )
{
    double cr = 3.;
    double fr = 0.;
    double sd = 15.;
    double si = cr / 2.;
    if (RunCoreRoughDlg(cr, fr, sd, si))
    {
        GSTsurface *gstsurf = SelectedSurface();
        GSTtoolpath *gstbound = SelectedBoundary();
        ASSERT((gstsurf != NULL) && (gstbound != NULL));

        if (!(gstsurf || gstbound))
            return;

        MachineParams params;
        // linking parameters
        params.leadoffdz = 0.1;
        params.leadofflen = 1.1;
        params.leadoffrad = 2.0;
        params.retractzheight = gstsurf->zrg.hi + 5.0;
        params.leadoffsamplestep = 0.6;

        // cutting parameters
        params.toolcornerrad = cr;
        params.toolflatrad = fr;
        params.samplestep = 0.4;
        params.stepdown = sd;
        params.clearcuspheight = sd / 3.0;

        // weave parameters
        params.triangleweaveres = 0.51;
        params.flatradweaveres = 0.71;

        // stearing parameters
        // fixed values controlling the step-forward of the tool and
        // changes of direction.
        params.dchangright = 0.17;
        params.dchangrightoncontour = 0.37;
        params.dchangleft = -0.41;
        params.dchangefreespace = -0.6;
        params.sidecutdisplch = 0.0;
        params.fcut = 1000;
        params.fretract = 5000;
        params.thintol = 0.0001;



        GSTtoolpath* gsttpath = new GSTtoolpath;
        gst->gstees.push_back(gsttpath);

        // define the empty surface
        SurfX sx(gstsurf->xrg.Inflate(2), gstsurf->yrg.Inflate(2), gstsurf->zrg);
        gstsurf->PushTrianglesIntoSurface(sx);
        sx.BuildComponents(); // compress thing

        ASSERT(gstbound->ftpaths.size() == 1);
        MakeCorerough(gsttpath->ftpaths, sx, gstbound->ftpaths[0], params);

        // write result to a file
        FILE* fpost = fopen("freesteel.tp", "w");
        ASSERT(fpost);
        PostProcess(fpost, gsttpath->ftpaths, params);
        fclose(fpost);


        gsttpath->toolshape = ToolShape(params.toolflatrad, params.toolcornerrad, params.toolcornerrad, params.toolcornerrad / 10.0);
        gsttpath->bound.Append(gstbound->ftpaths[0].pths);
        gsttpath->UpdateFromPax();
        gsttpath->AddToRenderer(&gst->ren1);

        UpdateActors();
        UpdateAnimate();
    }
}