Open CASCADE notes

A blog about the Open Source 3D modeling kernel: notes from its former developer and project manager

Sweep surfaces
Sweep surfaces are constructed using a spine and a profile that moves along it.
Here is a screenshots of a typical sweep surfaces:



The sweep surface is constructed using GeomFill_Pipe. Perhaps the name pipe stems from the fact that a particular case when the profile is closed produces a pipe-like surface.

GeomFill_Pipe Pipe;
GeomFill_Pipe aPipe (aPath, aProfile, GeomFill_IsFixed);
aPipe.GenerateParticularCase(Standard_True);
aPipe.Perform(aTol, Standard_False, GeomAbs_C1, BSplCLib::MaxDegree(), 1000);
const Handle(Geom_Surface)& aSurface = aPipe.Surface();

This code is an excerpt from the CAD Exchanger, the translation driver for ACIS sum_spl_sur, which is defined as a sum of two curves.

By default, the sweep surface is created as a B-Spline, either rational or polynomial – depending on the parameter in the Perform() method. If you want to generate elementary surface (torus, cylinder, sphere, etc) when curves configuration allows, then call GenerateParticularCase() with Standard_True.

The algorithm can also return an approximation error – use ErrorOnSurf() to get it.

Sweeping is constructed dragging a profile along the spine and modifying its orientation along the latter. This behavior is controlled by a parameter of the type GeomFill_Trihedron. The following images illustrate how resulting surface is different for the same spine and profile (semi-circles):


GeomFill_IsFixed


GeomFill_IsFrenet


GeomFill_IsConstantNormal

You can experiment in DRAW using the 'sweep' command and providing various options.

Pipes
GeomFill_Pipe offers a few pre-defined construction techniques to construct a sweep surface:
- a pipe with constant section;
- a circular section pipe with constant radius;
- a circular section pipe with constant radius with two rails.

Pipes with constant section has been considered above. Here are two more examples of such pipes:


To be continued...
Share
Tweet
Pin
Share
4 comments
Surface modeling is a fundamental feature of any 3D geometric modeler. As you know, Open CASCADE offers a set of elementary surfaces (planar, conical, spherical, etc), Bezier and B-Spline, revolved, extruded and offset surfaces. There is also a trimmed surface which trims an underlying surface in parameter space.

Open CASCADE implements a subset of STEP (ISO standard 10303, part 42) for geometrical and topological entities, though with some minor deviations.

The surface object only contains a final geometrical representation and does not provide any information on how it was created. This differentiates it, for instance, from ACIS which uses a notion of so called procedural surfaces which may contain both a construction technique and an optional final approximation. For instance, a skin surface comes with description of a set of section curves the surface was 'skinned' through and resulting NURBS approximation. This leads to increase in number of entity types to be supported by the modeler and likely complexity of modeling algorithms that use them. (This also makes me suffer developing extra classes to represent all this variety in the CAD Exchanger translator and to translate them into Open CASCADE. I can successfully re-import all SAT files exported from Open CASCADE but not all possible SAT types yet). By the way, if there are readers who are familiar with ACIS their comments would be valuable to check how OCC capabilities compare with those of ACIS.

Open CASCADE favors different approach where knowledge of the performed modeling algorithms is stored elsewhere (e.g. in OCAF using function drivers). The B-Rep model only contains a result of an operation and thus is more compact.

Another point to make is that OCC offers algorithms both at geometry level (dealing with Geom_Surface and/or Geom_Curve objects) and topology level (TopoDS_Shape subclasses). The latter may use the former but this dual API is not always provided. Some algorithms are only available at the geometry level and some are only at topology. (If you are not certain about this distinction please make sure you re-read a series of posts earlier this year).

Let's see what modeling techniques you can use with Open CASCADE. I bet there is no point in going through description of construction techniques of elementary surfaces. Documentation and header files are just enough for that. Let's rather check what kind of advanced stuff OCC has.

Ruled surfaces
Ruled surface is constructed by connecting two curves (i.e. points along them) with lines. Particular case of a ruled surface is plane (as it can be built on two parallel lines). If you take two parallel circles then a ruled surface will be a cylinder or a cone.

Here is how it may look in general case:



Last spring, when we were in Spain and visiting Sagrada Familia in Barcelona (the central city cathedral, which is an on-going construction for several decades), there was an exhibition of Antoni Gaudi's construction techniques. Gaudi was an architect and he reused many techniques from nature. Among those there was a use of ruled surfaces – see some photos here or even read a paper 'Gaudi and CAD'.


