Open CASCADE学习|扫掠

目录

1、BRepPrimAPI_MakePrism

Draw Test Harness:

C++:

2、BRepPrimAPI_MakeRevol

Draw Test Harness:

C++:

3、BRepOffsetAPI_MakePipeShell

Draw Test Harness:

C++:

Draw Test Harness:

C++:

Draw Test Harness:

C++:​

锥度弯曲管

参考文献:


1、BRepPrimAPI_MakePrism

生成线性扫掠

Draw Test Harness:

polyline p  0 0 0 1 0 0 1 2 0 0 1 0 0 0 0prism r p 0 0 1vdisplay p r

C++:

#include <BRepBuilderAPI_MakePolygon.hxx>#include <BRepPrimAPI_MakePrism.hxx>#include"Viewer.h"int main(int argc, char* argv[]){    BRepBuilderAPI_MakePolygon p;    p.Add(gp_Pnt(0,0, 0));    p.Add(gp_Pnt(1, 0, 0));    p.Add(gp_Pnt(1, 2, 0));    p.Add(gp_Pnt(0, 1, 0));    p.Add(gp_Pnt(0, 0, 0));    TopoDS_Shape r=BRepPrimAPI_MakePrism(p,gp_Vec(0,0,1));    Viewer vout(50, 50, 500, 500);    vout << r;    vout.StartMessageLoop();    return 0;}

2、BRepPrimAPI_MakeRevol

生成旋转扫掠

Draw Test Harness:

polyline p  0 0 0 1 0 0 1 2 0 0 1 0 0 0 0revol r p 3 0 0 0 1 0 280vdisplay p r

C++:

#include <BRepBuilderAPI_MakePolygon.hxx>
#include <BRepPrimAPI_MakeRevol.hxx>
​
#include"Viewer.h"
​
int main(int argc, char* argv[])
{
    BRepBuilderAPI_MakePolygon p;
    p.Add(gp_Pnt(0,0, 0));
    p.Add(gp_Pnt(1, 0, 0));
    p.Add(gp_Pnt(1, 2, 0));
    p.Add(gp_Pnt(0, 1, 0));
    p.Add(gp_Pnt(0, 0, 0));
    TopoDS_Shape r= BRepPrimAPI_MakeRevol(p, gp_Ax1(gp_Pnt(3,0,0), gp_Dir(0,1,0)),280*M_PI/180);
    Viewer vout(50, 50, 500, 500);
    vout << r;
    vout.StartMessageLoop();
    return 0;
​
}
​

3、BRepOffsetAPI_MakePipeShell

生成通用的扫掠。该类提供了一个框架,沿着脊柱的导线构建一个shell或者solid。构造solid,初始线框必须闭合的。

在Draw Test Harness中使用如下命令:

mksweep

addsweep

deletesweep

sestsweep

sestsweep有以下选项

-FR选项:切矢和法向由Frenet标架确定;

-CF选项:切矢由Frenet标架指定,法向通过计算最小扭转来确定;

-DT选项:切矢和法向由Darboux标架确定;

-CN选项:副法向由指定的dx, dy, dz确定;

-FT:切矢和法向是固定的;

buildsweep

buildsweep有指定不连续的处理方式及是否生成实体。其中

-C:将路径Path中不连续的地方通过延长和相交进行处理;

-R:将路径Path中不连续的地方通过相交和填充进行处理;

Draw Test Harness:

polyline p  0 0 0 1 0 0 1 2 0 0 1 0circle c 0 0 0 1 0 0 0.2mkedge e cwire w emksweep paddsweep wsetsweep -FX 1 0 0buildsweep r -Cvdisplay p w r

C++:

