乐筑天下

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

请大家指点一下!急

[复制链接]

19

主题

47

帖子

3

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
123
发表于 2004-10-29 21:26:00 | 显示全部楼层 |阅读模式
我写了如下的一段代码
#include "StdAfx.h"
#include "StdArx.h"
#include "string.h"
long len1;/////////图形中所有管段的个数
ads_name sspipe;///////图形中管段的选择集
int line_data(ads_name ent,ads_point pt_start,ads_point pt_end)
{struct resbuf *eb1=NULL,*eb2=NULL;
eb1=acdbEntGet(ent);
for(eb2=eb1;eb2!=NULL;eb2=eb2->rbnext)
{if(eb2->restype==0)
if(strcmp(eb2->resval.rstring,"LINE")!=0)
{acutRelRb(eb1);
return RTERROR;
}
if(eb2->restype==10)
ads_point_set(eb2->resval.rpoint,pt_start);
if(eb2->restype==11)
ads_point_set(eb2->resval.rpoint,pt_end);
}
acutRelRb(eb1);
return RTNORM;
}
// This is command 'GD'
void vcstep1gd()////////此函数用来给管段编号
{
        // TODO: Implement the command
ads_name pipe;///////前者为所有管段的集合,后者为单个管段
struct resbuf res1;
char str1[20],str2[20];////////str2为管段的标号
ads_point s_point,e_point;
ads_point mid_point;
strcpy(str1,"LINE");
res1.resval.rstring=str1;
res1.restype=0;
res1.rbnext=NULL;
if(acedSSGet("X",NULL,NULL,&res1,sspipe)!=RTNORM)
acedAlert("图形中还没有管线\n请绘制管线");
acedSSLength(sspipe,&len1);
acedCommand(RTSTR,"LAYER",RTSTR,"M",RTSTR,"HELLO",RTSTR,"S",RTSTR,"HELLO",RTSTR,"",0);
for(int i=0;irbnext)
                {
                        if(eb2->restype==0)
                        if(strcmp(eb2->resval.rstring,"LINE")!=0)
                        {acutRelRb(eb1);
                        return RTERROR;
                }
                if(eb2->restype==10)
                ads_point_set(eb2->resval.rpoint,pt_start);
                if(eb2->restype==11)
                ads_point_set(eb2->resval.rpoint,pt_end);
                }
                acutRelRb(eb1);
                return RTNORM;
        }
        // This is command 'GD'
        static void vcstep1gd()////////此函数用来给管段编号
        {
                // TODO: Implement the command
                ads_name pipe;///////前者为所有管段的集合,后者为单个管段
                struct resbuf res1;
                char str1[20],str2[20];////////str2为管段的标号
                ads_point s_point,e_point;
                ads_point mid_point;
                strcpy(str1,"LINE");
                res1.resval.rstring=str1;
                res1.restype=0;
                res1.rbnext=NULL;
                if(acedSSGet("X",NULL,NULL,&res1,sspipe)!=RTNORM)
                acedAlert("图形中还没有管线\n请绘制管线");
                acedSSLength(sspipe,&len1);
                acedCommand(RTSTR,"LAYER",RTSTR,"M",RTSTR,"HELLO",RTSTR,"S",RTSTR,"HELLO",RTSTR,"",0);
                for(int i=0;i<len1;i++)
                {
                        acedSSName(sspipe,i,pipe);
                        line_data(pipe,s_point,e_point);
                        mid_point[X]=(s_point[X]+e_point[X])/2;
                        mid_point[Y]=(s_point[Y]+e_point[Y])/2;
                        mid_point[Z]=0;
                        ads_real angle=180/3.141592657589*acutAngle(s_point,e_point);///////每条直线的角度
                        acdbRToS(i+1,2,2,str2);
                        acedCommand(RTSTR,"CIRCLE",RTPOINT,s_point,RTSTR,"10",RTNONE);
                        acedCommand(RTSTR,"TEXT",RTPOINT,mid_point,RTSTR,"10",RTREAL,angle,RTSTR,str2,0);
                }
                if (sspipe)
                        acedSSFree(sspipe);
        }
