Manifold Geometry // Многообразная Геометрия

Convert CAD faces to splines with OpenCascade

/ Просмотров: 2390

Sometimes we wanna do things that are completely opposite to canonical recognition, i.e., to convert nice analytical shapes to splines. There are several circumstances when you might need such a trick. What I could recall from practice is the following:

  1. Data exchange. After spending several weeks (if not months) modelling turbine blades with their hubs and shrouds, I realized that some surfaces (especially offset surface) were completely broken (Fig. 1). The "fix" was to represent the faulty geometries with splines.

  2. Lack of robustness in modelling algorithms for the special analytic cases. As you might know, a typical CAD engine tries to process analytic geometries in a specific way, and fall back to the generic methods for freeform geometries or tricky cases only. E.g., why would you run a walking procedure for surface-surface intersection [Barnhill, R. E., Farin, G., Jordan, M., & Piper, B. R. (1987). Surface / surface intersection. Computer Aided Geometric Design, 4, 3–16] if you are intersecting just a couple of planes? But if things are broken, you might want to force the engine to give a generic numerical method a try.
Figure 1. Bad luck on importing a solid model to Rhinoceros.

Converting a surface to a spline is as easy as calling GeomConvert::SurfaceToBSplineSurface() function:

Handle(Geom_BSplineSurface)
  bsurf = GeomConvert::SurfaceToBSplineSurface(surf);
Figure 2. Converting a single surface to spline in Analysis Situs.

As you can see from Fig. 2, the converted surface remains untrimmed as the conversion is done not taking into account the trimming contour of the original face. There is a package ShapeCustom that does the job at topological level, i.e., it allows converting not surfaces but the entire shape. Still, it works the same way underneath and the resulting spline surfaces are not minimal.

Want to discuss this? Jump in to our forum.

Комментариев: 3 RSS

Добрый день! У меня вопрос по установке OpenCascade для VS 2019.

Сейчас на официальном сайте (dev.opencascade.org/release) можно скачать сразу собранный OpenCascade - VC++ 2017 64 bit (vc14). Но можно ли пользоваться готовыми dll, собранными с помощью VS 2017 (vc14), при разработке на VS 2019 (vc142)? Вроде как можно (docs.microsoft.com/ru-ru/cpp/porting/binary-compat-2015-2017?view=msvc-160), но вдруг есть нюансы.

Еще странный момент связан с установкой - никакие переменные среды не прописались. Я дополнительно запускал env.bat, но безрезультатно. Чтобы запустить какой-нибудь пример, например DRAWEXE.exe (C:\OpenCASCADE-7.5.0-vc14-64\opencascade-7.5.0\win64\vc14\bin\DRAWEXE.exe), мне пришлось вручную добавить в Path пути к Tcl/Tk (C:\OpenCASCADE-7.5.0-vc14-64\tcltk-86-64\bin), Freetype (C:\OpenCASCADE-7.5.0-vc14-64\freetype-2.5.5-vc14-64\bin) и т.д.

Если все же нужно собрать OpenCascade в VS 2019 (vc142), то откуда взять сторонние библиотеке для vc142? Есть только для vc14 (dev.opencascade.org/resources/download/3rd-party-components) или они подойдут все равно?

Дмитрий, добрый день.

1) Если мне не изменяет память, я пользовался сборками 2017-й версии при разработке под 2019-ую, и проблем не было. Но руку на отсечение не дам :)

2) Вы правильно смотрите на env.bat. Этот скрипт выставляет переменные среды, которые будут доступны в текущем терминале (то есть позвать env.bat и запустить Draw из другого терминала не получится). Попробуйте запустить draw.bat с аргументами vc14 win64 release (или debug, если собирали в дебаге). Альтернатива: скопировать все ддл-ки в директорию, откуда запускаете Draw или свое приложение. Обычно мы так и делали, чтобы не возиться с переменными среды.

3) Подойдут: https://youtu.be/MBzu0xyUdJs?t=181

Спасибо, за ответ! С собранным OpenCascade 7.5.0 VC++ 2017 64 bit (vc14) не заметил проблем на VS 2019 (vc142), но потом пересоберу OpenCascade сам, так как вышла версия 7.5.2.