【OBD C++】扫描元素怎么区分OBD元素类型?

如题,ScanCriteria怎么区别OBD元素,例如,如何判断当前元素是墙,或者柱,类似双击构件,能自动弹出对应类型元素的编辑界面。

Parents
  • ScanCriteria是MS平台级的对象,不能认识OBD中的墙、梁柱等。你可以参考OBD SDK中的例子tfshowinfo,其中有如下写法用来判断一个元素描述符(MSElementDescr*)是哪种OBD中的对象的。

    static StatusInt MSElementDescr_showInfo
    (
    MSElementDescr* pThis /* => */
    )
        {
        int tfType = mdlTFElmdscr_getApplicationType (pThis);
    
        switch (tfType)
            {
            case TF_FREE_FORM_ELM:
            case TF_SMOOTH_FORM_ELM:
            case TF_LINEAR_FORM_ELM:
            case TF_ARC_FORM_ELM:
            case TF_LINE_STRING_FORM_ELM:
            case TF_SLAB_FORM_ELM:
            case TF_PATH_FORM_ELM:
            case TF_STRUCTURAL_ELM:
            case TF_STRUCTSMOOTH_ELM:
                {
                TFFormRecipeList* pRecipeNode = NULL;
    
                if (SUCCESS == mdlTFFormRecipeList_constructFromElmdscr (&pRecipeNode, pThis))
                    {
                    TFFormRecipe_showInfo (mdlTFFormRecipeList_getFormRecipe (pRecipeNode));
    
                    mdlTFFormRecipeList_free (&pRecipeNode);
                    }
                break;
                }
    
            case TF_COMPOUND_CELL_ELM:
            case TF_CC_INT_DOOR_ELM:
            case TF_CC_EXT_DOOR_ELM:
            case TF_CC_INT_WINDOW_ELM:
            case TF_CC_EXT_WINDOW_ELM:
            case TF_CC_INT_DOOR_AND_WINDOW_ELM:
            case TF_CC_EXT_DOOR_AND_WINDOW_ELM:
                {
                TFFrameList* pFrameNode = NULL;
    
                if (pFrameNode = mdlTFFrameList_constructFromElmdscr (pThis))
                    {
                    TFFrame_showInfo (mdlTFFrameList_getFrame (pFrameNode));
    
                    mdlTFFrameList_free (&pFrameNode);
                    }
    
                break;
                }
    
            case TF_EBREP_ELM:
                {
                MSElementDescr_showTriformaSolidInfo (pThis);
                break;
                }
    
            default:
                {
                int       type = mdlElement_getType (&pThis->el);
                ElementId id   = mdlElement_getID (&pThis->el);
    
                print ("type=%d Id=%I64d\n", type, id);
    
                break;
                }
            }
    
        return SUCCESS;
        }



    MISSING RESOURCE: VerifiedBy Chao Cheng 

Reply
  • ScanCriteria是MS平台级的对象,不能认识OBD中的墙、梁柱等。你可以参考OBD SDK中的例子tfshowinfo,其中有如下写法用来判断一个元素描述符(MSElementDescr*)是哪种OBD中的对象的。

    static StatusInt MSElementDescr_showInfo
    (
    MSElementDescr* pThis /* => */
    )
        {
        int tfType = mdlTFElmdscr_getApplicationType (pThis);
    
        switch (tfType)
            {
            case TF_FREE_FORM_ELM:
            case TF_SMOOTH_FORM_ELM:
            case TF_LINEAR_FORM_ELM:
            case TF_ARC_FORM_ELM:
            case TF_LINE_STRING_FORM_ELM:
            case TF_SLAB_FORM_ELM:
            case TF_PATH_FORM_ELM:
            case TF_STRUCTURAL_ELM:
            case TF_STRUCTSMOOTH_ELM:
                {
                TFFormRecipeList* pRecipeNode = NULL;
    
                if (SUCCESS == mdlTFFormRecipeList_constructFromElmdscr (&pRecipeNode, pThis))
                    {
                    TFFormRecipe_showInfo (mdlTFFormRecipeList_getFormRecipe (pRecipeNode));
    
                    mdlTFFormRecipeList_free (&pRecipeNode);
                    }
                break;
                }
    
            case TF_COMPOUND_CELL_ELM:
            case TF_CC_INT_DOOR_ELM:
            case TF_CC_EXT_DOOR_ELM:
            case TF_CC_INT_WINDOW_ELM:
            case TF_CC_EXT_WINDOW_ELM:
            case TF_CC_INT_DOOR_AND_WINDOW_ELM:
            case TF_CC_EXT_DOOR_AND_WINDOW_ELM:
                {
                TFFrameList* pFrameNode = NULL;
    
                if (pFrameNode = mdlTFFrameList_constructFromElmdscr (pThis))
                    {
                    TFFrame_showInfo (mdlTFFrameList_getFrame (pFrameNode));
    
                    mdlTFFrameList_free (&pFrameNode);
                    }
    
                break;
                }
    
            case TF_EBREP_ELM:
                {
                MSElementDescr_showTriformaSolidInfo (pThis);
                break;
                }
    
            default:
                {
                int       type = mdlElement_getType (&pThis->el);
                ElementId id   = mdlElement_getID (&pThis->el);
    
                print ("type=%d Id=%I64d\n", type, id);
    
                break;
                }
            }
    
        return SUCCESS;
        }



    MISSING RESOURCE: VerifiedBy Chao Cheng 

Children
No Data