下次代码还是写清楚一点吧?
回复

使用道具 举报

124

主题

837

帖子

9

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1333
发表于 2004-10-29 21:58:00 | 显示全部楼层
呵呵,真是非常感谢啊,不过能告诉我为什么要这样做吗》??不好意思啊,我是新手
回复

使用道具 举报

19

主题

47

帖子

3

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
123
发表于 2004-10-29 22:35:00 | 显示全部楼层
怎么做? 指什么?
回复

使用道具 举报

124

主题

837

帖子

9

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1333
发表于 2004-10-29 22:42:00 | 显示全部楼层
其实下面还有如下的代码
void vcstp2jd()
{
        // TODO: Implement the command
ads_name pipe;////////管段的数组
ads_point as_point[200],ae_point[200];///////管段起始节点的数组
ads_point totalpoint[200];
for(int i=0;i<len1;i++)
{acedSSName(sspipe,i,pipe);
line_data(pipe,as_point[i],ae_point[i]);
totalpoint[2*i][X]=as_point[i][X];
totalpoint[2*i][Y]=as_point[i][Y];
totalpoint[2*i][Z]=as_point[i][Z];
totalpoint[2*i+1][X]=ae_point[i][X];
totalpoint[2*i+1][Y]=ae_point[i][Y];
totalpoint[2*i+1][Z]=ae_point[i][Z];
acedCommand(RTSTR,"CIRCLE",RT3DPOINT,as_point[i],RTREAL,10,0);
acedCommand(RTSTR,"CIRCLE",RT3DPOINT,ae_point[i],RTREAL,10,0);
}
int sizeofpoint=sizeof(totalpoint)/4;
}可是在CAD下运行还是会出现Invalid type in acutBuildList() arg #7
命令: Invalid type in acutBuildList() arg #7这样的问题,能告诉究竟是什么原因呢??
回复

使用道具 举报

19

主题

47

帖子

3

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
123
发表于 2004-10-29 22:44:00 | 显示全部楼层
从调试的结果
acedCommand(RTSTR,"CIRCLE",RT3DPOINT,as_point[i],RTREAL,10,0);
没有执行成功, 那问题就在这里了, 而这里acedCommand有7个参数, 但
"Invalid type in acutBuildList() arg #7 " 不一定准确, 总之能找到出错的位置!
你执行你的程序后, F2看一下AutoCAD Command Line, 也可以清楚地
看到CIRCLE和TEXT的执行过程!
回复

使用道具 举报

124

主题

837

帖子

9

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1333
发表于 2004-10-29 22:49:00 | 显示全部楼层
你不是把子函数返回值定义为静态整数了吗》》?而且把选择集释放出来了啊,为什么这么做就可以了呢??呵呵,谢谢
回复

使用道具 举报

19

主题

47

帖子

3

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
123
发表于 2004-10-29 22:52:00 | 显示全部楼层
到vcstp2jd()函数执行的时候即使按F2也就只能看见"Invalid type in acutBuildList() arg #7 "提示,是不是函数返回值的问题啊??还是不能定义点数组的问题啊??/
回复

使用道具 举报

19

主题

47

帖子

3

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
123
发表于 2004-10-29 22:59:00 | 显示全部楼层
这一句:
acedCommand(RTSTR,"CIRCLE",RTPOINT,s_point,RTREAL,10,0); 改成了
acedCommand(RTSTR,"CIRCLE",RTPOINT,s_point,RTSTR,"10",RTNONE);
回复

使用道具 举报

124

主题

837

帖子

9

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1333
发表于 2004-10-29 23:10:00 | 显示全部楼层
呵呵,是可以了啊,可是为什么呢??对了能把你的QQ号给我吗??这样讨教起来方便啊,呵呵
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-2-5 00:36 , Processed in 0.156252 second(s), 70 queries .

© 2020-2025 乐筑天下

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