#include <BRepBuilderAPI_MakePolygon.hxx>
#include <Geom_Circle.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepOffsetAPI_MakePipeShell.hxx>
#include <TopoDS.hxx>
​
#include"Viewer.h"
​
int main(int argc, char* argv[])
{
    BRepBuilderAPI_MakePolygon p;
    p.Add(gp_Pnt(0,0, 0));
    p.Add(gp_Pnt(1, 0, 0));
    p.Add(gp_Pnt(1, 2, 0));
    p.Add(gp_Pnt(0, 1, 0));
    p.Add(gp_Pnt(0, 0, 0));
    Handle(Geom_Circle) c = new Geom_Circle(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(1, 0, 0)), 0.2);
    TopoDS_Edge e = BRepBuilderAPI_MakeEdge(c);
    BRepBuilderAPI_MakeWire w;
    w.Add(e);
    BRepOffsetAPI_MakePipeShell* Sweep = new BRepOffsetAPI_MakePipeShell(TopoDS::Wire(p));
    gp_Dir D(1, 0, 0);
    gp_Ax2 Axe(gp_Pnt(0., 0., 0.), D);
    Sweep->SetMode(Axe);
    BRepBuilderAPI_TransitionMode Transition = BRepBuilderAPI_Transformed;
    Transition = BRepBuilderAPI_RightCorner;
    Sweep->SetTransitionMode(Transition);
    Sweep->Add(w, Standard_False, Standard_False);
    Sweep->Build();
    TopoDS_Shape r = Sweep->Shape();
    Viewer vout(50, 50, 500, 500);
    vout << p;
    vout << w;
    vout << r;
    vout.StartMessageLoop();
    return 0;
​
}
​

Draw Test Harness:

mksweep paddsweep wsetsweep -FRbuildsweep r -Cvdisplay p w r

C++:

#include <BRepBuilderAPI_MakePolygon.hxx>
#include <Geom_Circle.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepOffsetAPI_MakePipeShell.hxx>
#include <TopoDS.hxx>
​
#include"Viewer.h"
​
int main(int argc, char* argv[])
{
    BRepBuilderAPI_MakePolygon p;
    p.Add(gp_Pnt(0,0, 0));
    p.Add(gp_Pnt(1, 0, 0));
    p.Add(gp_Pnt(1, 2, 0));
    p.Add(gp_Pnt(0, 1, 0));
    p.Add(gp_Pnt(0, 0, 0));
    Handle(Geom_Circle) c = new Geom_Circle(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(1, 0, 0)), 0.2);
    TopoDS_Edge e = BRepBuilderAPI_MakeEdge(c);
    BRepBuilderAPI_MakeWire w;
    w.Add(e);
    BRepOffsetAPI_MakePipeShell* Sweep = new BRepOffsetAPI_MakePipeShell(TopoDS::Wire(p));
    Sweep->SetMode(Standard_True);
    BRepBuilderAPI_TransitionMode Transition = BRepBuilderAPI_Transformed;
    Transition = BRepBuilderAPI_RightCorner;
    Sweep->SetTransitionMode(Transition);
    Sweep->Add(w, Standard_False, Standard_False);
    Sweep->Build();
    TopoDS_Shape r = Sweep->Shape();
    Viewer vout(50, 50, 500, 500);
    vout << p;
    vout << w;
    vout << r;
    vout.StartMessageLoop();
    return 0;
​
}
​

Draw Test Harness:

polyline p  0 0 0 1 0 0 1 2 0 0 1 0 0 0 0circle c 0 0 0 1 0 0 0.2mkedge e cwire w emksweep paddsweep wbuildsweep r -Rvdisplay p w r

C++:

#include <BRepBuilderAPI_MakePolygon.hxx>
#include <Geom_Circle.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepOffsetAPI_MakePipeShell.hxx>
#include <TopoDS.hxx>
​
#include"Viewer.h"
​
int main(int argc, char* argv[])
{
    BRepBuilderAPI_MakePolygon p;
    p.Add(gp_Pnt(0,0, 0));
    p.Add(gp_Pnt(1, 0, 0));
    p.Add(gp_Pnt(1, 2, 0));
    p.Add(gp_Pnt(0, 1, 0));
    p.Add(gp_Pnt(0, 0, 0));
    Handle(Geom_Circle) c = new Geom_Circle(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(1, 0, 0)), 0.2);
    TopoDS_Edge e = BRepBuilderAPI_MakeEdge(c);
    BRepBuilderAPI_MakeWire w;
    w.Add(e);
    BRepOffsetAPI_MakePipeShell* Sweep = new BRepOffsetAPI_MakePipeShell(TopoDS::Wire(p));
    Sweep->Add(w, Standard_False, Standard_False);
    Sweep->SetMode(Standard_True);
    BRepBuilderAPI_TransitionMode Transition = BRepBuilderAPI_Transformed;
    Transition = BRepBuilderAPI_RoundCorner;
    Sweep->SetTransitionMode(Transition);
    Sweep->Build();
    TopoDS_Shape r = Sweep->Shape();
    Viewer vout(50, 50, 500, 500);
    vout << p;
    vout << w;
    vout << r;
    vout.StartMessageLoop();
    return 0;
