Beispiel #1
0
parking::parking(QWidget *parent, Qt::WFlags flags)
	: QMainWindow(parent, flags)
{
	ui.setupUi(this);
	QGridLayout *gd=new QGridLayout(ui.centralWidget);
	Widget=new GLWidget(ui.centralWidget);
	gd->addWidget(Widget);
	Widget->show();
	Widget->setFocusPolicy(Qt::StrongFocus);
	Widget->setFocus();


	Widget->geom=0;
	
	connect(ui.action_LoadSTL,SIGNAL(triggered()),this,SLOT(loadSTL()));
	connect(ui.action_LoadDXF,SIGNAL(triggered()),this,SLOT(loadDXF()));
	connect(ui.action_Load3DS,SIGNAL(triggered()),this,SLOT(load3DS()));
	connect(ui.action_LoadIGES,SIGNAL(triggered()),this,SLOT(loadIGES()));

	fixView = ui.toolBar->addAction(QString::fromLocal8Bit("Fix View"));
	orthoView_XY = ui.toolBar->addAction(QString::fromLocal8Bit("XY View"));
	orthoView_YZ = ui.toolBar->addAction(QString::fromLocal8Bit("YZ View"));
	orthoView_ZX = ui.toolBar->addAction(QString::fromLocal8Bit("ZX View"));
	
	connect(fixView,SIGNAL(triggered()),this,SLOT(fixView_clicked()));
	connect(orthoView_XY,SIGNAL(triggered()),this,SLOT(orthoView_XY_clicked()));
	connect(orthoView_YZ,SIGNAL(triggered()),this,SLOT(orthoView_YZ_clicked()));
	connect(orthoView_ZX,SIGNAL(triggered()),this,SLOT(orthoView_ZX_clicked()));
	
}
Beispiel #2
0
int NGInterface::genMeshSTL(string data)
{
    int ng_res = 0;

    // Set the Meshing Parameters to be used
    mparam.maxh = maxMeshSize;
    mparam.minh = minMeshSize;
    mparam.segmentsperedge = epEdge;
    mparam.curvaturesafety = epRadius;
    mparam.grading = meshSizeGrading;

    stlparam.yangle = edgeAngle;
    stlparam.resthlinelengthfac = lineLength;
    stlparam.resthlinelengthenable = 1;
    stlparam.resthchartdistfac = chartDist;
    stlparam.resthchartdistenable = 1;
    stlparam.resthcloseedgefac = closeEdges;
    stlparam.resthcloseedgeenable = 1;
    stlparam.resthsurfcurvfac = surfaceCurvature;
    stlparam.resthsurfcurvenable = 1;
    stlparam.resthsurfmeshcurvfac = surfaceMeshCurv;
    stlparam.resthsurfmeshcurvenable = 1.0;



    try
    {
        if (!loadSTL(data))
        {
            cout << "Error reading in current STL data" << endl;
            return ng_res;
        }
        cout << "Successfully loaded STL data" << endl;
        ((STLGeometry*)geometry)->GenerateMesh(s_ptr,mparam,1,10);
    }
    catch (...)
    {
        cerr << "Meshing error!" << endl;
        return 0;
    }

    new shared_ptr<Mesh> (s_ptr);  // hack to keep mesh m alive

    mesh = s_ptr.get();
    cout << "------------------------------------------------" << endl;
    cout << "Points:   " << mesh->GetNP() << endl;
    cout << "Elements: " << mesh->GetNE() << endl;
//    ((CSGeometry*)geometry)->GetRefinement().Refine(*mesh);
//    cout << "Elements after refinement: " << mesh->GetNP() << endl;
//    cout << "Points   after refinement: " << mesh->GetNE() << endl;
//    mesh->Save("tmp.vol");
    return 1;
}