admin 发表于 2024-3-16 08:57:37

AcDbRotatedDimension 旋转你角度

void makeRotatedDim(AcGePoint3d pt1, AcGePoint3d pt2, double dAngle)
{

Acad::ErrorStatus es;
AcGePoint3d ptMid = getMidPoint(pt1, pt2);// getMidPoint is one of my simple utilities
AcDbBlockTableRecord* blkRec;
AcDbDatabase *pCurDb;

pCurDb = acdbHostApplicationServices()->workingDatabase();

AcDbRotatedDimension* dim = new AcDbRotatedDimension;

dim->setXLine1Point(pt1);
dim->setXLine2Point(pt2);
dim->setRotation(dAngle);

dim->setHorizontalRotation(dAngle);
dim->useDefaultTextPosition();
dim->setDatabaseDefaults();

es = acdbOpenObject(blkRec, pCurDb->currentSpaceId(), AcDb::kForWrite);
acedAlert(acadErrorStatusText(es));

es = blkRec->appendAcDbEntity(dim);
if(es!=Acad::eOk) acutPrintf(采用T("\nError adding entity (%d)"), es);

blkRec->close();

dim->close();

return;

} // end of function makeRotatedDim()

admin 发表于 2024-3-16 08:57:45

AcDbRotatedDimension *pDim = (AcDbRotatedDimension *)pEnt;

    AcGePoint3d xLine1 = pDim->xLine1Point();
    AcGePoint3d xLine2 = pDim->xLine2Point();
    AcGePoint3d dimLine = pDim->dimLinePoint();

    bool isBlock = (xLine1 == AcGePoint3d::kOrigin && xLine2 == AcGePoint3d::kOrigin && dimLine == AcGePoint3d::kOrigin);
    if(isBlock)
    {
      // explode dimension
    }
    else
    {
      ...
    }
页: [1]
查看完整版本: AcDbRotatedDimension 旋转你角度