各位大虾帮帮我,小弟跪谢了(arx编程画多条直线与圆弧的问题)
<p>各位大虾帮帮我,小弟跪谢了(arx编程画多条直线与圆弧的问题)我是个新新新手,刚接触arx一个星期,毕业设计做这个,以前从没接触过,我感觉好复杂,可是这个任务还是要完成的,请各位大哥帮帮我,我现在这个搞不懂:</p><p>我现在在c:盘下有这个文件:(因为我不知道arx中圆弧怎么画需要什么信息所以用省略号代替了,我不太懂)</p><p>line:(xs=0,ys=0,xe=20,ye=80)<br/>arc:(xs=20,ys=80,xe=40,ye=20.....)<br/>line:(xs=0,ys=0,xe=20,ye=80)<br/>line:(xs=0,ys=0,xe=20,ye=80)<br/>arc:(xs=5,ys=404,xe=40,ye=20.....)<br/>arc:(xs=20,ys=80,xe=40,ye=20.....)</p><p>..........................................</p><p>现在我想在arx中编程(我用的是arx2000与autocad2000 )实现这个功能:让autocad加载了我这个arx程序后能自动画出这些首尾相接的直线和圆弧的图形,其实就是数控机床中的图形预览功能(就是输入坐标点能在autocad中看到相应的图形。图中坐标点我没有正确的给出,因为我对圆弧怎么命令还不怎么懂),是不是只要把环境编译好了后在command.cpp中修改下就可以啦?我在command.cpp中编了个这样的可是没有用:</p><p>/////////////////////////////////////////////<br/>// ObjectARX defined commands</p><p>#include "StdAfx.h"<br/>#include <dbents.h><br/>#include<stdio.h><br/>#include<stdlib.h><br/>#include<string.h></p><p><br/>// This is command 'ZDPOINT'<br/>void hemaarxzdpoint()<br/>{<br/> int x1,y1,x2,y2,x3,y3,x4,y4;<br/> char str;<br/> FILE *fp;<br/> fp=fopen("c:/zuobiao.txt", "r");<br/> <br/> while(!feof(fp))<br/> {<br/> fgets(str,4,fp);</p><p> switch (str);<br/> case 'line';<br/> {<br/> fscanf(fp, "line:(xs=%d,ys=%d,xe=%d,ye=%d)\n", &x1, &y1, &x2, &y2);<br/> AcGePoint3d startPt(x1,y1,0.0);<br/> AcGePoint3d endPt(x2,y2,0.0);<br/> AcDbLine *pLine = new AcDbLine(startPt,endPt);<br/> <br/> AcDbDatabase *pCurDb;<br/> pCurDb = acdbHostApplicationServices()->workingDatabase();</p><p><br/> AcDbBlockTable *pBlockTable;<br/> pCurDb->getBlockTable(pBlockTable,AcDb::kForRead);<br/> AcDbBlockTableRecord *pBlockTableRecord;<br/> pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,AcDb::kForWrite);<br/> pBlockTable->close();</p><p> AcDbObjectId lineId;<br/> pBlockTableRecord->appendAcDbEntity(lineId,pLine);<br/> pBlockTableRecord->close();<br/> pLine->close();<br/> //return lineId;<br/> <br/> }<br/> break;<br/> <br/> case 'arc';<br/> { <br/> <br/> fscanf(fp, "arc:(xs=%d,ys=%d,xe=%d,ye=%d.........)\n", &x3, &y3, &x4, &y4);<br/> // AcGePoint3d startPt(x3,y3,0.0);<br/> // AcGePoint3d endPt(x4,y4,0.0);<br/> ///AcDbLine *pLine = new AcDbLine(startPt,endPt);<br/> <br/> AcDbDatabase *pCurDb;<br/> pCurDb = acdbHostApplicationServices()->workingDatabase();</p><p><br/> AcDbBlockTable *pBlockTable;<br/> pCurDb->getBlockTable(pBlockTable,AcDb::kForRead);<br/> AcDbBlockTableRecord *pBlockTableRecord;<br/> pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,AcDb::kForWrite);<br/> pBlockTable->close();</p><p> AcDbObjectId lineId;<br/> pBlockTableRecord->appendAcDbEntity(lineId,pLine);<br/> pBlockTableRecord->close();<br/> pLine->close();<br/> //return lineId;<br/> <br/> }<br/> break;<br/> default<br/> {<br/> printf ("读取错误,请重新输入加工指令!");<br/> }<br/> <br/> }<br/> fclose(fp);</p><p><br/>}</p><p>程序有许多问题,我只是给出我的框架,说实话,连c语言和c++我也是做这个毕业设计时刚刚自学的,请各位大哥教教我,真心谢谢各位了!</p> 如果直线与圆弧首尾相接比较麻烦的话,那就用直线吧,用画直线指令画一个矩形或多边形也可以啊,我跟后面学习学习啊,谢谢各位 <p>哈哈,我现成的源代码,如果需要可以联系</p><p></p> <p>大哥,你好啊,我很需要啊,尽管能不能看懂还是个问题,这个对你们这些高手来说肯定是很简单的问题,但对于我这个菜菜菜菜鸟来说很是个问题,希望您能教教我,谢谢您我加你qq了</p> 我看了以前明经上面的帖子,好像有好几个人遇到这样的问题,其实就是 直线与圆弧连接问题,还请大虾们指教我,谢谢各位 难道没有人会?
页:
[1]