BDYCAD 发表于 2007-3-14 14:29:00

学习ARX,编个初组的命令,呵呵

<p>在使用CAD中, 我们常常要把很多根头尾相连的ARC呀LINE呀连接成一根PLINE对象,我们都是常常用CAD的PEDIT来做,我以前只能在LISP中写出来, 今天把他用ARX把这个简易的动作写出来, </p><p>&nbsp;&nbsp;&nbsp; 还望以后大家多多指导,我将用心学好ARX, 谢谢!</p><p>&nbsp;// ----- BDYCommEE._EE command (do not rename)<br/>&nbsp;static void BDYCommEE_EE(void)<br/>&nbsp;{<br/>&nbsp;&nbsp;struct resbuf cmd, rb1,rb2 , *dxf;<br/>&nbsp;&nbsp;ads_name Ename;<br/>&nbsp;&nbsp;ads_point pt1 ;<br/>&nbsp;&nbsp;int m,n,k;<br/>&nbsp;&nbsp;//acedGetVar("osmode", &amp; os);<br/>&nbsp;&nbsp;cmd.restype = RTREAL;<br/>&nbsp;&nbsp;cmd.resval.rreal = 0;<br/>&nbsp;&nbsp;acedSetVar("cmdecho", &amp;cmd);//(SETVAR "CMDECHO" 0)<br/>&nbsp;&nbsp;if(acedEntSel("\n请选择要串接的线:",Ename,pt1) != RTNORM)<br/>&nbsp;&nbsp;{acutPrintf("\n没有选到对象,请再试一次。");}<br/>&nbsp;&nbsp;else<br/>&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&nbsp;acedCommand(RTSTR ,"PEDIT",RTLB,RTENAME,Ename ,RTPOINT,pt1,RTLE, RTSTR, "" ,RTSTR,"J",RTSTR,"ALL",RTSTR,"",RTSTR,"",0);<br/>&nbsp;&nbsp;&nbsp;acutPrintf("\n选到对象,自动进行连接对象了。");<br/>&nbsp;&nbsp;}<br/>&nbsp;&nbsp;// Add your code for command BDYCommEE._EE here<br/>&nbsp;}</p>

ganok 发表于 2007-3-22 15:32:00

<p>是用sendcommand的方式啊?还以为是arx的方式呢。不过也顶一下,楼主继续努力。</p>

BDYCAD 发表于 2007-4-5 10:45:00

本帖最后由 作者 于 2007-4-5 10:49:31 编辑 <br /><br /> <p>20070405</p><p>今天又学习一点点ARX, 写个中心点式画距形的小功能.呵呵,</p><p>//ads_real 可以和c++自带的double 或float 换着用<br/>//ads_real&nbsp; a,b,a2,b2;<br/>double a,b,a2,b2;<br/>&nbsp;ads_point pt1,pt2,ptc;<br/>&nbsp;acedGetReal("\n请输入长度:",&amp;a);<br/>&nbsp;acedGetReal("\n请输入宽度:",&amp;b);<br/>&nbsp;acedGetPoint(NULL,"\n请输入中心点:",ptc);<br/>&nbsp;a2=a*0.5;<br/>&nbsp;b2=b*0.5;<br/>&nbsp;pt1=ptc-a2;<br/>&nbsp;pt1=ptc-b2;<br/>&nbsp;//pt1.x=ptc.x-a2;不是类,不能这么用<br/>&nbsp;//pt1.y=ptc.y-b2;<br/>&nbsp;pt2=ptc+a2;<br/>&nbsp;pt2=ptc+b2;<br/>&nbsp;acedCommand(RTSTR ,"RECTANGLE",RTPOINT,pt1,RTPOINT, pt2,0);<br/>&nbsp;acutPrintf("\n以中心点画出距形\n长度的一半%f ;\n宽度的一半%f 。",a2,b2);</p><p></p><p><br/></p>

BDYCAD 发表于 2007-4-11 17:23:00

