- UID
- 5043
- 积分
- 1347
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-5-13
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
[it618postdisplay>0]
![](source/plugin/imc_colorcode/images/loading.gif) - void TestBrep(void)
- {
- Adesk::Int32 len;
- ads_name ssname0;
- struct resbuf *buffer;
- buffer = acutBuildList(-4, _T("<AND"),
- RTDXF0, _T("3DSOLID"),
- -4, _T("AND>"), RTNONE);
- acutPrintf(_T("\nSelect a box:"));
- acedSSGet(NULL, NULL, NULL, buffer, ssname0);
- acutRelRb(buffer);
- if (RTNORM == acedSSLength(ssname0, &len))
- {
- ads_name ent;
- AcDbObjectId entId;
- for(long k = 0; k < len; k++)
- {
- acedSSName(ssname0, k, ent);
- acdbGetObjectId(entId, ent);
- settingDifferentColorToEachFace(entId);
- }
- acedSSFree(ssname0);
- }
- }
[/it618postdisplay]
![](source/plugin/imc_colorcode/images/loading.gif) -
- void settingDifferentColorToEachFace(AcDbObjectId solidId)
- {
- AcCmColor specialColor;
- AcDb3dSolid* pSolid;
- if (Acad::eOk == acdbOpenObject(pSolid, solidId, AcDb::kForRead))
- {
- AcDbFullSubentPath path(solidId, AcDbSubentId());
- AcBrBrep brep;
- AcBr::ErrorStatus bs = brep.setSubentPath(path);
- if (bs != AcBr::eOk)
- return;
- //Initialize the BrepFace traverser
- AcBrBrepFaceTraverser bft;
- bs = bft.setBrep(brep);
- if (bs != AcBr::eOk)
- return;
- AcArray<AcDbSubentId> arrSubentId;
- // Traverse all faces
- for (;!bft.done();bft.next())
- {
- AcBrFace face;
- bs = bft.getFace(face);
- if (bs != Acad::eOk)
- {
- acutPrintf(L"\ngetFace failed");
- break;
- }
- AcDbFullSubentPath Path(kNullSubent);
- AcDbSubentId subentId;
- AcBr::ErrorStatus bss = face.getSubentPath(Path);
- subentId = Path.subentId();
- arrSubentId.append(subentId);
- }
- pSolid->upgradeOpen();
- for (int i = 0; i < arrSubentId.length(); i++)
- {
- specialColor.setColorIndex(i);
- pSolid->setSubentColor(arrSubentId,specialColor);
- }
- pSolid->downgradeOpen();
- }
- pSolid->close();
- }
|
|