www.mxdraw.com
内容索引主面
前一个向上下一个
McDbDatabase::getLayoutDictionary 方法

得到布局字典

C++
Mcad::ErrorStatus getLayoutDictionary(McDbDictionary*& pDict, McDb::OpenMode mode) const;
参数 
说明 
McDbDictionary*& pDict 
返回的字典指针 
McDb::OpenMode mode 
对象的打开方式 

如果成功返回Mcad::eOk,如果传递的数据非法则返回Mcad::eInvalidInput

例如:返回所有布局名

    bool GetAllLayoutName(McDbDatabase* pDatabase,
        std::vector<CString>& allLayoutName)
    {
        if(pDatabase == NULL)
        {
            if(Mx::mcdbHostApplicationServices() != NULL)
                pDatabase =  Mx::mcdbHostApplicationServices()->workingDatabase();
        }

        if(pDatabase == NULL)
        {

            return false;
        }

        McDbDictionary* pDict = NULL;
        if(pDatabase->getLayoutDictionary(pDict,McDb::kForRead) != Mcad::eOk)
        {

            return false;
        }

        McDbDictionaryIterator* pIter = pDict->newIterator();
        for(;!pIter->done();pIter->next() )
        {
            McDbObjectPointer<McDbLayout> spLayout(pIter->objectId(),McDb::kForRead);
            if(spLayout.openStatus() != Mcad::eOk)
                continue;

            LPCTSTR pszLayoutName = NULL;
            spLayout->getLayoutName(pszLayoutName);

            CString sTmpLayoutName(pszLayoutName);

            allLayoutName.push_back(sTmpLayoutName);
        }

        pDict->close();
        delete pIter;

        return true;
    }
Copyright (c) 2010. All rights reserved.
你认为该帮助怎么样? 发送反馈信息!