• <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)論

            閱讀排行榜

            无码AV中文字幕久久专区| 热re99久久6国产精品免费| 2021久久国自产拍精品| 久久天天躁狠狠躁夜夜不卡| 午夜视频久久久久一区 | 2020国产成人久久精品| 久久国产成人| 国产精品伊人久久伊人电影| 精品999久久久久久中文字幕| 精品国产乱码久久久久久人妻| 热综合一本伊人久久精品| 精品人妻伦一二三区久久| 久久久精品日本一区二区三区| 久久精品国产精品亚洲人人 | 中文字幕精品无码久久久久久3D日动漫 | 久久精品视频一| 久久精品一本到99热免费| 国产69精品久久久久9999APGF| 亚洲欧美伊人久久综合一区二区 | 国产精品久久久久久吹潮| 国产成人综合久久综合| 久久99精品久久久久久| 国产精品伦理久久久久久| 久久av高潮av无码av喷吹| 无码8090精品久久一区 | 国产V综合V亚洲欧美久久| 久久99国产精一区二区三区| 国产叼嘿久久精品久久| 亚洲欧美久久久久9999| 国产精品久久久久久久app | 国产免费久久久久久无码| 久久乐国产综合亚洲精品| 久久久久女人精品毛片| 国产巨作麻豆欧美亚洲综合久久| 亚洲国产成人精品91久久久| 久久精品国产亚洲av水果派| 久久99精品久久久久久水蜜桃| 亚洲精品白浆高清久久久久久| 日本道色综合久久影院| 77777亚洲午夜久久多喷| 亚洲国产精品人久久|