objectARX说明函数(5)

2020-04-21 00:53

AcDb::kForWrite); // 生成新的图层表记录

AcDbLayerTableRecord *pLayerTableRecord = new AcDbLayerTableRecord; pLayerTableRecord->setName(LayerName); // 设置图层名 pLayerTableRecord->setColor(LayerColor); // 设置图层颜色 AcDbObjectId layerId;

pLayerTable->add(layerId,pLayerTableRecord); // 关闭图层表和图层表记录 pLayerTable->close(); pLayerTableRecord->close(); return layerId; }

//==========================================================

功能:在指定图层上新建一条直线

参数:见注释

返回:直线ID

//==========================================================

AcDbObjectId CreateLine( double x1,double y1,double z1, // 起点坐标 double x2,double y2,double z2, // 终点坐标 AcDbObjectId layer) // 直线所在图层 {

AcGePoint3d StartPt(x1,y1,z1); // 起点 AcGePoint3d EndPt(x2,y2,z2); // 终点

AcDbLine *pLine = new AcDbLine(StartPt,EndPt); // 获得当前图形数据库的符号表 AcDbBlockTable *pBlockTable;

acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlockTable,

AcDb::kForRead);

// 获得符号表中的模型空间块表记录指针,用于添加对象 AcDbBlockTableRecord *pBlockTableRecord;

pBlockTable->getAt(ACDB_MODEL_SPACE,pBlockTableRecord,AcDb::kForWrite);

pBlockTable->close();

// 将直线添加到模型空间块表记录中 AcDbObjectId lineId;

pLine->setLayer(layer,Adesk::kTrue); // 设置直线所在图层

pBlockTableRecord->appendAcDbEntity(lineId,pLine); // 关闭块表记录指针和直线指针 pBlockTableRecord->close(); pLine->close(); // 返回直线ID号 return lineId; }

不太常用的啊

已知一段弧的起点和终点以及其凸度,求其圆心

int getCenter(ads_point startPoint,ads_point endPoint,double bulge,ads_point& center)

{

if (bulge==0.0) {

ads_point_set(startPoint,center); return 0; }

ads_point startPt,endPt;

if (bulge<0.0) {

ads_point_set(endPoint,startPt); ads_point_set(startPoint,endPt); bulge=bulge*(-1.0); } else {

ads_point_set(startPoint,startPt); ads_point_set(endPoint,endPt); }

double distStartToEnd,distX,distY,radius; distStartToEnd=ads_distance(startPt,endPt); distX=distStartToEnd/2.0; distY=bulge*distX;

radius=((distX*distX)+(distY*distY))/(2.0*distY);

double tmpAng; ads_point tmpPt;

tmpAng=ads_angle(startPt,endPt); ads_polar(startPt,tmpAng,distX,tmpPt);

ads_polar(tmpPt,(tmpAng+(_PI/2.0)),(radius-distY),center); return 1;

};

create hatch的

AcDbObjectId CreateHatch( AcDbObjectId dbOId, char cLayer[],

char cPattern[] = \int nColor = 256, double dAngle = 0.0, double dScale = 1.0,

AcDbDatabase * pDbDatab = acdbHostApplicationServices()->workingDatabase())

{

AcCmColor CmC;


objectARX说明函数(5).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:(道歉信)给女友的感人道歉信范文3篇

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: