• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            C++ Programmer's Cookbook

            {C++ 基礎(chǔ)} {C++ 高級(jí)} {C#界面,C++核心算法} {設(shè)計(jì)模式} {C#基礎(chǔ)}

            arx & c++ 常用函數(shù)代碼

             

            1改變實(shí)體顏色

            Acad::ErrorStatus
            changeColor(AcDbObjectId entId, Adesk::UInt16 newColor)
            {
                AcDbEntity 
            *pEntity;
                acdbOpenObject(pEntity, entId,
                    AcDb::kForWrite);

                pEntity
            ->setColorIndex(newColor);
                pEntity
            ->close();

                
            return Acad::eOk;
            }


            2打開model空間
            bool OpenWorkingModelSpace()
            {
                Acad::ErrorStatus es ;
                AcDbBlockTable 
            *pBlockTbl ;
                AcDbBlockTableRecord 
            *pp ;
                
            //AcDbObjectId pObjectid;

                
            // Get the block table
                if ( (es =acdbHostApplicationServices ()->workingDatabase ()->getBlockTable (pBlockTbl, AcDb::kForRead)) != Acad::eOk )
                
            {
                    acutPrintf (
            "\nCouldn't open the block table!") ;
                    
            return false;
                }

                
            // Get the Model Space record and open it for read.
                if ( (es =pBlockTbl->getAt (ACDB_MODEL_SPACE, pp, AcDb::kForWrite)) != Acad::eOk )
                
            {
                    acutPrintf (
            "\nCouldn't get Model Space! Drawing corrupt.\n") ;
                    pBlockTbl
            ->close () ;
                    
            return  false;
                }

                pBlockTbl
            ->close ();
                
            //pp即為model的指針
                
            //使用pp
                pp->close();
                
            return true;
            }


            3創(chuàng)建textstyle

            bool CreateTextStyle()
            {
                Acad::ErrorStatus es;
                AcDbTextStyleTable 
            * pTextStyleTable;
                es
            = acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pTextStyleTable, AcDb::kForWrite);
                
            if (es != Acad::eOk) 
                
            {
                    delete pTextStyleTable;
                    
            return false;
                }

                
            if(pTextStyleTable->has("textstyle name"))
                
            {
                    
            //delete pTextStyleRecord;
                    pTextStyleTable->close();
                    
            return true;
                }

                AcDbTextStyleTableRecord 
            * pTextStyleRecord = new AcDbTextStyleTableRecord();
                
            if (pTextStyleRecord == NULL)
                    
            return false;
                

                 es 
            = pTextStyleRecord->setName("Mytablestyle");
                    
            //es = pTextStyleRecord->setFont("@宋體",Adesk::kFalse,Adesk::kFalse,936,FIXED_PITCH );
                   es = pTextStyleRecord->setBigFontFileName("gbcbig.shx");
                   es 
            = pTextStyleRecord->setFileName("txt.shx");
                   
            //es = pTextStyleRecord->setTextSize(2.2);
                    
            //設(shè)置屬性
                if (es != Acad::eOk) 
                
            {
                    delete pTextStyleRecord;
                    
            return false;
                }

                es 
            = pTextStyleTable->add(pTextStyleRecord);
                
            if (es != Acad::eOk)
                
            {
                    acutPrintf(
            "not add id");
                    delete pTextStyleRecord;
                    
            return false;
                }

                pTextStyleTable
            ->close();
                pTextStyleRecord
            ->close();
               

                
            return true;
            }


            4增加blockref到model

            bool AddblockrefToModel()
            {

                
            if(pMS == NULL)
                  
            return false;
                AcDbBlockTable 
            *pBlockTable ;
                AcDbObjectId pTitileBlockId;
                
            // Open the block table for read
                Acad::ErrorStatus es ;
                
            if ( (es =acdbHostApplicationServices ()->workingDatabase ()->getBlockTable (pBlockTable, AcDb::kForRead)) != Acad::eOk )
                    
            return false ;

                
            if ( pBlockTable->getAt("xxx",pTitileBlockId) == Adesk::kTrue )
                
            {    
                    
            return false ;
                }

                pBlockTable
            ->close ();

                
                AcDbBlockReference 
            * pTitileBlockRef = new AcDbBlockReference(AcGePoint3d(xx ,yy,zz),pTitileBlockId);
                AcGeScale3d pscale(scale); 
                pTitileBlockRef
            ->setScaleFactors(pscale);
                
            //設(shè)置屬性
                
                pMS
            ->appendAcDbEntity(pTitileBlockRef);
                pTitileBlockRef
            ->close();

                
            return true;
                
            }

            5遍歷block中的屬性 
            //與遍歷block中的實(shí)體相似
            AcDbObjectIterator *pBlkRefAttItr=pBlkRef->attributeIterator();
            for (pBlkRefAttItr->start(); !pBlkRefAttItr->done();pBlkRefAttItr->step())
            {
            AcDbObjectId attObjId;
            attObjId 
            = pBlkRefAttItr->objectId();

            AcDbAttribute 
            *pAtt = NULL;
            Acad::ErrorStatus es 
            = acdbOpenObject(pAtt, attObjId, AcDb::kForRead);
            if (es != Acad::eOk) 
            {
            acutPrintf(
            "\nFailed to open attribute");
            delete pBlkRefAttItr;
            continue;
            }

            if (strcmp(pAtt->tag(),"TITLE:"== 0)
            {
            CString title 
            = pAtt->textString();
            if (strcmp(title,"PROGRESS(D)"== 0)
            //操作
            }

            else if (strcmp(title,"PROGRESS(P)"== 0)
            {
            //操作
            }

            }

            pAtt
            ->close();
            }

            6公差標(biāo)注設(shè)置函數(shù):
            void SetDimtpAndDimtm(double tp,double tm)
            {
            AcDbDimStyleTable 
            *pDimStyleTbl;
            acdbCurDwg()
            ->getDimStyleTable(pDimStyleTbl,AcDb::kForRead);
            AcDbDimStyleTableRecord 
            *pDimStyleTblRcd;
            pDimStyleTbl
            ->getAt("",pDimStyleTblRcd,AcDb::kForWrite);
            if (fabs(tp) == fabs(tm))
            {
            pDimStyleTblRcd
            ->setDimtfac(1.0)
            }

            else pDimStyleTblRcd->setDimtfac(0.5);
            if (tp == 0.0 && tm == 0.0)
            {
            pDimStyleTblRcd
            ->setDimtol(0);
            }

            else
            {
            pDimStyleTblRcd
            ->setDimtp(tp);
            pDimStyleTblRcd
            ->setDimtol(1);
            pDimStyleTblRcd
            ->setDimtm(tm);
            }

            pDimStyleTblRcd
            ->close();
            pDimStyleTbl
            ->close();
            }

            posted on 2006-02-08 14:08 夢(mèng)在天涯 閱讀(2284) 評(píng)論(1)  編輯 收藏 引用 所屬分類: ARX/DBX

            評(píng)論

            # re: arx & c++ 常用函數(shù)代碼 2006-02-17 09:03 夢(mèng)在天涯

            Finding the Active Viewports in Model Space

            // Set some viewport information.
            AcDbViewportTable* pViewportTable;
            if (db.getViewportTable(pViewportTable, AcDb::kForRead)
            == Acad::eOk)
            {
            // Find the first viewport and open it for write.
            AcDbViewportTableRecord *pRecord;
            if (pViewportTable->getAt(
            "*ACTIVE", pRecord,
            AcDb::kForWrite) == Acad::eOk)
            {
            pRecord->setCenterPoint(AcGePoint2d(0.5, 0.5));
            pRecord->setHeight(1.0);
            pRecord->setWidth(1.0);
            pRecord->close();
            }
            pViewportTable->close();
            }
              回復(fù)  更多評(píng)論   

            公告

            EMail:itech001#126.com

            導(dǎo)航

            統(tǒng)計(jì)

            • 隨筆 - 461
            • 文章 - 4
            • 評(píng)論 - 746
            • 引用 - 0

            常用鏈接

            隨筆分類

            隨筆檔案

            收藏夾

            Blogs

            c#(csharp)

            C++(cpp)

            Enlish

            Forums(bbs)

            My self

            Often go

            Useful Webs

            Xml/Uml/html

            搜索

            •  

            積分與排名

            • 積分 - 1804430
            • 排名 - 5

            最新評(píng)論

            閱讀排行榜

            久久久久免费精品国产| 久久青青草原综合伊人| 国产精品久久久久久久人人看| 久久久久久国产精品免费免费 | 国产精品久久久久国产A级| 国产一区二区精品久久| 综合久久一区二区三区| 99久久精品国产麻豆| 亚洲国产日韩综合久久精品| 99久久成人国产精品免费 | 久久人人爽人人爽人人片AV不 | 7777精品伊人久久久大香线蕉| 久久久久成人精品无码中文字幕 | 久久精品国产亚洲AV忘忧草18| 久久精品国产亚洲AV香蕉| 久久国产乱子伦精品免费午夜| 久久青青草原精品国产| 久久精品国产99国产精品导航| 国产精品免费久久久久久久久 | 久久99这里只有精品国产| 久久香蕉一级毛片| 国产精品久久久久AV福利动漫| 亚洲国产成人精品无码久久久久久综合 | 久久久无码精品亚洲日韩蜜臀浪潮| 精品国产综合区久久久久久| 欧洲成人午夜精品无码区久久| 亚洲人AV永久一区二区三区久久| 一本色道久久88加勒比—综合| 精品久久久久久成人AV| 久久精品一本到99热免费| 欧美一区二区三区久久综| 国产精品99久久久精品无码| 久久久久亚洲国产| 99久久综合国产精品免费| 国产成人无码精品久久久性色| 一本久久免费视频| 一本久久a久久精品亚洲| 久久人人爽人人人人片av| 亚洲狠狠婷婷综合久久久久| 久久精品人人做人人爽电影蜜月| 久久久久人妻精品一区|