【MS CE C++】如何获取MS里面一个立方体的拓扑结构信息

如题,请问如何获取MS里面一个立方体的拓扑结构信息?

我再MS CE版本的开发文档里面看到,关于实体元素,ISolidKernelEntity represents a boundary representation body (BRep).

如下:

我想请问,如何获取拓扑关系?“”The topology is the faces, edges, and vertices that describe how the geometry is connected.“”

我试过

ECX ITEMS DUMP

并没有找到哪里有拓扑关系的描述?

求指教~谢谢~~~

  • 你在MS SDK目录下的PSolidCoreAPI.h中的struct TopologyID结构体,可以找到相关信息。

  • 感谢,找到了一些拓扑信息;

    请问有没有样例代码供参考?我之前没有写过Solid相关的代码。在SDK的example中没有找到TopologyID相关的内容。

    谢谢~~

    Work smart, not just work hard!

  • UInt32 highestNodeId;

    UInt32 lowestNodeId;

    BentleyStatus status = SolidUtil::TopologyID::FindNodeIdRange(*srcSolid, highestNodeId, lowestNodeId);

    if (SUCCESS == status)

    {

    WPrintfString wStr(L"highestNodeId = %ld, lowestNodeId = %ld", highestNodeId, lowestNodeId);

    mdlDialog_dmsgsPrint(wStr.GetWCharCP());

    }

    UInt32 nodeId = 33;

    bool overrideExisting = false;

    status = SolidUtil::TopologyID::AddNodeIdAttributes(*srcSolid, nodeId, overrideExisting);

    if (SUCCESS == status)

    {

    /*--------------------------------------------------------

    | SolidUtil::TopologyID::FindNodeIdRange Xiaoqi.Zhang

    +-------------------------------------------------------*/

    status = SolidUtil::TopologyID::FindNodeIdRange(*srcSolid, highestNodeId, lowestNodeId);

    if (SUCCESS == status)

    {

    WPrintfString wStr(L"After DeleteNodeIdAttributes, the highestNodeId = %ld, lowestNodeId = %ld", highestNodeId, lowestNodeId);

    mdlDialog_dmsgsPrint(wStr.GetWCharCP());

    }

    }

  • /*--------------------------------------------------------

    | SolidUtil::TopologyID::IncrementNodeIdAttributes Xiaoqi.Zhang

    +-------------------------------------------------------*/

    case eIncrementNodeIdAttributes:

    {

    //! Increment the topology ids for all faces of the given body. Used to avoid nodeId conflicts between target and tool bodies.

    //! @param[in,out] entity The body to modify.

    //! @param[in] increment The topology node id in each nodeId-entityId pair will be incremented by this amount.

    //! @return SUCCESS if ids could be incremented.

    //PSOLIDCORE_EXPORT static BentleyStatus IncrementNodeIdAttributes(ISolidKernelEntityR entity, Int32 increment);

    Int32 increment = 100;

    BentleyStatus status = SolidUtil::TopologyID::IncrementNodeIdAttributes(*srcSolid, increment);

    if (SUCCESS == status)

    {

    UInt32 highestNodeId;

    UInt32 lowestNodeId;

    status = SolidUtil::TopologyID::FindNodeIdRange(*srcSolid, highestNodeId, lowestNodeId);

    if (SUCCESS == status)

    {

    WPrintfString wStr(L"After IncrementNodeIdAttributes, the highestNodeId = %ld, lowestNodeId = %ld", highestNodeId, lowestNodeId);

    mdlDialog_dmsgsPrint(wStr.GetWCharCP());

    }

    }

    return true;

    }

    break;

    /*--------------------------------------------------------

    | SolidUtil::TopologyID::DeleteNodeIdAttributes Xiaoqi.Zhang

    +-------------------------------------------------------*/

    case eDeleteNodeIdAttributes:

    {

    //! Remove the topology ids from all faces of the given body.

    //! @param[in,out] entity The body to modify.

    //! @return SUCCESS if ids could be removed.

    //PSOLIDCORE_EXPORT static BentleyStatus DeleteNodeIdAttributes(ISolidKernelEntityR entity);

    BentleyStatus status = SolidUtil::TopologyID::DeleteNodeIdAttributes(*srcSolid);

    if (SUCCESS == status)

    {

    UInt32 highestNodeId;

    UInt32 lowestNodeId;

    status = SolidUtil::TopologyID::FindNodeIdRange(*srcSolid, highestNodeId, lowestNodeId);

    if (SUCCESS == status)

    {

    WPrintfString wStr(L"After DeleteNodeIdAttributes, the highestNodeId = %ld, lowestNodeId = %ld", highestNodeId, lowestNodeId);

    mdlDialog_dmsgsPrint(wStr.GetWCharCP());

    }

    }

    return true;

    }

    break;

    case eAddNodeIdAttributes:

    {

    //! Assign new topology ids to faces of the given body. Resolves duplicate face ids such as from a face being split.

    //! @param[in,out] entity The body to modify.

    //! @param[in] nodeId The topology node id to use in the new nodeId-entityId pairs.

    //! @param[in] overrideExisting false to assign new ids only to currently un-assigned faces and true to replace all existing ids.

    //! @return SUCCESS if ids could be added.

    //PSOLIDCORE_EXPORT static BentleyStatus AddNodeIdAttributes(ISolidKernelEntityR entity, UInt32 nodeId, bool overrideExisting);

    UInt32 nodeId = 22;

    bool overrideExisting = true;

    /*--------------------------------------------------------

    | SolidUtil::TopologyID::AddNodeIdAttributes Xiaoqi.Zhang

    +-------------------------------------------------------*/

    BentleyStatus status = SolidUtil::TopologyID::AddNodeIdAttributes(*srcSolid, nodeId, overrideExisting);

    if (SUCCESS == status)

    {

    UInt32 highestNodeId;

    UInt32 lowestNodeId;

    status = SolidUtil::TopologyID::FindNodeIdRange(*srcSolid, highestNodeId, lowestNodeId);

    if (SUCCESS == status)

    {

    WPrintfString wStr(L"After DeleteNodeIdAttributes, the highestNodeId = %ld, lowestNodeId = %ld", highestNodeId, lowestNodeId);

    mdlDialog_dmsgsPrint(wStr.GetWCharCP());

    }

    }

     

    return true;

    }

    break;

  • 老师,您举的几个例子都是使用ISolidKernelEntityR 类的。

    我想测试一下IdFromFace (FaceId &faceId, ISubEntityCR subEntity, bool useHighestId)等几个用ISubEntityCR的方法。。。。

    ISolidKernelEntityRISubEntityCR怎么转换?或者EditElementHandle到ISubEntityCR怎么转换?

    Work smart, not just work hard!