​
}
​

锥度弯曲管

#include <Geom_BezierCurve.hxx>
#include <BRepOffsetAPI_MakePipeShell.hxx>
#include <Law_Linear.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <Geom2d_TrimmedCurve.hxx>
​
#include <GCE2d_MakeSegment.hxx>
​
#include <GeomAPI_PointsToBSpline.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <GC_MakeCircle.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepOffsetAPI_MakePipe.hxx>
#include <GC_MakeArcOfCircle.hxx>
#include <BRepAlgoAPI_Fuse.hxx>
​
#include <GCPnts_QuasiUniformDeflection.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
​
#include"Viewer.h"
​
#include <GProp_GProps.hxx>
#include <BRepGProp.hxx>
​
int main(int argc, char* argv[])
{
    //Creation of points for the spine
    TColgp_Array1OfPnt array = TColgp_Array1OfPnt(1, 5);
    array.SetValue(1, gp_Pnt(1, 4, 0));
    array.SetValue(2, gp_Pnt(2, 2, 0));
    array.SetValue(3, gp_Pnt(3, 3, 0));
    array.SetValue(4, gp_Pnt(4, 3, 0));
    array.SetValue(5, gp_Pnt(5, 5, 0));
​
    //Creation of a Bezier Curve as the spine #创建贝塞尔曲线作为主干
    Geom_BezierCurve* bz_curv = new Geom_BezierCurve(array);
    TopoDS_Edge bz_curv_edge = BRepBuilderAPI_MakeEdge(bz_curv);
    TopoDS_Wire bz_curv_wire = BRepBuilderAPI_MakeWire(bz_curv_edge);
​
    //Creation of profile to sweep along the spine #创建沿脊柱扫描的轮廓
    gp_Circ circle = gp_Circ(gp::ZOX(), 1);
    circle.SetLocation(array[1]);
    TopoDS_Edge circle_edge = BRepBuilderAPI_MakeEdge(circle);
    TopoDS_Wire circle_wire = BRepBuilderAPI_MakeWire(circle_edge);
    
    //Creation of the law to dictate the evolution of the profile#规定轮廓的演变
    BRepOffsetAPI_MakePipeShell* brep1 = new BRepOffsetAPI_MakePipeShell(bz_curv_wire);
    Handle(Law_Linear) law_f =new Law_Linear();
    law_f->Set(0, 0.5, 1, 1);
    brep1->SetLaw(circle_wire, law_f, Standard_False,Standard_True);
    Viewer vout(50, 50, 500, 500);
    vout << bz_curv_wire;
    vout << brep1->Shape();
    vout.StartMessageLoop();
    return 0;
​
}
​


参考文献:

1、https://dev.opencascade.org/doc/occt-7.0.0/refman/html/class_b_rep_offset_a_p_i___make_pipe_shell.html#details

2、https://www.cnblogs.com/opencascade/p/OpenCASCADE_Sweep_Algorithm.html

3、https://blog.csdn.net/ydk001001/article/details/121210419

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/382483.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

node.js+vue企业人事自动化办公oa系统c288a

采用B/S模式架构系统&#xff0c;开发简单&#xff0c;只需要连接网络即可登录本系统&#xff0c;不需要安装任何客户端。开发工具采用VSCode&#xff0c;前端采用VueElementUI&#xff0c;后端采用Node.js&#xff0c;数据库采用MySQL。 涉及的技术栈 1&#xff09; 前台页面…

