本文主要是介绍Open CASCADE学习|环形弹簧建模,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
目录
Draw Test Harness:
C++:
环形弹簧,也称为弓簧,是由拉伸弹簧和连接弹簧构成的。在结构上,环形弹簧通常包括端环、外环和内环,其主要参数包括弹簧的内径、外径和自由高度。环形弹簧的一个显著特点是,当承受轴向压缩载荷时,各圆环会沿圆锥面相对滑动,导致整个弹簧产生轴向变形。
环形弹簧的一个主要特性是,与其他各种弹簧相比,它几乎只产生纯压缩和拉伸应力,因此其单位体积材料的变形能要较其他弹簧大得多。这使得环形弹簧特别适用于空间尺寸受限制,但需要吸收大量能量和强力缓冲的场合,例如铁道车辆的链接部分、受强大冲击的缓冲装置、大型管道的吊架和大容量电流遮断器的固定支承等。
在环形弹簧的制造过程中,会先使用专用胎夹具夹紧拉伸弹簧的一端并旋入连接弹簧,然后将拉伸弹簧的另一端旋转后套入连接弹簧的另一端,最后利用回转力将连接弹簧旋接在拉伸弹簧的内部,从而构成环形弹簧。
Draw Test Harness:
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
}
C++:
#include <Geom_ToroidalSurface.hxx>
#include <gp_Lin2d.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <GCE2d_MakeSegment.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepLib.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <Geom_Circle.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepOffsetAPI_MakePipe.hxx>
#include <TopoDS.hxx>
#include"Viewer.h"
int main(int argc, char* argv[])
{gp_Ax3 loc = gp_Ax3(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1), gp_Dir(1, 0, 0));Handle(Geom_ToroidalSurface) aTorus =new Geom_ToroidalSurface(loc, 10, 2);gp_Lin2d aLine2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(0.05, 1.0));Handle(Geom2d_TrimmedCurve) aSegment = GCE2d_MakeSegment(aLine2d, 0.0, M_PI * 2.0);TopoDS_Edge aHelixEdge = BRepBuilderAPI_MakeEdge(aSegment, aTorus, 0.0, 2.0 * M_PI/0.05);BRepLib::BuildCurves3d(aHelixEdge,0.01);BRepBuilderAPI_MakeWire aHelixWire;aHelixWire.Add(aHelixEdge);Handle(Geom_Circle) aProfile = new Geom_Circle(gp_Ax2(gp_Pnt(12, 0, 0), gp_Dir(1, 1, 1)), 0.3);TopoDS_Edge aProfilee = BRepBuilderAPI_MakeEdge(aProfile);BRepBuilderAPI_MakeWire aProfilew;aProfilew.Add(aProfilee);TopoDS_Shape aProfilef = BRepBuilderAPI_MakeFace(aProfilew);BRepOffsetAPI_MakePipe aSpring(TopoDS::Wire(aHelixWire), aProfilef, GeomFill_IsCorrectedFrenet, Standard_False);TopoDS_Shape Spring = aSpring.Shape();Viewer vout(50, 50, 500, 500);vout << aHelixWire;vout << aProfilef;vout << Spring;vout.StartMessageLoop();return 0;
}
这篇关于Open CASCADE学习|环形弹簧建模的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!