You can create a ruled surface at geometry level as follows:
Handle(Geom_Curve) aCrv1 = ...;
Handle(Geom_Curve) aCrv2 = ...;
Handle(Geom_Surface) aSurf = GeomFill::Surface (aCrv1, aCrv2);

If you dealing at topology level you can create either a face using two edges or a shell using two wires. You need to use BRepFill:
TopoDS_Edge anEdge1 = ...;
TopoDS_Edge anEdge2 = ...;
TopoDS_Face aFace = BRepFill::Face (anEdge1, anEdge2);

TopoDS_Wire aWire1 = ...;
TopoDS_Wire aWire2 = ...;
TopoDS_Face aShell = BRepFill::Shell (aWire1, aWire2);

Here is a shell of two faces lying on ruled surfaces:



When using BRepFill::Shell(), wires must contain the same number of edges. If not you may need to re-approximate the edges. For instance you can reuse ShapeAlgo_Container::HomoWires() or create some similar algorithm, or re-approximate a wire using BRepAdaptor_CompCurve adaptor and Approx_Curve3d. The latter will produce a single B-Spline curve from a wire, which you can later use with GeomFill or create a TopoDS_Edge from of it to use BRepFill.

To be continued...
Share
Tweet
Pin
Share
5 comments
Hi folks!

It took me a few weeks to get back to writing a new post, though I keep on reading most forum posts.

First, I wanted the latest post about seminar on parallel programming and Open CASCADE to stay a bit longer to let more people notice it. There were several feedbacks from the readers, all extremely positive and supportive. Many thanks again to those who replied, that was important. However, the number was still too small to justify the event so we will have to defer it for some time. There will be free webinars by Intel so those who are interested can participate online.

Many other things have been happening during this time. First, I have changed a position in Intel. My new job is engineering management of a local team that develops Threading Building Blocks and Open MP, two run-time libraries that are aimed at facilitation of creation of multi-threaded applications. Both are part of Parallel Composer, and the former is also available in Open Source. If you had been following my recent posts, I was describing my experience with TBB, which I became a fan of.

The team is quite mature and involves senior professionals, and the technical stuff is still quite of a challenge for me, so I continue ramping up. It turned out that my earlier experiments with TBB appeared to be a good upfront investment that now starts paying off. In general, throughout my career I observe that in order to successfully manage engineers you need be a good engineer ;-). You need to speak one language with people you work with.

Second, developing the ACIS-SAT translator for CAD Exchanger has also been time-consuming. The progress has been good so far and the exporter is feature complete, while the importer is mostly complete.

There were several interesting notes while working on the ACIS translator. I have adopted the Qt test framework for unit and integration testing, and was again fascinated how effective early testing can be. Indeed, the cost of a fix for a bug found during unit testing is just a small fraction of one found by your customer a few months later. I am trying to develop a discipline of having a test case for any new functionality, or even to have a test before the code is developed. An overhead that pays off in the future.

I thought what could be interesting for you, my readers. Though there are some draft notes made during last months let me try to offer you something new. I thought to share with you some techniques on surface modeling which could be done with Open CASCADE. I had not been working with it for years and don't remember many details but touched this topic now when developing translation of ACIS surfaces. So I may need some time to gather and to structure information on this topic. Answers can be slow as I will be studying some of these issues with you ;-).

So, let me start a separate series on this...
Share
Tweet
Pin
Share
No comments
Newer Posts
Older Posts

Subscribe for the new posts

Blog Archive

  • August 2015 (2)
  • May 2014 (1)
  • November 2013 (1)
  • June 2013 (1)
  • May 2013 (1)
  • November 2012 (2)
  • November 2011 (1)
  • June 2011 (3)
  • May 2011 (2)
  • March 2011 (1)
  • February 2011 (1)
  • November 2010 (2)
  • October 2010 (2)
  • September 2010 (1)
  • August 2010 (1)
  • July 2010 (1)
  • June 2010 (1)
  • May 2010 (1)
  • April 2010 (2)
  • March 2010 (2)
  • January 2010 (2)
  • December 2009 (1)
  • November 2009 (2)
  • October 2009 (3)
  • August 2009 (2)
  • July 2009 (3)
  • June 2009 (4)
  • May 2009 (3)
  • April 2009 (2)
  • March 2009 (5)
  • February 2009 (5)
  • January 2009 (5)
  • December 2008 (11)
  • November 2008 (8)

Loading...

Followers

Created by ThemeXpose