Files
envi-code/SourceCode/Code2026/tg_shs/inc/TArch/DbPolyMesh.h
T
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

121 lines
5.1 KiB
C++

//******************************************************************//
// 目前仅支持一个(路径曲面)、两个和三个截面 //
// 所有截面m_lstShapePoly都在XY平面,即在z值相同,且封闭 //
// 设置基点:1-截面的重心; //
// 2-截面的形心(GetExtend的中心); //
// 3-指定基点即设置截面的基点; //
// 他们依次与截面相对应,即第i个截面的贯穿点 //
// 截面位置:除首末截面外的截面需给定位置,m_lstDistScale,即 //
// 从路径开始端到截面长度/路径总长度 //
//******************************************************************//
#ifndef __DBPOLYSMESH_H
#define __DBPOLYSMESH_H
#include "DbCurveMesh.h"
#include "PolyMeshTool.h"
class TARCH_EXP TDbPolyMesh: public TDbCurveMesh {
DECLARE_TENTBASE();
ACRX_DECLARE_MEMBERS(TDbPolyMesh);
public:
TDbPolyMesh();
~TDbPolyMesh();
public:
//截面链表长度-2==截面位置链表长度,基点链表长度==截面链表长度
virtual BOOL IsValid() const;
virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const;
virtual Acad::ErrorStatus dwgInFields (AcDbDwgFiler*);
virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler*) const;
virtual Acad::ErrorStatus dxfInFields (AcDbDxfFiler*);
virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler*) const;
virtual Acad::ErrorStatus subTransformBy(const AcGeMatrix3d& xform);
virtual Acad::ErrorStatus GetGripText(int i, CString &cs) const;
virtual Acad::ErrorStatus subGetGripPoints(AcGePoint3dArray& gripPoints,
AcDbIntArray& osnapModes,
AcDbIntArray& geomIds) const;
virtual Acad::ErrorStatus subMoveGripPointsAt(const AcDbIntArray& indices,
const AcGeVector3d& offset);
virtual Acad::ErrorStatus ExplodeOrDraw3d(XExplodeDraw &dc) const;
virtual Acad::ErrorStatus ExplodeOrDraw2d(XExplodeDraw &dc) const;
virtual int GetFirstVersion()const{return 6;}//ok
virtual void GetTips(DList<TObjInfoUnit> &) const;
Acad::ErrorStatus DrawShapeBases(XExplodeDraw &dc) const;//断面显示
Acad::ErrorStatus DrawShapePolys(XExplodeDraw &dc) const;//基点显示
//在XY平面上的轮廓(目前不支持3个截面以上的)
//仅在m_vtNormal(0,0,1)时
void GetOutlinePoly(ads_real dZ, XPoly2D &poly) const;
int GetShapeNum() const;//截面总数
//Methos
public:
//除第一个截面以外的截面
void SetShapePolys(const DList<XPoly2D>& lstShapePoly);//要求都在XY平面,且封闭
void GetShapePolys(DList<XPoly2D>& lstShapePoly) const;
//所有的的截面,此时不用再SetShapePoly(const XPoly2D &newShape);
void SetAllShapePolys(const DList<XPoly2D>& lstShapePoly);//要求都在XY平面,且封闭
void GetAllShapePolys(DList<XPoly2D>& lstShapePoly) const;
//除第一个截面和最后一个截面以外的其他截面在路径上的位置(个数是截面数-2)
//(和路径长度的比,都 0<dist<1,且依次增大)
void SetDistScales(const DList<double>& lstDist);
void GetDistScales(DList<double>& lstDist) const;
//指定基点函数
void SetWeightCenterAsShapeBases();//1--重心
void SetCenterAsShapeBases(); //2--形心(GetExtend的中点)
void SetShapeBases(const DList<XPoint>& lstShapeBase);//3 -- 指定基点
//3 -- 指定基点,包括父类的m_ptShapeBase,不再调用父类的设置基点函数
void SetAllShapeBases(const DList<XPoint>& lstShapeBase);
void GetShapeBases(DList<XPoint>& lstShapeBase) const;
void GetAllShapeBases(DList<XPoint>& lstShapeBase) const;//包括父类的m_ptShapeBase
// 工程量
public:
void GetAllShapeArea(DList<double>& lstArea) const;
void GetShapeArea(DList<double>& lstArea) const;
void GetAllShapePerimeter(DList<double>& lstPerimeter) const;
void GetShapePerimeter(DList<double>& lstPerimeter) const;
// double GetSideArea() const;//未完成
// double GetVolume() const;//未完成
protected:
DList<XPoly2D> m_lstShapePoly;
DList<XPoint> m_lstShapeBase;
//除第一个截面和最后一个截面以外的其他截面在路径上的位置(个数是截面数-2)
DList<double> m_lstDistScale;//(和总路径长度的比)
protected:
//网格参数(目前不支持3个截面以上的,采用线性、二次插值)
BOOL GetSurfaceMesh(int &nRows,int &nCols,XPoint* &pPtArray) const;
BOOL AppendToMesh(const XContour3D& shape,
const int nTotalVertex,
XVector3D &vtAlignment,
XPoint* &pPtArray,
int &nPtArrayIndex) const;
double Angle(const XPoint& from,const XPoint& to1,const XPoint& to2) const;//夹角
double Parabola(double Z,double Z1,double Z2,double Z3,
double R1,double R2,double R3) const;//二次插值(抛物线法)
private:
const static Adesk::UInt8 g_nVersion;
public:
// 当重构TDPtrList后,tch_com17会出现STD链接错误,故在这里封装接口避开。以后令行解决。
#if ADS == 17
XPoint GetAllShapeBasesByIndex(int idx);
double GetAllShapePerimeterByIndex(int idx);
double GetAllShapeAreaByIndex(int idx);
void SetAllShapeBasesByIndex(int idx, XPoint pt);
#endif
};
#endif