- UID
- 5537
- 积分
- 371
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-5-23
- 最后登录
- 1970-1-1
|
发表于 2003-9-2 18:45:35
|
显示全部楼层
Re: [ARX函数]:求助 如何在ARX中标注尺寸
最初由 jellyfish 发布
[B]尺寸标住在ARX中怎么样来实现啊 谁能帮帮我啊 [/B]
可以用下面的代码试试,但没有出错检查。

- /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
- //| 函数名: 快速标注
- //| DimBzLine()
- //|
- //| 输入参数: ads_point pt1 起点坐标
- //| ads_point pt2 终点坐标
- //| int iTurnBz 标注位置
- //| double Dist 标注间距
- //| char *dimText 标注文本
- //|
- //| 返回: AcDbObjectId
- //| 说明: iTurnBz=1在左边标注、iTurnBz=-1在右边标注
- //|
- //| 举例: 略
- //|
- /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
- AcDbObjectId DimBzLine(ads_point pt1,ads_point pt2,int iTurnBz,double Dist,char *dimText)
- {
- ads_point pt3,temp;
- AcDbObjectId entityId;
- if (draw) {
- AcDbObjectId styleId;
- AcDbDimStyleTable *pDimStyleTbl;
- if (acdbHostApplicationServices()->workingDatabase()->
- getDimStyleTable(pDimStyleTbl,AcDb::kForRead) != Acad::eOk) {
- return 0;
- }
- //设置标注样式表
- if (pDimStyleTbl->getAt("GlhdDimStyle",styleId) != Acad::eOk) {;}
-
- if (pDimStyleTbl->close() != Acad::eOk) {
- return 0;
- }
- if (!GetAngLine(pt1,pt2,0,iTurnBz,PER,Dist,pt3,temp)) {return 0;}
-
- AcGePoint3d xLine1Point, xLine2Point,dimLinePoint;
-
- //2D点转换3D点
- PoTo3d(pt1,xLine1Point);
- PoTo3d(pt2,xLine2Point);
- PoTo3d(pt3,dimLinePoint);
- AcDbAlignedDimension *pDim = new AcDbAlignedDimension(xLine1Point,
- xLine2Point,dimLinePoint,dimText,styleId);
- AcDbBlockTable *pBlockTable;
- if (acdbHostApplicationServices()->workingDatabase()->
- getBlockTable(pBlockTable,AcDb::kForRead) != Acad::eOk) {
- return 0;
- }
- AcDbBlockTableRecord *pBlockRecord;
- pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockRecord,
- AcDb::kForWrite);
- pBlockTable->close();
- pDim->setLayer("BZ");
- pBlockRecord->appendAcDbEntity(entityId,pDim);
- pBlockRecord->close();
- pDim->close();
- }
- return entityId;
- }
|
|