OpenCASCADE does not provide helix curve directly, but you can build a helix curve by the pcurve of a surface(curve on surface). When you understand the pcurve of a surface, you can make a helix curve easily.
To try the idea quickly, Let's first make a helix by Tcl in Draw Test Harness, then translate the Tcl script to OpenCASCADE C++ code for occQt.
2.Helix Equation
Helix shape is very common shapes, such as the spiral staircase, drill, .etc. The helix curve parametric equation as follows:
And the Helix curve is like this:
But OpenCASCADE does not support the parametric equation like this, of course you can inherit Geom_Curve to make a Geom_HelixCurve, maybe the method is a little complicated. You can also use the pcurve to make the helix easily. Use pcurve on different surface will produce very interesting curves, I will try this in the Draw Test Harness by Tcl first.
3. Make Helix Curve in the Draw Test Harness
3.1 PCurve on Cylindrical Surface
The first example is a pcurve(line) on a cylindrical surface, this pcurve will produce a normal helix curve, ie. a spring, the Tcl script to test it in Draw Test Harness:
#
# make helix curve in OpenCASCADE.
# Shing Liu(eryar@163.com)
#2015-07-08 22:00
#
pload MODELING VISUALIZATION
cylinder aCylinder 6
line aLine2d 0 0 1 1
trim aSegment aLine2d 0 2*pi
mkedge aHelixEdge aSegment aCylinder 0 6*pi
vdisplay aHelixEdge
Save the above Tcl script to d:/tcl/helix.tcl, and load it in the Draw Test Harness, the result is:
And different slope of the pcurve(line) will cause different pitch of the helix:
when the slope k = 1, the pcurve is
line aLine2d 0 0 1 1
when the slope k = 1.0/5.0, the pcurve is:
line aLine2d 0 0 5 1
when the slope k = 1.0/10.0, the pcurve is:
line aLine2d 0 0 10 1
You can modify the pcurve slope to have a test. Finally you can sweep a circle along the helix curve to get a solid shape:
3.2 PCurve on Conical Surface
The same pcurve on conical surface will get the following result:
3.3 PCurve on Toroidal Surface
When the pcurve in on toroidal surface, you will get the the follow result:
Different slope also can cause different pitch:
Also you can sweep a circle along the helix curve to get a solid shape:
Tcl script list below:
#
# make helix torus(Ring Type Spring) in OpenCASCADE.
# Shing Liu(eryar@163.com)
#2016-02-20 21:00
#
pload MODELING VISUALIZATION
# use torus surface.
torus aTorus 10 2
set aSlope 0.05
line aLine2d 0 0 $aSlope 1
trim aSegment aLine2d 0 2*pi
# make edge by the pcurve.
mkedge aHelixEdge aSegment aTorus 0 2*pi/$aSlope
# there is no curve 3d in the pcurve edge.
# so need this to approximate one.
mkedgecurve aHelixEdge 0.01
wire aHelixWire aHelixEdge
# make the profile.
circle aProfile 12 0 0 1 1 1 0.3
mkedge aProfile aProfile
wire aProfile aProfile
mkplane aProfile aProfile
# display the profile.
vdisplay aProfile aHelixEdge
# loft the circle along the helix curve.
pipe aSpring aHelixWire aProfile
# display the result.
vdisplay aSpring
#vsetmaterial aSpring steel
vsetgradientbg 180 200 255 180 180 180 2
vsetdispmode 1
vzbufftrihedron
set ray tracing
if { ! [catch {vrenderparams -raytrace -shadows -reflections -fsaa -rayDepth 5}] } {
vtextureenv on 1
}
4.Conclusion
PCurve is a powerful modeling method, to make helix shapes in occQt to help you understand pcurve better, then you can also can model some intereting shape based on pcurve.
I will translate the above Tcl scripts to C++ in occQt soon.
5. References
5.1 OpenCASCADE Make Bottle Tutorial. 2016
5.2 OpenCASCADE BRep Format. 2016
5.3 OpenCASCADE Draw Test Harness User Guide. 2016
Make Helix Shape in occQt
1.Introduction
OpenCASCADE does not provide helix curve directly, but you can build a helix curve by the pcurve of a surface(curve on surface). When you understand the pcurve of a surface, you can make a helix curve easily.
To try the idea quickly, Let's first make a helix by Tcl in Draw Test Harness, then translate the Tcl script to OpenCASCADE C++ code for occQt.
2.Helix Equation
Helix shape is very common shapes, such as the spiral staircase, drill, .etc. The helix curve parametric equation as follows:
And the Helix curve is like this:
But OpenCASCADE does not support the parametric equation like this, of course you can inherit Geom_Curve to make a Geom_HelixCurve, maybe the method is a little complicated. You can also use the pcurve to make the helix easily. Use pcurve on different surface will produce very interesting curves, I will try this in the Draw Test Harness by Tcl first.
3. Make Helix Curve in the Draw Test Harness
3.1 PCurve on Cylindrical Surface
The first example is a pcurve(line) on a cylindrical surface, this pcurve will produce a normal helix curve, ie. a spring, the Tcl script to test it in Draw Test Harness:
Save the above Tcl script to d:/tcl/helix.tcl, and load it in the Draw Test Harness, the result is:
And different slope of the pcurve(line) will cause different pitch of the helix:
You can modify the pcurve slope to have a test. Finally you can sweep a circle along the helix curve to get a solid shape:
3.2 PCurve on Conical Surface
The same pcurve on conical surface will get the following result:
3.3 PCurve on Toroidal Surface
When the pcurve in on toroidal surface, you will get the the follow result: Different slope also can cause different pitch:
Also you can sweep a circle along the helix curve to get a solid shape:
Tcl script list below:
4.Conclusion
PCurve is a powerful modeling method, to make helix shapes in occQt to help you understand pcurve better, then you can also can model some intereting shape based on pcurve.
I will translate the above Tcl scripts to C++ in occQt soon.
5. References