149 lines
6.5 KiB
C++
149 lines
6.5 KiB
C++
#if !defined(__TAUXTOOLS_H__)
|
|
#define __TAUXTOOLS_H__
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif // _MSC_VER > 1000
|
|
|
|
#include "dbpl.h"
|
|
#include <sstream>
|
|
#include "AecDbObjXDataMap.h"
|
|
#include "AcGiDraw.h"
|
|
#include "AecComplexCurveDraw.h"
|
|
|
|
class AecComplexCurve;
|
|
|
|
class TAuxTools
|
|
{
|
|
public:
|
|
|
|
// 求中点
|
|
static AcGePoint3d Mid(AcGePoint3d ptGe1, AcGePoint3d ptGe2);
|
|
|
|
// 从圆得到投影到过ptCenter点的某个面的半个或整个椭圆多段线,两圆模拟法
|
|
// ptCenter:原圆心, dDia:原圆直径, vtOrigNormal:原圆法向
|
|
// vtNewNormal::投影面的法向,polyLine得到的多段线
|
|
// vtGet:指示返回哪半个部分, 默认返回整个
|
|
// 返回值:-1, 求椭圆时出错,0新旧法向平行,圆形 1:新旧法向垂直,直线 2;正常情况,椭圆
|
|
// Lixl 2011-11-24 10:53 重写了此函数,如果投影为椭圆,则返回polyline线是连续的线段,而不是之前的三个弧,投影为圆和直线保持不变
|
|
static int GetEllipseFromCircle(AcGePoint3d ptCenter, double dDia, AcGeVector3d vtOrigNormal,
|
|
AcGeVector3d vtNewNormal, AcDbPolyline &polyLine, AcGeVector3d vtGet = AcGeVector3d::kIdentity);
|
|
static void GetArcPoint(AcDbPolyline &polyLine, AcGePoint3dArray &ptArcArr);
|
|
|
|
static BOOL GetPrjPtsFromCircle(AcGePoint3dArray& ptArr, AcGePoint3dArray& arPtJudge);
|
|
|
|
// 功能: 得到圆截面向平面投影后,投影曲线的焦点
|
|
// [OUT]: arPtsOnCurve椭圆返回7个点,直线3个点,圆5个点
|
|
static int GetEllipsePtsFromCircle(AcGePoint3dArray& arPtsOnCurve, AcGePoint3d ptCenter, double dDia, AcGeVector3d vtOrigNormal,
|
|
AcGeVector3d vtNewNormal, AcDbPolyline &polyLine, AcGeVector3d vtGet = AcGeVector3d::kIdentity);
|
|
|
|
static void Poly2CurveSeg(AcDbPolyline* pLine, std::vector<AcGeCurve3d*>& segComs);
|
|
|
|
// 判断向量是否是倾斜向量(不垂直Z轴,也不平行于Z轴)
|
|
static BOOL IsIncline(AcGeVector3d& vt);
|
|
|
|
//合并两条Pline线第一个参数为添加后的Pline。
|
|
static BOOL MergerPline(AcDbPolyline* pPl, AcDbPolyline* pSrc);
|
|
//同线三点,判断ptBase在ptSta和ptEnd哪个位置。
|
|
static int PositionOnLine(AcGePoint3d ptSta, AcGePoint3d ptEnd, AcGePoint3d ptBase);
|
|
static BOOL isCodirectionalPt(AcGePoint3d ptSta, AcGePoint3d ptEnd, AcGeVector3d vtBase);
|
|
static AcGePlane GetHidePlane(AcGePoint3d pt1, AcGePoint3d pt2, AcGePoint3d pt3, AcGeVector3d vtNormal, double &dEle);
|
|
static BOOL InsertBlock(AcDbVoidPtrArray& entitySet,AcDbObjectId idBlock, AcGePoint3d ptBase, AcGeScale3d ScaleFactor, double dAngle = 0.0);
|
|
static BOOL GetIntersectWith(AcGePoint3d pt1, AcGePoint3d pt2, AcGePoint3d pt3, AcGePoint3d pt4, AcGePoint3d& ptIntersect);
|
|
static int Getquadrant(AcGePoint3d ptCenter, AcGePoint3d pt, AcGeVector3d vtMain, AcGeVector3d vtNormal = AcGeVector3d::kZAxis);
|
|
|
|
// 用户XYZ坐标向量
|
|
static AcGeVector3d GetUcsXvt();
|
|
static AcGeVector3d GetUcsYvt();
|
|
static AcGeVector3d GetUcsZvt();
|
|
|
|
// 获得当前数据库字体样式表
|
|
static void GetAllTextStyleNameArray(CStringArray& arTextStyle);
|
|
|
|
// 获取最小分度角(曲面分化成小平面,相邻平面法向量间最小夹角)
|
|
static double GetMinDiffAngle();
|
|
|
|
// 构造包含点集的最小长方体
|
|
static void BuildMinRectangle(const AcGePoint3dArray& arpt, AcDbExtents& ext);
|
|
|
|
static void BuildRecFace(const AcGePoint3d& pt, const double dWidth, const double dThick, const AcGeVector3d& vtNormal,
|
|
const AcGeVector3d& vtFaceNormal, AcDbVoidPtrArray& dbPtArr);
|
|
|
|
static void BuildCirFace(const AcGePoint3d& pt, const double dDiameter, const AcGeVector3d& vtNormal,
|
|
const AcGeVector3d& vtFaceNormal, AcDbVoidPtrArray& dbPtArr);
|
|
|
|
// 是否联动取值,包括位移、连接、尺寸
|
|
static BOOL IsAutoWorkOffset();
|
|
static BOOL IsAutoWorkConnect();
|
|
static BOOL IsAutoWorkSize();
|
|
|
|
// 获取面标高
|
|
static double GetPlaneEle( const AcGePlane &plan );
|
|
|
|
// 通过id获取文字样式名
|
|
static TCHAR* GetFontStyle(AcDbObjectId idTextStyle);
|
|
|
|
// 当前视图是不是二维的
|
|
static BOOL Is2DView();
|
|
|
|
// 按指定的精度转换double到字符串
|
|
static void DoubleToString(double dValue, int nPreci, CString &csValue);
|
|
|
|
static void Matrix3D2String( const AcGeMatrix3d &mat, CString &str );
|
|
|
|
// 取得用于剖切的图块ID,比例和图块范围方块 add by hh 2011-02-14
|
|
// idSrc:原始图块ID vtNor:法向量 vtMain:主方向 vtPlaneSec:剖切方向
|
|
// scale:输入实体与原始图块的比例,输出新比例 pExt:新图块范围 返回新图块ID
|
|
static AcDbObjectId GetProjBlockId(const AcDbObjectId& idSrc, AcGeVector3d vtNor,
|
|
AcGeVector3d vtMain, AcGeVector3d vtPlaneSec, AcGeScale3d& scale, AcDbExtents* pExt = NULL);
|
|
|
|
// 计算圆弧曲率
|
|
static double CalCurvature(const AcGePoint3d& pt1, const AcGePoint3d& pt2,
|
|
const AcGePoint3d& pt3, const AcGeVector3d* pVtNor);
|
|
|
|
//add by wc 13-12-16//
|
|
// 通过id得到图块名称
|
|
static LPCTSTR GetBlkNameById (AcDbObjectId id);
|
|
|
|
// 是否与Z轴垂直的直线
|
|
static BOOL IsVerticalLine(AcGePoint3d pt1, AcGePoint3d pt2);
|
|
|
|
private:
|
|
// 圆管沿程阻力 dFricCoef摩擦系数, dDia直径(mm), dLength:管长, dDensity密度 dVelocity流速(m/s)
|
|
static double CalCircleFricLoss(double dFricCoef, double dDia, double dLength,
|
|
double dDensity, double dVelocity);
|
|
|
|
// 摩擦系数:根据粗糙度(mm)、流速当量直径(mm)和雷诺数计算 用柯列勃洛克-怀特公式计算
|
|
static double CalFricCoef(double dRough, double dCalDia, double dRe);
|
|
|
|
// 根据管宽(mm)和管高(mm)计算流速当量直径(mm)
|
|
static double CalVelDia(double dWidth, double dHeight);
|
|
|
|
// 流速(m/s)、流速当量直径(mm)和黏度(m^2/s)计算雷诺数
|
|
static double CalRe(double dVelocity, double dVelDia, double dMoveVis) ;
|
|
|
|
// 根据温度计算空气密度
|
|
static double CalDesity(double dTemperature);
|
|
|
|
// 根据温度计算运动黏度
|
|
static double CalMoveVis(double dTemperature);
|
|
|
|
// 用插值法从一维表格中取值
|
|
static double CalTable(double dAbscissa[], double *pTable, double dX, int m);
|
|
|
|
static int CalPosBy3Point(const AcGePoint3d& pt1, const AcGePoint3d& pt2, const AcGePoint3d& pt3);
|
|
|
|
public:
|
|
|
|
// add by dyc on 2014-01-21 解决Y型三通在比较大坐标值情况下以后后变成T型问题,求两圆交点
|
|
static BOOL CircleInsertWith(const AcGeCircArc3d& circleS, const AcGeCircArc3d& circleE,
|
|
AcGePoint3d& ptInter1, AcGePoint3d& ptInter2);
|
|
|
|
// 字符串拆分
|
|
static int StrTokenize(LPCTSTR pszSrc, LPCTSTR pszDelimit, CStringArray& arSubs);
|
|
|
|
static double GetBulge(AcGePoint3d ptStart, AcGePoint3d ptMid, AcGePoint3d ptEnd);
|
|
};
|
|
|
|
#endif // !defined(__TAUXTOOLS_H__)
|