|
//获取裁剪块的边界
static bool drawAPlineWithPropertiesFromBlockRef(AcGePoint2dArray pts, AcDbBlockReference* ref, double elevation, AcGeVector3d& normal)
{
AcDbPolyline *pl = new AcDbPolyline;
AcDbObjectId owner;
pl->setDatabaseDefaults();
pl->setClosed(Adesk::kTrue);
pl->setThickness(0.0);
if (ref != NULL)
{
owner = ref->ownerId();
pl->setPropertiesFrom(ref);
}
pl->setNormal(normal);
for (int i = 0; i < pts.length(); i++)
{
pl->addVertexAt(i, pts[i]);
}
pl->setElevation(elevation);
pl->setColorIndex(1); // Red
AcDbBlockTableRecord *rec = NULL;
acdbOpenObject(rec, owner, AcDb::kForWrite);
if (rec != NULL)
{
AcDbObjectId id;
rec->appendAcDbEntity(id, pl);
pl->close();
rec->close();
}
else
{
delete pl;
return false;
}
return true;
} |
|