- UID
 - 24292
 
- 积分
 - 172
 
- 精华
 
- 贡献
 -  
 
- 威望
 -  
 
- 活跃度
 -  
 
- D豆
 -  
 
- 在线时间
 -  小时
 
- 注册时间
 - 2003-1-7
 
- 最后登录
 - 1970-1-1
 
 
 
 
 
 
 | 
 
 楼主 |
发表于 2003-1-12 19:20:22
|
显示全部楼层
 
 
 
谢谢你,晓东
下面是我的代码,有劳大驾: 
{ 
        // TODO: Implement the command 
 
 
 
        int ret; 
        ads_point point; 
         
        {                 
                 
                while(1) 
                { 
                        ret = acedGetPoint(NULL,"\n  请输入左下角:",point); 
                        if(ret == RTNORM) 
                                break; 
                        else if(ret == RTCAN ) 
                                return; 
                } 
        } 
         
        int zys = 0; 
        {                 
                 
                while(1) 
                { 
                        ret = acedGetInt("\n  请输入总页数:",&zys); 
                        if(ret == RTNORM) 
                                break; 
                        else if(ret == RTCAN ) 
                                return; 
                } 
        } 
         
 
        double bgjj = 0.9778;//表格间距 
        double bgcd= 152-1;//表格长度 
        double bggd=12.9778;//表格高度         
        int Lines = 8; 
        double delta=-0.6;//下移动之 
         
        double yc =168;//页长 
        double yjj =34;//页间距 
         
        double left = point[0] + 12+0.5; 
         
        { 
                char buf1[256],buf2[256]; 
                sprintf(buf1,"%.4f,%.4f",point[0],point[1]); 
                sprintf(buf2,"%.4f,%.4f",point[0]+zys*yc+(zys-1)*yjj,point[1]); 
                 
                acedCommand(RTSTR, "ZOOM",RTSTR ,"W",RTSTR ,buf1,RTSTR, buf2, 0) ;                                  
        }         
        struct resbuf eb1,eb2,eb3,eb4;  
        char sbuf1[10],sbuf2[10],sbuf3[10],sbuf4[10];  
 
 
 
        for(int j=0;j<zys;j++) 
        { 
                acutPrintf("\n开始处理 %d / %d 页\n",j+1,zys); 
                 
                double bottom= point[1] +9.4889; 
                for(int i=0;i<8;i++) 
                { 
                        acutPrintf("\n开始处理 %d 行 / %d 页\n",i+1,j+1); 
                         
                        double right= left + bgcd; 
                        double top= bottom + bggd; 
                         
                        /* 
                        char buf1[256],buf2[256],buf3[256]; 
                        sprintf(buf1,"%.4f,%.4f",left,bottom+0.01); 
                        sprintf(buf2,"%.4f,%.4f",right,top-0.01); 
                        sprintf(buf3,"@0,%.4f",delta*(i+1)); 
                         
                        acedCommand(RTSTR, "rectang",RTSTR ,buf1,RTSTR, buf2, 0) ;  
                          
                          
                         if (acedCommand(RTSTR, "move",RTSTR, "W", RTSTR ,buf1,RTSTR, buf2,RTSTR, "",RTSTR, "0,0", RTSTR,buf3, 0) != RTNORM)                          
                           
                                { 
                                //        acutPrintf("\nSomething is wrong!!!");                                 
                                } 
                        */ 
 
 
                         
                        ads_point pt1,pt2; 
                        pt1[0] = left; 
                        pt1[1] = bottom + 0.01; 
                        pt2[0] = right; 
                        pt2[1] = top  - 0.01; 
 
 
                        ads_name ssname;          
                        ret = acedSSGet("W", pt1, pt2, &eb1, ssname); 
                        if(ret != RTNORM) 
                        { 
                                acutPrintf("\n无选择集"); 
                        } 
                        else                                 
                        { 
                                AcGeVector3d trans(0,delta*(i+1),0); 
 
                                AcGeMatrix3d  xform; 
                                xform.setToIdentity(); 
                                xform.setToTranslation(trans); 
 
 
                                long len=0; 
                                acedSSLength(ssname,&len); 
                                acutPrintf("\n实体个数%d",len); 
 
                                for(long i=0;i<len;i++) 
                                { 
                                        ads_name  ent;  
                                        acedSSName(ssname, i, ent); 
                                        AcDbObjectId eId; 
                                        acdbGetObjectId(eId, ent); 
                                         
                                        AcDbEntity * pEnt = NULL; 
                                        acdbOpenObject(pEnt, eId, AcDb::kForWrite); 
                                         
                                        if(pEnt == NULL) 
                                        { 
                                                acutPrintf("\n打开实体失败失败"); 
                                        } 
                                        else 
                                        { 
                                                Acad::ErrorStatus es =  pEnt->transformBy(xform); 
                                                 
                                                if(es != Acad::eOk) 
                                                { 
                                                        acutPrintf("\n移动失败"); 
                                                } 
                                        } 
                                        pEnt->close(); 
                                } 
                        } 
                         
                        acedSSFree(ssname); 
                        bottom  =top ; 
                } 
                 
                left += yc+yjj; 
        } 
} |   
 
 
 
 |