OBJECT ARX总结6

转自:http://apps.hi.baidu.com/share/detail/30275471


1.     打开关闭数据库对象,实体的公共属性(颜色、线形、图层等)操作;

acdbOpenObject

setColorIndex

setLineWeight(AcDb::LineWeight::kLnWt050);设置线宽

colorIndex()

setLinetype

linetypeId()

setLinetypeScale(double newVal);

linetypeScale()

setVisibility(AcDb::Visibility newVal);

visibility()

setLayer(const char* newVal);

layer()

layerId()

2.     实体类的求交、炸开、外包矩形、变换等函数;

intersectWith()

explode()

getGeomExtents()

transformBy()

3.     曲线实体类的通用函数:最近点、起点终点存取、曲线函数中参数的概念、由参数求点/距离等函数;

getClosestPointTo

getStartPoint

getEndPoint

getPointAtParam

getDistAtParam

4.     图块的操作(纯ARX方式):插块、做块、属性块等;

acdbHostApplicationServices()->workingDatabase() ->getSymbolTable(pBlockTable, AcDb::kForWrite); 

pBlockTable->add(blockId, pBlockRecord);

pBlockTable->close();

 

AcDbBlockTableRecord *pBlockTableRec = new AcDbBlockTableRecord();

pBlockTableRec->setName("ASDK-NO-ATTR");

AcDbLine *pLine = new AcDbLine();

AcDbObjectId lineId; pLine->setStartPoint(AcGePoint3d(3, 3, 0));

pLine->setEndPoint(AcGePoint3d(6, 6, 0));

pLine->setColorIndex(3); pBlockTableRec->appendAcDbEntity(lineId, pLine);

pLine->close();

pBlockTableRec->close();

 

AcDbAttributeDefinition *pAttdef = new AcDbAttributeDefinition;

pAttdef->setPosition(basePoint);

pAttdef->setHeight(textHeight);

pAttdef->setRotation(textAngle);

pAttdef->setHorizontalMode(AcDb::kTextLeft);

pAttdef->setVerticalMode(AcDb::kTextBase);

pAttdef->setPrompt("Prompt");

pAttdef->setTextString("DEFAULT");

pAttdef->setTag("Tag");

pAttdef->setInvisible(Adesk::kFalse);

pAttdef->setVerifiable(Adesk::kFalse);

pAttdef->setPreset(Adesk::kFalse);

pAttdef->setConstant(Adesk::kFalse);

pAttdef->setFieldLength(25);

pBlockRecord->appendAcDbEntity(entityId, pAttdef);

5、ARX智能指针(AcDbObjectPointer)的使用。

此类允许使用给定的对象ID访问任何基于AcDbObject的对象。

以下为有效的预定义的类型定义:

AcDbDictionaryPointer AcDbEntityPointer 

这些类设计为对于显式使用acdbOpenObject(), acdbOpenAcDbObject()和acdbOpenAcDbEntity()进行类型安全的替换。使用这些类将导致打开和关闭对象,这在一定的环境下可能使用事务更好地管理。


你可能感兴趣的:(数据库,object,layer)