How to bulid a spiral?

How to bulid a spiral?

Roman Lygin's picture

Hi Dan,

OCC does not have a helix as a natively supported type, so you have to approximate it with a B-Spline.
This post explains how you could do that - http://opencascade.blogspot.ru/2015/08/arbitrary-law-based-curve-and-sur....

Hope this helps. Good luck!
Roman

Dan Tony's picture

Thanks

Mauro Mariotti's picture

Very interesting, Roman.

I suppose the same thing could be done with surfaces, but what about faces?
We used a modified ShapeCustom_BSplineRestriction, which wants a TopoDS_Shape, but can one make a TopoDS_Face with an adaptor?

Regards.
Mauro

Roman Lygin's picture

Hi Mauro,

True for surfaces - the blog post elaborates on that.

Not sure if I fully got the second part of the question, so let me offer two thoughts.

First, if you just need to represent a TopoDS_Face via an adaptor then you could use BRepAdaptor_Surface (which is an Adaptor3d_Surface subclass). Under the cover it effectively just uses the underlying Geom_Surface, so no real magic here.

Second, if you really want to modify the topology (e.g. solid), not just a single curve or surface then this would be closer to the so called 'space warping' - see enclosed images. That should also be possible with OCC. For that you would need to derive from BRepTools_Modification and redefine its virtual methods to implement warping.

Hope at least one of these corresponds to your inquiry. Please let me know otherwise.

Best regards,

Roman

Attachments: 
Shing Liu's picture

Use the PCurve of a surface it is easy to construct a helix curve, you can refer to:

https://github.com/eryar/occQt/wiki/Make-Helix-Shape-in-occQt

Lincoln Nxumalo's picture

Hi Roman,

Can the same approach in your blog be used for an arbitrary "equation-driven" curve? i.e. rather than having to create an adapter for each curve (helix etc.), have a single adapter which you supply parametric equation(s)?

Thanks in advance.

Regards

Lincoln

Roman Lygin's picture

Hi Lincoln,

The way you would design this is totally up to you. The only thing to provide is a subclass of Adaptor3d_Curve (or _Surface in a surface-related scenario). Whether you use multiple subsclasses (e.g. one for each curve type) or a single subclass with some evaluator inside is up to you. You just need to provide polymorphism - by redefining evaluation-related methods.

Hope this helps.

Roman

Lincoln Nxumalo's picture

Hi Roman,

Thank you for your response. I will give it a try.

Regards

Lincoln