<p>改一个选集里面所有对象的颜色的ARX代码</p><p>//编写BDYCAD<br/>//时间:2007-04-11</p><p>static void bdy_chdxf62(ads_name en)<br/>{<br/>&nbsp;struct resbuf *pArgs =acedGetArgs () ,*ed,*cb,*cd;<br/>&nbsp;int a=0;<br/>&nbsp;ed= acdbEntGet(en);<br/>&nbsp;for(cb=ed;cb!=NULL;cb=cb-&gt;rbnext)<br/>&nbsp;{<br/>&nbsp;&nbsp;if(cb-&gt;restype== 62)<br/>&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&nbsp;cb-&gt;resval.rint=1;//我想把对象改为红色<br/>&nbsp;&nbsp;&nbsp;if(acdbEntMod(ed)!=RTNORM)<br/>&nbsp;&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;acutRelRb(ed);<br/>&nbsp;&nbsp;&nbsp;&nbsp;//return 0;<br/>&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;a=1;<br/>&nbsp;&nbsp;&nbsp;break;//处理好就跳出循环,节省时间。<br/>&nbsp;&nbsp;}<br/>&nbsp;}<br/>&nbsp;if(a==0)<br/>{<br/>&nbsp;for(cd=ed;cd-&gt;rbnext!=NULL;cd=cd-&gt;rbnext);//在链表尾部添加节点<br/>&nbsp;struct resbuf *rb=NULL;<br/>&nbsp;if((rb=(struct resbuf*)malloc(sizeof(struct resbuf)))!=NULL)<br/>&nbsp;{<br/>&nbsp;&nbsp;rb-&gt;rbnext=NULL;<br/>&nbsp;&nbsp;rb-&gt;restype=62;<br/>&nbsp;&nbsp;rb-&gt;resval.rint=1;<br/>&nbsp;&nbsp;cd-&gt;rbnext=rb;<br/>&nbsp;&nbsp;if(acdbEntMod(ed)!=RTNORM) acutPrintf("\nERR");<br/>&nbsp;}<br/>&nbsp;a=1;<br/>}<br/>// 释放内存<br/>if(ed!=NULL) acutRelRb(ed);<br/>ed=NULL;<br/>acutRelRb(ed);<br/>}<br/>static int ads_sstest(void)<br/>{<br/>&nbsp;//----- Remove the following line if you do not expect any argument for this ADS function<br/>&nbsp;struct resbuf *pArgs =acedGetArgs (),*dxf ;</p><p>&nbsp;// TODO: add your code here<br/>&nbsp;ads_name ss;<br/>&nbsp;if ((acedSSGet(NULL,NULL,NULL,NULL,ss))!=RTNORM)<br/>&nbsp;{<br/>&nbsp;&nbsp;acutPrintf("\n对不起,选不到对象");<br/>&nbsp;}<br/>&nbsp;else<br/>&nbsp;{<br/>&nbsp;&nbsp;int i=0;<br/>&nbsp;&nbsp;long sslen;<br/>&nbsp;&nbsp;acedSSLength(ss,&amp;sslen);<br/>&nbsp;&nbsp;acutPrintf("\n选到了%d个对象",sslen);<br/>&nbsp;&nbsp;ads_name en1;<br/>&nbsp;&nbsp;for(i;sslen&gt;i;i++)<br/>&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&nbsp;acedSSName(ss,i,en1);<br/>&nbsp;&nbsp;&nbsp;bdy_chdxf62(en1);</p><p>&nbsp;&nbsp;}<br/>&nbsp;}<br/>&nbsp;// TODO: Replace the following line by your returned value if any<br/>&nbsp;acedRetVoid () ;<br/>&nbsp;return (RSRSLT) ;<br/>}</p>

BDYCAD 发表于 2007-4-12 16:13:00

