乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 22|回复: 1

[求助]我自己编写的图幅及标题栏后置设定程序怎么不能运行?

[复制链接]

1

主题

2

帖子

1

银币

初来乍到

Rank: 1

铜币
6
发表于 2009-6-10 16:59:00 | 显示全部楼层 |阅读模式
// ObjectARX defined commands
#include "StdAfx.h"
#include "StdArx.h"
#include  
#include  
#include  
#include  
#include  
#include  
#include
#include
#include "dbmain.h"
#include "dbidar.h "
#include "dbapserv.h"
#include "gepnt3d.h "
#include  "rxregsvc.h"
#include  "acedads.h"
#include  "adscodes.h"
#include   
#include  "accmd.h"
#define Cpoint(d,s) {d[X]=s[X];d[Y]=s[Y];d[Z]=s[Z];}
#define Spoint(d,x,y,z){d[X]=(x);d[Y]=(y);d[Z]=(z);}
//#define ELEMENTS(array) {sizeof(array)/sizeof((array)[0])}
#define CommandB()  { struct resbuf rB_cmd,rB_usr; \
        acedGetVar("CMDECHO", &rB_cmd); \
        rB_usr.restype = RTSHORT; \
        rB_usr.resval.rint = (int) (0); \
        acedSetVar("CMDECHO", &rB_usr);                                
#define CommandE()  acedSetVar("CMDECHO", &rB_cmd); \
};
#define layer_do(mode,layer_name){\
if(acedCommand(RTSTR,"LAYER",RTSTR,mode,RTSTR,layer_name,RTSTR,"",0)\
!=RTNORM) acdbFail("\n Layer opration error.");\}
#define  layer_edit(mode,value,layer_name){\
if(acedCommand(RTSTR,"LAYER",RTSTR,mode,RTSTR,value,RTSTR,layer_name,\
    RTSTR,"",0)!=RTNORM) acdbFail("\n layer edit opration  error.");\
}
static struct size_list{ //图幅尺寸的数据结构
                      char *name;//图幅名称
       int hor;//图纸水平长度
       int ver;//图纸纵向长度
       short a;//图框的图纸左边界距离
       short c;//图框到图纸上,下,右边界距离
}
size_list[]={
{"A0",1189,841,25,10},//A0,A1...幅面边界的尺寸
{"A1",841,594,25,10},
{"A2",594,420,25,10},
{"A3",420,297,25,5},
{"A4",210,297,25,5},
{"A5",210,148,25,5},

};
#define SIZE_L 6
//static int size=0;
static char style;//图纸布置方式,1=正常,0=转置
static char head ;//标题栏,1= 格式A,0=格式B
char tbuf[80];//全局性的自由变量
int draw_size(ads_point pt_temp1,int hor,int ver,short a,short c,char style,char head,ads_real scale)
{
// 传递参数依次为:左下角点坐标,水平长度,纵向长度,至左边界距离,到其他三边的距离,图纸布置方式,标题栏格式,绘图比例
ads_point  pt0,pt1,pt2,pt3;
int intl;
char head_name[12];
ads_name ss,e0,e1;//选择集和实体名称

if(style!='1'){//图纸转置90°
               intl=hor;
      hor=ver;
      ver=intl;}
if(head=='1') strcpy(head_name,"head_a.dwg");//标题栏格式A
else strcpy(head_name,"head_b.dwg");//标题栏格式B
if (acedFindFile(head_name,tbuf)!=RTNORM){//在盘上查找标题栏图块
                                         sprintf(tbuf,"file not existed.",head_name);
           acedAlert(tbuf);
           return RTERROR;}
Cpoint(pt0,pt_temp1);//对图幅外边界四角点x,y,z坐标赋值
Spoint(pt1,pt0[X]+hor,pt0[Y],0);
Spoint(pt2,pt0[X]+hor,pt0[Y]+ver,0);
Spoint(pt3,pt0[X],pt0[Y]+ver,0);
acedCommand(RTSTR,"COLOR",RTSTR,"YELLOW",0);
acedCommand(RTSTR,"LINE",RTPOINT,pt0,RTPOINT,pt1,0);//画外边界
// acdbEntNext(NULL,ss);
acdbEntLast(e0);//为后续生成ss选择集而保存第一个实体的名称
acedCommand(RTPOINT,pt2,RTPOINT,pt3,RTSTR,"C",0);
Spoint(pt0,pt0[X]+a,pt0[Y]+c,0);
Spoint(pt1,pt1[X]-c,pt1[Y]+c,0);
Spoint(pt2,pt2[X]-c,pt2[Y]-c,0);
Spoint(pt3,pt3[X]+a,pt3[Y]-c,0);
acedCommand(RTSTR,"COLOR",RTSTR,"WHITE",0);
acedCommand(RTSTR,"LINE",RTPOINT,pt0,RTPOINT,pt1,RTPOINT,pt2,RTPOINT,pt3,RTSTR,"C",0);//绘图框线
acedCommand(RTSTR,"LINE",RTPOINT,pt3,RTSTR,"@40=0;i--) { //查找能包含此图形的最小图幅
                  real1=(size_list[i].hor-size_list[i].a-size_list[i].c)/scale;
      real2=(size_list[i].ver-size_list[i].c*2-head_ht-no_ht)/scale;
      if((lx
}
回复

使用道具 举报

1

主题

2

帖子

1

银币

初来乍到

Rank: 1

铜币
6
发表于 2009-6-11 10:22:00 | 显示全部楼层
没有高手帮我看一看吗?
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-2-6 00:45 , Processed in 0.365021 second(s), 56 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表