- 积分
- 39624
- 明经币
- 个
- 注册时间
- 2006-8-18
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2014-12-16 14:59:47
|
显示全部楼层
给你一段示例代码:
- // - Algorithms._HHH command (do not rename)
- static void Algorithms_TestHatch(void)
- {
- int ret;
- ads_name sel,ent;
- resbuf filter;
- filter.restype = 0;
- filter.resval.rstring = _T("LWPOLYLINE,POLYLINE,CIRCLE,ELLIPSE");
- filter.rbnext = NULL;
- ret = acedSSGet(NULL,NULL,NULL,&filter,sel);
- if (ret == RTNORM)
- {
- long n;
- AcDbObjectId id;
- AcDbObjectIdArray ids;
- AcDbObjectPointer<AcDbHatch> hatch;
- hatch.create();
- hatch->setPatternScale(5);
- hatch->setPattern(AcDbHatch::kPreDefined,_T("ANSI31"));
- hatch->setHatchStyle(AcDbHatch::kNormal);
- acedSSLength(sel,&n);
- for (int i=0;i<n;i++)
- {
- acedSSName(sel,i,ent);
- acdbGetObjectId(id,ent);
- ids.append(id);
- hatch->appendLoop(AcDbHatch::kDefault,ids);
- hatch->evaluateHatch();
- ids.setLogicalLength(0);
- }
- //取消如下注释,以设置你的标高和法线之类以及填充关联(需要反应器)
- //hatch->setNormal(AcGeVector3d(0,0,1));
- //hatch->setElevation(0);
- //hatch->setAssociative(false);
- AcDbBlockTableRecordPointer curSpace(acdbCurDwg()->currentSpaceId(),AcDb::kForWrite);
- Acad::ErrorStatus es = curSpace->appendAcDbEntity(hatch.object());
- if (es != Acad::eOk)
- {
- acutPrintf(_T("\n创建填充失败!"));
- }
- }
- }
|
|