小程序-云开发 获取用户的openid等信息

说明介绍&#xff1a; 小程序云开发功能来获取用户的openid。 一般在我们需要用到用户登录的时候&#xff0c;通常是需要获取微信小程序的openid的&#xff0c;由于微信的限制&#xff0c;一般我们只能通过后台去调微信的接口&#xff0c;来授权获取&#xff0c;增加了后端开发…

OnlyOffice-8.0版本深度测评

OnlyOffice 是一套全面的开源办公协作软件&#xff0c;不断演进的 OnlyOffice 8.0 版本为用户带来了一系列引人瞩目的新特性和功能改进。OnlyOffice 8.0 版本在功能丰富性、安全性和用户友好性上都有显著提升&#xff0c;为用户提供了更为强大、便捷和安全的文档处理和协作环境…

内网安全-内网穿透

目录 内网渗透 Nc使用详解 Nc监听和探测 Nc传文件 termite内网穿透工具 ssh代理内网穿透 ssh配置socket代理 MSF多级网络穿透 内网渗透 Nc使用详解 Nc监听和探测 Nc传文件 termite内网穿透工具 1、termite 之前叫ew &#xff08;可以进行正向连接&#xff0c;可以…

【深度学习】“智能皮肤:深度学习驱动的‘智慧之眼‘应用如何革新皮肤病诊疗未来“

在一个不久的未来世界&#xff0c;医疗科技取得了惊人的突破。一款名为“智慧之眼”的神秘应用横空出世&#xff0c;它如同科幻小说中的神器&#xff0c;能够通过摄像头扫描皮肤病变&#xff0c;并借助深度学习技术迅速得出专业级别的诊断结果。这个革新性的故事始于一场科研马…

【制作100个unity游戏之23】实现类似七日杀、森林一样的生存游戏10(附项目源码)

本节最终效果演示 文章目录 本节最终效果演示系列目录前言快捷栏绘制UI代码控制快捷列表信息 源码完结 系列目录 前言 欢迎来到【制作100个Unity游戏】系列&#xff01;本系列将引导您一步步学习如何使用Unity开发各种类型的游戏。在这第23篇中&#xff0c;我们将探索如何制作…

Java异常处理 throw和throws

目录 throwthrows实例制造异常 在Java中&#xff0c;throw和throws关键字都与异常处理有关&#xff0c;但它们的使用方式和目的有所不同。 throw throw关键字&#xff1a; * throw用于在代码中显式地抛出一个异常。你可以使用它来触发一个异常&#xff0c;并指定异常的类型。…

FPGA_简单工程_VGA显示驱动器

一 理论 使用640*48060显示模式&#xff0c;将数字信号转换位模拟信号&#xff0c;经由VGA进行显示。 使用3GM723&#xff0c;3路高清视频编码芯片。 3GM7123编码芯片&#xff1a; 该芯片的主要功能是将RGB888的颜色数据转换成模拟的电压信号&#xff0c;然后进入到VGA接口的…

STM32CubeMX,定时器之定时功能,入门学习,如何设置prescaler,以及timer计算PWM输入捕获方法(重要)

频率变小&#xff0c;周期变长 1&#xff0c;参考链接&#xff08;重要&#xff09; STM32CubeMX——定时器之定时功能&#xff08;学习使用timer定时器的设置&#xff09; STM32测量PWM信息&#xff08;学习使用设置pwm输入捕获&#xff09; 通用定时器中两个重要参数的设置心…

吹响AI PC号角!微软在Windows中不断增加“Copilot含量”

2024&#xff0c;会是AI PC元年吗&#xff1f;至少微软正在往这个方向努力。 本周&#xff0c;微软开始在Windows中测试Copilot的“新体验”&#xff0c;其中包括任务栏中的Copilot图标&#xff0c;当用户复制文本或图片时&#xff0c;Copilot操作菜单就会自动出现。 有媒体在…

《CSS 简易速速上手小册》第5章:CSS 动画与过渡(2024 最新版)

