找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 189|回复: 1

AcDbRotatedDimension 旋转你角度

[复制链接]

0

主题

0

回帖

26

积分

管理员

积分
26
发表于 2024-3-16 08:57:37 | 显示全部楼层 |阅读模式
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()

0

主题

0

回帖

26

积分

管理员

积分
26
 楼主| 发表于 2024-3-16 08:57:45 | 显示全部楼层
  1. AcDbRotatedDimension *pDim = (AcDbRotatedDimension *)pEnt;
  2.     AcGePoint3d xLine1 = pDim->xLine1Point();
  3.     AcGePoint3d xLine2 = pDim->xLine2Point();
  4.     AcGePoint3d dimLine = pDim->dimLinePoint();
  5.     bool isBlock = (xLine1 == AcGePoint3d::kOrigin && xLine2 == AcGePoint3d::kOrigin && dimLine == AcGePoint3d::kOrigin);
  6.     if(isBlock)
  7.     {
  8.         // explode dimension
  9.     }
  10.     else
  11.     {
  12.         ...
  13.     }
复制代码
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|膜结构网

GMT+8, 2024-12-27 23:00 , Processed in 0.142410 second(s), 23 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表