天气与日历 切换到窄版

 找回密码
 立即注册
中国膜结构网
十大进口膜材评选 十大国产膜材评选 十大膜结构设计评选 十大膜结构公司评选
查看: 28|回复: 0

arx 获取三维实体边、面,并高亮

[复制链接]
  • TA的每日心情
    开心
    昨天 11:26
  • 签到天数: 86 天

    [LV.6]常住居民II

    1640

    主题

    207

    回帖

    214748万

    积分

    管理员

    积分
    2147483647
    发表于 2024-5-4 18:13:31 | 显示全部楼层 |阅读模式
    1. void
    2. highlightEdge(const AcDbObjectId& objId, const int marker)
    3. {
    4.     TCHAR dummy[133]; // space for acedGetStringB pauses below

    5.     AcDbEntity *pEnt;
    6.     acdbOpenAcDbEntity(pEnt, objId, AcDb::kForRead);
    7.     AcGePoint3d pickpnt;
    8.     AcGeMatrix3d xform;
    9.     int numIds;
    10.     AcDbFullSubentPath *subentIds;
    11.     pEnt->getSubentPathsAtGsMarker(AcDb::kEdgeSubentType,
    12.         marker, pickpnt, xform, numIds, subentIds);

    13.     // At this point the subentId's variable contains the
    14.     // address of an array of AcDbFullSubentPath objects.
    15.     // The array should be one element long, so the picked
    16.     // edge's AcDbFullSubentPath is in subentIds[0].
    17.     //
    18.     // For objects with no edges (such as a sphere), the
    19.     // code to highlight an edge is meaningless and must
    20.     // be skipped.
    21.     //
    22.     if (numIds > 0) {
    23.         // Highlight the edge.
    24.         //
    25.         pEnt->highlight(subentIds[0]);

    26.         // Pause to let user see the effect.
    27.         //
    28.         acedGetString(0, _T("\npress <RETURN> to continue..."),
    29.             dummy);

    30.         // Unhighlight the picked edge.
    31.         //
    32.         pEnt->unhighlight(subentIds[0]);

    33.         // Get a copy of the edge, and add it to the database.
    34.         //
    35.         AcDbEntity *pEntCpy = pEnt->subentPtr(subentIds[0]);
    36.         AcDbObjectId objId;
    37.         addToModelSpace(objId, pEntCpy);

    38.     }
    39.     delete []subentIds;

    40.     pEnt->close();
    41. }
    42. void
    43. highlightFaces(const AcDbObjectId& objId, const int marker)
    44. {
    45.     TCHAR dummy[133];

    46.     AcDbEntity *pEnt;
    47.     acdbOpenAcDbEntity(pEnt, objId, AcDb::kForRead);

    48.     // Get the subentIds for the faces.
    49.     //
    50.     AcGePoint3d pickpnt;
    51.     AcGeMatrix3d xform;
    52.     int numIds;
    53.     AcDbFullSubentPath *subentIds;
    54.     pEnt->getSubentPathsAtGsMarker(AcDb::kFaceSubentType,
    55.         marker, pickpnt, xform, numIds, subentIds);

    56.     // Walk the subentIds list, highlighting each face subentity.
    57.     //
    58.     for (int i = 0;i < numIds; i++) {
    59.         pEnt->highlight(subentIds[i]); // Highlight face.

    60.         // Pause to let the user see the effect.
    61.         //
    62.         acedGetString(0, _T("\npress <RETURN> to continue..."),
    63.             dummy);

    64.         pEnt->unhighlight(subentIds[i]);
    65.     }
    66.     delete []subentIds;
    67.     pEnt->close();
    68. }
    69. void
    70. highlightAll(const AcDbObjectId& objId)
    71. {
    72.     TCHAR dummy[133];

    73.     AcDbEntity *pEnt;
    74.     acdbOpenAcDbEntity(pEnt, objId, AcDb::kForRead);

    75.     // Highlight the whole solid.
    76.     //
    77.     pEnt->highlight();

    78.     // Pause to let user see the effect.
    79.     //
    80.     acedGetString(0, _T("\npress <RETURN> to continue..."),
    81.         dummy);

    82.     pEnt->unhighlight();
    83.     pEnt->close();
    84. }


    85. Acad::ErrorStatus
    86. addToModelSpace(AcDbObjectId &objId, AcDbEntity* pEntity)
    87. {
    88.     AcDbBlockTable *pBlockTable;
    89.     AcDbBlockTableRecord *pSpaceRecord;

    90.     acdbHostApplicationServices()->workingDatabase()
    91.         ->getSymbolTable(pBlockTable, AcDb::kForRead);

    92.     pBlockTable->getAt(ACDB_MODEL_SPACE, pSpaceRecord,
    93.         AcDb::kForWrite);

    94.     pSpaceRecord->appendAcDbEntity(objId, pEntity);

    95.     pBlockTable->close();
    96.     pEntity->close();
    97.     pSpaceRecord->close();

    98.     return Acad::eOk;
    99. }
    复制代码

     

     

     

     

    arx 获取三维实体边、面,并高亮
    中国膜结构网打造全中国最好的膜结构综合平台 ,统一协调膜结构设计,膜结构施工,膜材采购,膜材定制,膜结构预算全方位服务。 中国空间膜结构协会合作单位。
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|Archiver|手机版|中国膜结构网_中国空间膜结构协会

    GMT+8, 2024-6-2 08:34 , Processed in 0.057150 second(s), 21 queries .

    Powered by Discuz! X3.5

    © 2001-2024 Discuz! Team.

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