在建模过程中,建筑师和工程师并不需要对所有构件进行三维建模,也可通过创建标准详图,以说明如何构造较大项目中的材质。详图是对项目的重要补充,因为它们显示了材质应该如何相互连接。

本节将介绍在详图中使用的以及可以通过BIMBase API访问的详图线对象。详图线对象包括直线、圆、圆弧、多段线四类,如表7-1所示。

表7-1 详图线对象

直线对象 BPModelLine
圆对象 BPModelCircle
圆弧对象 BPModelArc3d
多段线对象 BPPolyLineEntity

可通过调用相应接口创建详图线对象,示例代码7-1中通过构造函数创建了线(BPModelLine)对象,并将线添加到活动模型空间上。

BPProjectP pProject = BPApplication::getInstance().getProjectManager()->getMainProject();
if (pProject == nullptr)
    return;
BPModelBaseP pModel = pProject->getActiveModel();
if (pModel == nullptr)
    return;
//创建线对象
BPModelLine line(GePoint3d::create(3000, 3000, 0), GePoint3d::create(4000, 4000, 0));
//将对象保存到model
::p3d::P3DStatus status = line.addToProject(*pProject, pModel->getModelId());

代码7-1:详图线对象的创建

表7-2 详图线对象接口

直线对象BPModelLine Create(GePoint3dCR,GePoint3dCR,GeVec3dCR ) 创建直线对象
GetStartPoint()const 获得直线起始点
SetStartPoint(GePoint3dCR) 设置直线起始点
GetMidPoint()const 获得直线中点
GetEndPoint()const 获得直线末端点
SetEndPoint(GePoint3dCR) 设置直线末端点
GetDirection() 获得直线方向向量
圆对象BPModelCircle Create(GePoint3dCR center,GeVec3dCR normal, double radius) 创建圆对象(圆心,方向向量,半径)
GePoint3d GetCenter()const 获得圆心点
SetCenter(GePoint3dCR center) 设置圆心点
GeVec3d GetNormal()const 方向向量
double GetLength()const 获得圆周长
double GetArea()const 获得圆面积
圆弧对象BPModelArc3d Create(GePoint3dCR startPoint, GePoint3dCR middlePoint, GePoint3dCR endPoint) 创建圆弧对象(三点确定圆弧)
GePoint3d GetStartPoint()const 获得圆弧起始点
GePoint3d GetEndPoint()const 获得圆弧终止点
GePoint3d GetMidPoint()const 获得圆弧中间点
GePoint3d GetCenter()const 获得圆弧圆心点
double Length()const 获得圆弧长度
GeVec3d GetXDir()const X方向向量
GeVec3d GetYDir()const Y方向向量
GeVec3d GetNormal()const 方向向量
多段线对象BPPolyLineEntity addVertex(GePoint3d&, GePoint3d&, bool isArc, double startWidth, double endWidth) 添加点
int numVerts() 获取点的数量
getVertex(int index, GePoint3d& pt, GePoint3d& ptOhter, bool& isArc, double& startWidth, double& endWidth) 获取点的信息
clearVertexs() 清空所有点的信息
setClosed(bool closed) 设置是否闭合
bool closed() 获得是否闭合
setSegments(list& segments) 设置多段线list
getSegments(list& segments) 获得多段线list
CreatePolylineCurveVec(bool isClosed, const list&segments,vector& curveArrays) 创建多段线的GeCurveArray