dwg解析-样条曲线拟合点解析(中望CAD导出)
dwg解析-样条曲线拟合点解析(中望CAD导出)
中望CAD导出的dwg文件,其中样条曲线拟合点解析出的结果出拟合点和起始点的方向,
解析代码如下:
/ harray is the Handle(TColgp_HArray1OfPnt) containing the sampled circle points in the YZ plane at PI/4, PI/2, 3/2PI and 2PI
GeomAPI_Interpolate interp(harray, Standard_True, 0.001);
TColgp_Array1OfVec tangents(1, 4);
tangets.SetValue(1, gp_Vec(0, -1, 0));
tangents.SetValue(2, gp_Vec(0, 0, -1));
tangents.SetValue(3, gp_Vec(0, 1, 0));
tangents.SetValue(4, gp_Vec(0, 0, 1));
TColstd_HArray1OfBoolean flags(1,4);
flags.SetValue(1, Standard_True);
flags.SetValue(2, Standard_True);
flags.SetValue(3, Standard_True);
flags.SetValue(4, Standard_True);
interp.Load(tangents, flags.GetHandle());
interp.Perform();
int fitlen = fitPts->Count;
Handle(TColgp_HArray1OfPnt) arry = new TColgp_HArray1OfPnt(1, fitlen);
TColgp_Array1OfVec tangents(1, fitlen);
Handle_TColStd_HArray1OfBoolean farray = new TColStd_HArray1OfBoolean(1, fitlen);
for (int i = 0; i < fitlen; i++)
{
arry->SetValue(i + 1, gp_Pnt(fitPts[i]->X, fitPts[i]->Y, fitPts[i]->Z));
tangents.SetValue(i + 1, gp_Vec(dirs[i]->X, dirs[i]->Y, dirs[i]->Z));
farray->SetValue(i + 1, true);
}
GeomAPI_Interpolate interp(arry, false, 0.001);
interp.Load(tangents, farray);
interp.Perform();
Handle(Geom_BSplineCurve) theSpline = interp.Curve();
BRepBuilderAPI_MakeEdge nativeHandle_MakeEdge = BRepBuilderAPI_MakeEdge(theSpline);
TopoDS_Edge tmp = nativeHandle_MakeEdge.Edge();
分类:
opencascade
标签:
occ
, opencascade
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· spring官宣接入deepseek,真的太香了~