Open CASCADE学习|扫掠

news2024/10/7 1:22:39

目录

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.coloradmin.cn/o/1443652.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

QXlsx Qt操作excel(2)

QXlsx 是一个用于处理Excel文件的开源C库。它允许你在你的C应用程序中读取和写入Microsoft Excel文件&#xff08;.xlsx格式&#xff09;。该库支持多种操作&#xff0c;包括创建新的工作簿、读取和写入单元格数据、格式化单元格、以及其他与Excel文件相关的功能。 关于QXlsx的…

Attention 和 Self-Attention 总结

一、Attention Attention 的核心逻辑是“从关注全部到关注重点”&#xff0c;将有限的注意力集中在重点信息上&#xff0c;从而节省资源&#xff0c;快速获得最有效的信息。 Attention 机制可以更加好的解决序列长距离依赖问题&#xff0c;并且具有并行计算能力。 Attention…

【计算几何】给定一组点的多边形面积

目录 一、说明二、有序顶点集三、无序顶点集3.1 凸多边形3.2 非凸多边形 四、结论 ​ 一、说明 计算多边形面积的方法有很多种。众所周知的多边形&#xff08;如三角形、矩形、正方形、梯形等&#xff09;的面积可以使用简单的数学公式计算。在这篇文章中&#xff0c;我将讨论…

ChatGPT高效提问—prompt常见用法(续篇八)

ChatGPT高效提问—prompt常见用法(续篇八) 1.1 对抗 ​ 对抗是一个重要主题,深入探讨了大型语言模型(LLM)的安全风险。它不仅反映了人们对LLM可能出现的风险和安全问题的理解,而且能够帮助我们识别这些潜在的风险,并通过切实可行的技术手段来规避。 ​ 截至目前,网络…

python web 框架Django学习笔记

2018年5月 python web 框架Django学习笔记 Django 架站的16堂课 MVC架构设计师大部分框架或大型程序项目中一种软件工程的架构模式&#xff0c;把程序或者项目分为三个主要组成部分&#xff0c;Model数据模型、View视图、Controller控制器。 命令及设置相关 创建数据库及中间…

【EAI 014】Gato: A Generalist Agent

论文标题&#xff1a;A Generalist Agent 论文作者&#xff1a;Scott Reed, Konrad Zolna, Emilio Parisotto, Sergio Gomez Colmenarejo, Alexander Novikov, Gabriel Barth-Maron, Mai Gimenez, Yury Sulsky, Jackie Kay, Jost Tobias Springenberg, Tom Eccles, Jake Bruce,…

车载自动化项目:Python

1. 自动化测试用的什么框架&#xff1f; 第一种&#xff1a;PythonSeleniumuittest框架 首先是拿到需求文档&#xff0c;基于这个需求去进行搭建。 用pytestrequestallure 这些第三方库进行编写自动化脚本。 举个例子一般的话整个的一个自动化的搭建是分为6层嘛&#xff1a…

GPIO结构

GPIO简介 GPIO(General Purpose Input Output)通用输入输出口 可配置为8种输入输出模式 引脚电平&#xff1a;0V~3.3V,部分引脚可容忍5V 输出模式下可控制端口输出高低电平,用以驱动LED、控制蜂鸣器、模拟通信协议输出时序等 输入模式下可读取端口的高低电平或电压&#x…

算法学习——LeetCode力扣字符串篇

算法学习——LeetCode力扣字符串篇 344. 反转字符串 344. 反转字符串 - 力扣&#xff08;LeetCode&#xff09; 描述 编写一个函数&#xff0c;其作用是将输入的字符串反转过来。输入字符串以字符数组 s 的形式给出。 不要给另外的数组分配额外的空间&#xff0c;你必须原地…

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

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

