0
点赞
收藏
分享

微信扫一扫

爬虫-7-数据存储-Excel

前言

这篇博客针对《Opencascade+Qt+C++三维图像建模窗体点线面拾取igs/iges/stp/step》编写代码,代码整洁,规则,易读。 学习与应用推荐首选。


运行结果

在这里插入图片描述


文章目录

一、所需工具软件
二、使用步骤
       1. 主要代码
       2. 运行结果
三、在线协助

一、所需工具软件

       1. VS2019, Qt
       2. C++

二、使用步骤

代码如下(示例):
#include <BRep_Builder.hxx>
#include <StepData_StepModel.hxx>
#include <STEPControl_Reader.hxx>
#include <TCollection_AsciiString.hxx>
#include <XSControl_Controller.hxx>
#include <Interface_Static.hxx>
#include <Transfer_TransientProcess.hxx>
#include <gp_Circ.hxx>
#include <gp_Elips.hxx>
#include <gp_Sphere.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_HSequenceOfShape.hxx>
#include <IGESControl_Controller.hxx>
#include <IGESControl_Writer.hxx>
#include <IGESControl_Reader.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    ui.setupUi(this);
	occView = new occview(this);
	setCentralWidget(occView);
	InitMenu();
}
void MainWindow::InitMenu()
{
	QMenuBar* menuBar = ui.menuBar;
	QMenu* menuCreate = menuBar->addMenu(tr("&Create"));
	menuCreate->addAction(tr("&Box"));
	menuCreate->addAction(tr("&Sphere"));
	connect(menuBar, SIGNAL(triggered(QAction*)), this, SLOT(trigerMenu(QAction*)));
}

TopoDS_Shape MainWindow::createBox()
{
	return BRepPrimAPI_MakeBox(10.0, 10.0, 10.0).Shape();
}
TopoDS_Shape MainWindow::createSphere()
{
	return BRepPrimAPI_MakeSphere(10.0).Shape();
}
void MainWindow::trigerMenu(QAction* action)
{
	if (action->text() == "&Box")
	{
		TopoDS_Shape box = createBox();
		Handle(AIS_Shape) aisBox = new AIS_Shape(box);
		occView->GetInteractiveContext()->Display(aisBox, Standard_True);
		occView->GetView()->FitAll();
	}
	else if (action->text() == "&Sphere")
	{
		TopoDS_Shape sphere = createSphere();
		Handle(AIS_Shape) aisSphere = new AIS_Shape(sphere);
		occView->GetInteractiveContext()->Display(aisSphere, Standard_True);
		occView->GetView()->FitAll();
	}
	else
	{
		QMessageBox::warning(this, tr("Warning"), action->text());
	}
}

occview::occview(QWidget *parent)
	: QWidget(parent)
{
	ui.setupUi(this);
	if (m_context.IsNull()) {
		Handle(Aspect_DisplayConnection) m_display_connection = new Aspect_DisplayConnection();
		if (m_graphic_driver.IsNull())
		{
			m_graphic_driver = new OpenGl_GraphicDriver(m_display_connection);
		}
		WId window_handle = (WId)winId();
		Handle(WNT_Window) wind = new WNT_Window((Aspect_Handle)window_handle);
		m_viewer = new V3d_Viewer(m_graphic_driver);
		m_view = m_viewer->CreateView();
		m_view->SetWindow(wind);
		if (!wind->IsMapped()) {
			wind->Map();
		}
		m_context = new AIS_InteractiveContext(m_viewer);
}
运行结果

在这里插入图片描述
在这里插入图片描述

三、在线协助:

如需安装运行环境或远程调试,见文章底部个人 QQ 名片,由专业技术人员远程协助!

当前文章连接:https://blog.csdn.net/alicema1111/article/details/132666851
个人博客主页:https://blog.csdn.net/alicema1111?type=blog
博主所有文章点这里:https://blog.csdn.net/alicema1111?type=blog

博主推荐:
Python人脸识别考勤打卡系统:
https://blog.csdn.net/alicema1111/article/details/133434445
Python果树水果识别:https://blog.csdn.net/alicema1111/article/details/130862842
Python+Yolov8+Deepsort入口人流量统计:https://blog.csdn.net/alicema1111/article/details/130454430
Python+Qt人脸识别门禁管理系统:https://blog.csdn.net/alicema1111/article/details/130353433
Python+Qt指纹录入识别考勤系统:https://blog.csdn.net/alicema1111/article/details/129338432
Python Yolov5火焰烟雾识别源码分享:https://blog.csdn.net/alicema1111/article/details/128420453
Python+Yolov8路面桥梁墙体裂缝识别:https://blog.csdn.net/alicema1111/article/details/133434445

举报

相关推荐

0 条评论