<p>学习一下WHILE在ARX里面的用法</p><p></p><p>//2007-01-12<br/>static int ads_pointlistdraw(void)<br/>{<br/>&nbsp;//----- Remove the following line if you do not expect any argument for this ADS function<br/>&nbsp;struct resbuf *pArgs =acedGetArgs (),*entlist;</p><p>&nbsp;// TODO: add your code here<br/>&nbsp;ads_point pt1;<br/>&nbsp;ads_real rad=2.0;<br/>&nbsp;int a,b;<br/>&nbsp;a=acedGetPoint(NULL,"\n输入一个点:",pt1);<br/>&nbsp;b=0;<br/>&nbsp;while(a== RTNORM)//((acedGetPoint(NULL,"\n输入一个点:",pt1))==RTNORM);<br/>&nbsp;{<br/>&nbsp;&nbsp;//acedCommand(RTSTR ,"CIRCLE",RTPOINT,pt1,RTREAL,rad,0);<br/>&nbsp;&nbsp;entlist=NULL;<br/>&nbsp;&nbsp;entlist=acutBuildList(RTDXF0,"CIRCLE",8,"0",10,pt1,40,rad,62,1,0);<br/>&nbsp;&nbsp;acdbEntMake(entlist);<br/>&nbsp;&nbsp;b++;<br/>&nbsp;&nbsp;a=acedGetPoint(NULL,"\r输入一个点:",pt1);</p><p>&nbsp;}<br/>&nbsp;acutPrintf("\n报告:在0层画了%d个红色的小圆圆,\n谢谢使用!",b);<br/>&nbsp;// TODO: Replace the following line by your returned value if any<br/>&nbsp;acedRetVoid () ;</p><p>&nbsp;return (RSRSLT) ;<br/>}</p>

BDYCAD 发表于 2007-4-24 21:41:00

<div class="t_msgfont" id="message2030">要使用VS2005 + ARX2007 的一些要做的设置如下:<br/>1&nbsp;&nbsp;,先按ADMIN说的: <br/>将.NET2002中的如下文件mfc70.lib&nbsp; &nbsp; &nbsp; &nbsp; mfc70d.lib mfc70u.lib mfc70ud.lib mfcs70.li mfcs70.pdb&nbsp; &nbsp; &nbsp; &nbsp; mfcs70d.lib mfcs70d.pdb mfcs70u.lib&nbsp; &nbsp; &nbsp; &nbsp; mfcs70u.pdbnmfc70ud.lib mfc70ud.pdb<br/>复制到\Program Files\Microsoft Visual Studio 8\VC\atlmfc\lib。<br/>2&nbsp;&nbsp;新建ARX程序:<br/>3&nbsp; &nbsp;设计程序属性如下:<br/>&nbsp;&nbsp;a、在配置下拉框中选择“所有配置”;<br/>&nbsp; &nbsp;b、找到左端树结构中“配置属性-&gt;C/C++-&gt;常规”,在其右端“附加包含目录”项中填入Object <br/><br/>ARX2007下的inc文件夹路径和自己的附加文件夹的路径;警告等级选择1级(/w1)<br/>&nbsp; &nbsp;c、找到左端树结构中“配置属性-&gt;链接器-&gt;常规”,在其右端“附加库目录”项中填入<br/><br/>ObjectARX2007下的lib文件夹路径;<br/>&nbsp; &nbsp;d、找到左端树结构中“配置属性-&gt;链接器-&gt;输入”,在其右端“附加依赖项”项中填入<br/><br/>“acad.lib AcCamera.lib acdb17.lib AcDblClkEditPE.lib acdbmgd.lib AcDbMPolygon17.lib acedapi.lib AcFdEval.lib AcFdUi.lib acge17.lib acgiapi.lib achapi17.lib acismobj17.lib AcSceneOE.lib AcTc.lib AcTcUi.lib acui17.lib adui17.lib aNav.lib aseapi17.lib asiapi17.lib axdb.lib oleaprot.lib rxapi.lib”;</div>

zhang007 发表于 2007-4-30 10:12:00

基础倒是学得挺扎实的.

yuze1980 发表于 2007-5-5 00:26:00

<p>厚街男孩 版主:</p><p>你好,我需要.NET2002中的</p><p>mfc70.lib&nbsp;mfc70d.lib mfc70u.lib mfc70ud.lib mfcs70.li mfcs70.pdb&nbsp;&nbsp;</p><p>mfcs70d.lib mfcs70d.pdb mfcs70u.lib&nbsp; mfcs70u.pdbnmfc70ud.lib mfc70ud.pdb</p><p>等12个文件</p><p>你能帮帮我么?</p><p>我的信箱是<a href="mailto:jiaoxufei2005@163.com">jiaoxufei2005@163.com</a></p><p>把这12个文件发给我吧!谢谢!<br/></p>

BDYCAD 发表于 2007-5-6 09:30:00

以发到你的E-MAIL了,请查收.

guojiang 发表于 2007-5-15 17:30:00

<p>这个帖子真不错</p>
页: [1] 2 3 4 5 6
查看完整版本: 学习ARX,编个初组的命令,呵呵