COMPASSi/trunk/code/inc/OCC/OCCLib/OCCLib.h

78 lines
2.7 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// OCCLib.h
#pragma once
#include "Stdafx.h"
enum XYZ
{
PlaneX = 1,
PlaneY,
PlaneZ
};
class OCCLib
{
public:
OCCLib();
~OCCLib();
public:
//通过4个点创建一个面自动过滤相邻的重复点
TopoDS_Face CreateFaceByPoints(gp_Pnt p1, gp_Pnt p2, gp_Pnt p3, gp_Pnt p4);
//通过三个以上创建一个边界平面,自动过滤相邻的重复点
TopoDS_Face CreatePlaneByPoints(const vector<gp_Pnt>& pSet,Standard_Boolean reverse=Standard_False); //20170601 by czb
//创建以p点为中心点的有界xy平面
TopoDS_Face CreateXYPlane(gp_Pnt p, Standard_Real l = 120, Standard_Real w = 20);
//创建以p点为中心点的有界xz平面
TopoDS_Face CreateXZPlane(gp_Pnt p, Standard_Real l = 120, Standard_Real w = 20);
//创建以p点为中心点的有界yz平面
TopoDS_Face CreateYZPlane(gp_Pnt p, Standard_Real l = 120, Standard_Real w = 20);
//创建以原点为中心点的有界平面
TopoDS_Face CreatePlane(Standard_Real d, XYZ sign,Standard_Real l = 120, Standard_Real w = 20);
//创建以p点为中心点的有界矩形面
TopoDS_Face CreateRectangle(gp_Pnt p, gp_Dir dir, Standard_Real l = 120 , Standard_Real w = 20);
//体剪切面
vector<TopoDS_Face> CutSurfaceBySolid(TopoDS_Face face, TopoDS_Solid solid);
//面剪切面
vector<TopoDS_Face> CutSurfaceBySurface(TopoDS_Face f1, TopoDS_Face f2, gp_Pnt cutPoint);
//面剪切体
vector<TopoDS_Solid> CutSolidBySurface(TopoDS_Solid solid, TopoDS_Face face, gp_Pnt cutPoint);
//获取面的面积
Standard_Real GetSurfaceArea(TopoDS_Shape face);
//获取面的周长
Standard_Real GetSurfaceRound(TopoDS_Shape face);
//获取面的形心
gp_Pnt GetSurfaceCenter(TopoDS_Shape face);
//获取面的惯性矩
Standard_Real GetSurfaceMomentOfInertia(TopoDS_Shape face, gp_Ax1 ax);
//获取面的静态惯性矩
void GetSurfaceStaticMoments(TopoDS_Shape face, Standard_Real& x, Standard_Real& y, Standard_Real&z);
//获取体的形心
gp_Pnt GetSolidCenter(TopoDS_Solid solid);
//获取体的体积
Standard_Real GetSolidVolume(TopoDS_Solid solid);
//获取体的体积
Standard_Real GetSolidMomentOfInertia(TopoDS_Solid solid, gp_Ax1 ax);
//获取体的表面积
Standard_Real GetSolidArea(TopoDS_Solid solid);
//将面旋转一定角度
TopoDS_Face SurfaceRotate(TopoDS_Face face, gp_Pnt p, gp_Dir dir, Standard_Real f);
//获取x方向的长度
double GetXLength(TopoDS_Shape shape, TopoDS_Face face);
//获取y方向的长度
double GetYLength(TopoDS_Shape shape, TopoDS_Face face);
//求交
TopoDS_Shape Section(TopoDS_Shape shape1,TopoDS_Shape shape2);
//面缝合
TopoDS_Shell SewShell(vector<TopoDS_Shape> shapeSet);
//创建以p为中心的体
TopoDS_Solid CreateSolid(gp_Pnt p, double dx, double dy, double dz);
};