[C# WPF] DataGrid选中行或选中单元格的背景和字体颜色修改

问题描述 WPF中DataGrid的选中行或选中者单元格&#xff0c;在焦点失去后&#xff0c;颜色会很淡&#xff0c;很不明显&#xff0c;不容易区分。 解决方法 在失去焦点的情况下&#xff0c;如何设置行或单元格与选中的时候颜色一样&#xff1f; <DataGrid.Resources>&…

【Linux】构建模块

&#x1f525;博客主页&#xff1a;PannLZ &#x1f38b;系列专栏&#xff1a;《Linux系统之路》 &#x1f94a;不要让自己再留有遗憾&#xff0c;加油吧&#xff01; 文章目录 构建第一个模块1模块的makefile2内核树内构建3内核树外构建 构建第一个模块 可以在两个地方构建模…

Linux操作系统基础(七):Linux常见命令(二)

文章目录 Linux常见命令&#xff08;二&#xff09; 一、kill命令 二、ifconfig命令 三、clear命令 四、重启与关机命令 五、which命令 六、hostname命令 七、grep命令 八、|管道 九、useradd命令 十、userdel命令 十一、tar命令 十二、su命令 十三、ps命令 Linu…

滑块识别验证

滑块识别 1. 获取图片 测试网站&#xff1a;https://www.geetest.com/adaptive-captcha-demo 2. 点击滑块拼图并开始验证 # 1.打开首页 driver.get(https://www.geetest.com/adaptive-captcha-demo)# 2.点击【滑动拼图验证】 tag WebDriverWait(driver, 30, 0.5).until(la…

Python爬虫——请求库安装

目录 1.打开Anaconda Prompt 创建环境2.安装resuests3.验证是否安装成功4.安装Selenium5.安装ChromeDriver5.1获取chrom的版本5.1.1点击浏览器右上三个点5.1.2点击设置5.1.3下拉菜单&#xff0c;点击最后关于Chrome&#xff0c;获得其版本 5.2 打开网址 [chromedriver](https:/…

SolidWorks学习笔记——入门知识1

目录 1、固定最近文档 2、根据需要自定义菜单栏 3、根据需要增添选项卡 4、命令搜索框 5、鼠标右键长按快速切换视图 6、鼠标笔势 自定义鼠标笔势 1、固定最近文档 图1 固定最近文档 2、根据需要自定义菜单栏 图2 根据需要自定义菜单栏 3、根据需要增添选项卡 图3 根据…

服务器被黑,安装Linux RootKit木马

前言 疫情还没有结束&#xff0c;放假只能猫家里继续分析和研究最新的攻击技术和样本了&#xff0c;正好前段时间群里有人说服务器被黑&#xff0c;然后扔了个样本在群里&#xff0c;今天咱就拿这个样本开刀&#xff0c;给大家研究一下这个样本究竟是个啥&#xff0c;顺便也给…

尚硅谷 Vue3+TypeScript 学习笔记(中)

目录 三、路由 3.1. 【对路由的理解】 3.2. 【基本切换效果】 3.3. 【两个注意点】 3.4.【路由器工作模式】 3.5. 【to的两种写法】 3.6. 【命名路由】 3.7. 【嵌套路由】 3.8. 【路由传参】 query参数 params参数 3.9. 【路由的props配置】 3.10. 【 replace属性…

HiveSQL——sum(if()) 条件累加

注&#xff1a;参考文章&#xff1a; HiveSql面试题10--sum(if)统计问题_hive sum if-CSDN博客文章浏览阅读5.8k次&#xff0c;点赞6次&#xff0c;收藏19次。0 需求分析t_order表结构字段名含义oid订单编号uid用户idotime订单时间&#xff08;yyyy-MM-dd&#xff09;oamount订…

日本的便宜服务器有哪些?

年底之际&#xff0c;无非是云服务器优惠的黄金时期&#xff0c;对于个人用户和独立开发者来说&#xff0c;无论你是搭建个人网站还是个人博客&#xff0c;现在都是行动的好时机。那么&#xff0c;对于这时要入手日本服务器的用户&#xff0c;该怎么找便宜厂商呢&#xff1f;这…