文章目录 5.1 CSS 过渡基础&#xff1a;网页的微妙舞步5.1.1 基础知识5.1.2 重点案例&#xff1a;按钮悬停效果5.1.3 拓展案例 1&#xff1a;渐变显示导航菜单5.1.4 拓展案例 2&#xff1a;动态调整元素大小 5.2 关键帧动画&#xff1a;编排你的网页芭蕾5.2.1 基础知识5.2.2 重…

基于vue+node.js的校园跳蚤市场系统多商家

校园跳蚤市场系统可以在短时间内完成大量的数据处理、帮助用户快速的查找校园跳蚤市场相关信息&#xff0c;实现的效益更加直观。校园跳蚤市场系统中采用nodejs技术和mysql数据库。主要包括管理员、发布者和用户三大部分&#xff0c;主要功能是实现对个人中心、用户管理、发布者…

【MATLAB源码-第138期】基于matlab的D2D蜂窝通信仿真,对比启发式算法,最优化算法和随机算法的性能。

操作环境&#xff1a; MATLAB 2022a 1、算法描述 D2D蜂窝通信介绍 D2D蜂窝通信允许在同一蜂窝网络覆盖区域内的终端设备直接相互通信&#xff0c;而无需数据经过基站或网络核心部分转发。这种通信模式具有几个显著优点&#xff1a;首先&#xff0c;它可以显著降低通信延迟&…

大模型训练所需的硬件配置

1. 引入 训练一个大模型&#xff0c;到底需要投入多少块GPU&#xff0c;需要多少数据&#xff0c;训练多长时间能达到一个不错的效果&#xff1f; 本文引用靠谱的数据&#xff0c;来回答这些问题。 2. 全流程训练 大模型的训练&#xff0c;简单来说&#xff0c;分为Pretrain…

C#计算矩形面积:通过定义结构 vs 通过继承类

目录 一、涉及到的知识点 1、结构 2.结构和类的区别 3.继承 4.使用类继承提高程序的开发效率 二、实例&#xff1a;通过定义结构计算矩形面积 1.源码 2.生成效果 三、实例&#xff1a;通过继承类计算梯形面积 1.源码 2.生成效果 一、涉及到的知识点 1、结构 结构是…

git安装配置

1、下载安装 下载地址 2、配置git用户 git config --global user.name "yw" git config --global user.email "88888qq.com" 3、git init 初始化 4、生成ssh密钥 mkdir .ssh //创建文件夹cd .ssh //进入新建文件夹 ssh-keygen -t rsa // 输入密钥文…

推荐系统|召回05_矩阵补充、最近邻查找

文章目录 矩阵补充Matrix Completion模型结构模型训练模型存储 矩阵补充Matrix Completion 模型结构 通过用户ID和物品ID分别找到对应的向量&#xff0c;然后去做内积&#xff0c;内积的数值可以去衡量匹配的程度。 不共享参数的意思是指用户ID和物品ID使用不同的Embedding L…

LeetCode 144 二叉树的前序遍历

大家新年快乐&#xff0c;long年大吉 今天的题很简单&#xff0c;前序用栈就行。 电脑没拿&#xff0c;用我妈的pad艰难敲代码&#xff0c;敲字 知识点随便写点吧&#xff0c;这里基础点挺多&#xff0c;以后补充下 栈&#xff1a;先进后出&#xff0c;数据结构用stack&…

鸿蒙(HarmonyOS)项目方舟框架(ArkUI)之Blank组件

鸿蒙&#xff08;HarmonyOS&#xff09;项目方舟框架&#xff08;ArkUI&#xff09;之Blank组件 一、操作环境 操作系统: Windows 10 专业版、IDE:DevEco Studio 3.1、SDK:HarmonyOS 3.1 二、Blank组件 空白填充组件&#xff0c;在容器主轴方向上&#xff0c;空白填充组件具…

react中hook封装一个table组件 与 useColumns组件

目录 1&#xff1a;react中hook封装一个table组件依赖CommonTable / index.tsx使用组件效果 2&#xff1a;useColumns组件useColumns.tsx使用 1&#xff1a;react中hook封装一个table组件 依赖 cnpm i react-resizable --save cnpm i ahooks cnpm i --save-dev types/react-r…
最新文章