BDYCAD 发表于 2007-7-18 11:33:00

本帖最后由 作者 于 2007-7-18 11:46:14 编辑 <br /><br /> <p>struct resbuf 结构就象LISP里面的表((LISP a b)(LISP a b)(LISP a b)(LISP a b).....) 之类的东东,主要是用来做一个对象的DXF组码链表,然后用来给别的涵数生成对象之类的处理,如果是生成对象的话我们可以不用struct resbuf结构来做,直用用对象类来生成啊.例如:</p><p>LISP用DXF组码生成一个圆的代码:<br/>(setq Cirlist '((0 . "CIRCLE")(100 . "AcDbEntity")(100 . "AcDbCircle")(8 . "0")(40 . 0.8) (10 0 0 0)))<br/>(entmake Cirlist)</p><p>ARX用struct resbuf 生成一个圆的代码:<br/>&nbsp;&nbsp;struct resbuf *Cirlist;<br/>&nbsp;&nbsp;ads_point PT1={0,0,0};<br/>&nbsp;&nbsp;Cirlist=acutBuildList(RTDXF0,"CIRCLE",100,"AcDbEntity",100,"AcDbCircle",8,"0",40,0.8,10,PT1,0);<br/>&nbsp;&nbsp;acdbEntMake(Cirlist);</p><p>用ARX的类生成一个圆的代码:<br/>ads_real rad=3.0;<br/>&nbsp;&nbsp;AcGePoint3d Cpt(0,0,0);<br/>&nbsp;&nbsp;AcGeVector3d Vec(0,0,1);<br/>&nbsp;&nbsp;AcDbCircle *nc=new AcDbCircle();<br/>&nbsp;&nbsp;nc-&gt;setCenter(Cpt);<br/>&nbsp;&nbsp;nc-&gt;setRadius(rad);<br/>&nbsp;&nbsp;AcDbBlockTable *btable;<br/>&nbsp;&nbsp;acdbHostApplicationServices()-&gt;workingDatabase()-&gt;getSymbolTable(btable,AcDb::kForRead);<br/>&nbsp;&nbsp;AcDbBlockTableRecord *brecord;<br/>&nbsp;&nbsp;btable-&gt;getAt(ACDB_MODEL_SPACE,brecord,AcDb::kForWrite);<br/>&nbsp;&nbsp;brecord-&gt;appendAcDbEntity(nc);<br/>&nbsp;&nbsp;nc-&gt;close();<br/>&nbsp;&nbsp;btable-&gt;close();<br/>&nbsp;&nbsp;brecord-&gt;close();</p>

BDYCAD 发表于 2007-7-20 09:21:00

本帖最后由 作者 于 2007-7-20 9:41:42 编辑

//功能:制作图块
//编程:BDYCAD
//时间:2007-07-20早
static void BDYCAD_TEST(void)
{
ads_name name,ss;
ads_point pt1,pt2;
char BlockName;
AcGePoint3d Cpt;
int sel;long len;
AcDbObjectId BID;
if (acedSSGet(NULL,NULL,NULL,NULL,ss)!=RTNORM)return;
if (acedGetPoint(NULL,"\n输入基准点:",pt1)!=RTNORM)return;
if (acedGetString(FALSE,"\n请输入块名:",BlockName)!=RTNORM)return;
Cpt.x=pt1;Cpt.y=pt1;Cpt.z=pt1;
AcDbBlockTable *pBlockTable;
acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable,AcDb::kForWrite);
if (pBlockTable->has(BlockName)==Adesk::kTrue) {
   acutPrintf("\n这个块已经建立了!");
   pBlockTable->close();
   return;
}
AcDbBlockTableRecord *pBlockTableRec= new AcDbBlockTableRecord();
pBlockTableRec->setName(BlockName);
pBlockTable->add(pBlockTableRec);
pBlockTableRec->setOrigin(Cpt);
pBlockTable->upgradeOpen();
AcDbEntity *pEnt,*pEnt0;
acedSSLength(ss,&len);
for (int i=0;i<len;i++) {
   AcDbObjectId ObjID;
   acedSSName(ss,i,name);
   acdbGetObjectId(ObjID,name);
   acdbOpenAcDbEntity(pEnt,ObjID,AcDb::kForWrite);
   pEnt0=(AcDbEntity*)pEnt->clone();
   pBlockTableRec->appendAcDbEntity(pEnt0);
   pEnt->close();
   pEnt0->close();
}
pBlockTable->close();
pBlockTableRec->close();
return;
}

zhbt5257 发表于 2007-7-20 14:57:00

楼上的仁兄:谁有.net 2002下的mfc70相关的几个lib文件,小弟也急需一份,麻烦给小弟传一份!!!谢谢了!
邮箱:terry_5257@163.com

谢谢!!!!

BDYCAD 发表于 2007-7-20 15:39:00

<p>看来好多朋友都在找这些文件,现在上传上来给大家:) 希望可以帮的到大家:)</p><p></p>

zhbt5257 发表于 2007-7-23 10:15:00

谢谢~~~~~

<p>太感谢了1~~哈哈。。。。。。。。。</p><p>找了好几天了,谢谢大哥!!!</p>

zjqmax 发表于 2007-7-26 09:22:00

谢谢这位兄弟!找了几个月了

BDYCAD 发表于 2007-8-2 16:09:00

<p>用对象的ID可以判断一个对象是否给删除了,代码如下<br/>1、<br/>ads_name name;<br/>&nbsp;&nbsp;ads_point pt1;<br/>&nbsp;&nbsp;AcDbObjectId ObjID;<br/>&nbsp;&nbsp;if (acedEntSel("\n请选个对象:",name,pt1)!=RTNORM)return;<br/>&nbsp;&nbsp;acdbGetObjectId(ObjID,name);<br/>&nbsp;&nbsp;if (ObjID.isErased()==TRUE) {<br/>&nbsp;&nbsp;&nbsp;acutPrintf("\n对象给我们删除了\n");<br/>&nbsp;&nbsp;}else{<br/>&nbsp;&nbsp;&nbsp;acutPrintf("\n对象存在\n");<br/>&nbsp;&nbsp;}<br/>当选到对象是命令行就会提示:<br/>Command: test</p><p>请选个对象:<br/>对象存在<br/></p><p>2、<br/>ads_name name;<br/>&nbsp;&nbsp;ads_point pt1;<br/>&nbsp;&nbsp;AcDbObjectId ObjID;<br/>&nbsp;&nbsp;if (acedEntSel("\n请选个对象:",name,pt1)!=RTNORM)return;<br/>&nbsp;&nbsp;acdbGetObjectId(ObjID,name);<br/>&nbsp;&nbsp;acdbEntDel(name);<br/>&nbsp;&nbsp;if (ObjID.isErased()==TRUE) {<br/>&nbsp;&nbsp;&nbsp;acutPrintf("\n对象给我们删除了\n");<br/>&nbsp;&nbsp;}else{<br/>&nbsp;&nbsp;&nbsp;acutPrintf("\n对象存在\n");<br/>&nbsp;&nbsp;}<br/>当选到对象是命令行就会提示:<br/>Command: test</p><p>请选个对象:<br/>对象给我们删除了</p><p></p>

BDYCAD 发表于 2007-8-3 14:13:00

<br/>//学习AcDbObjectIdArray的代码<br/>//编写:BDYCAD<br/>//2007-08-02<br/>int IDnumber;<br/>long sslen;<br/>ads_name name,SS;<br/>ads_point p1;<br/>AcDbEntity *pEnt;<br/>AcDbObjectId ObjID,ObjID1;<br/>AcDbObjectIdArray ALLID;<br/>if (acedSSGet(NULL,NULL,NULL,NULL,SS)!=RTNORM)return;<br/>if (acedEntSel("\n请选择一个对象:",name,p1)!=RTNORM)return;<br/>acdbGetObjectId(ObjID1,name);<br/>acedSSLength(SS,&amp;sslen);<br/>for (int i=0;sslen&gt;i;i++) {<br/>   acedSSName(SS,i,name);<br/>   acdbGetObjectId(ObjID,name);<br/>   ALLID.append(ObjID);<br/>}<br/>if (ALLID.find(ObjID1,IDnumber)==TRUE) {<br/>   //acutPrintf("\n我们在ID集中找到了这个ID,是第%d 个ID\n",IDnumber);<br/>   ALLID.remove(ObjID1);<br/>}else{<br/>   acutPrintf("\n找不着\n");<br/>}<br/>for (int i=0;ALLID.length()&gt;i;i++) {<br/>   ObjID=ALLID.at(i);<br/>   acdbOpenObject(pEnt,ObjID,AcDb::kForWrite);<br/>   pEnt-&gt;setColorIndex(1);<br/>   pEnt-&gt;close();<br/>}<br/>acutPrintf("\n总共有 %d 个对象ID:\n",ALLID.length());

BDYCAD 发表于 2007-8-3 17:08:00

<p>取对象交点代码:<br/>今天刚写的:)</p><p>//功能:取两个对象的真实相交点。<br/>//编写:BDYCAD<br/>//时间:2007-08-03<br/>AcGePoint3dArray Get2ObjIDIntresPoints(AcDbObjectId ObjID1,AcDbObjectId ObjID2){<br/>&nbsp;AcDbEntity *pEnt1,*pEnt2;<br/>&nbsp;AcGePoint3dArray PTlist;<br/>&nbsp;acdbOpenObject(pEnt1,ObjID1,AcDb::kForRead);<br/>&nbsp;acdbOpenObject(pEnt2,ObjID2,AcDb::kForRead);<br/>&nbsp;pEnt1-&gt;intersectWith(pEnt2,AcDb::kExtendArg,PTlist);<br/>&nbsp;pEnt1-&gt;close();<br/>&nbsp;pEnt2-&gt;close();<br/>&nbsp;return PTlist;<br/>}</p>

wtq 发表于 2007-10-30 23:23:00

谢谢大哥,太谢谢了!
页: 1 2 [3] 4 5 6
查看完整版本: 学习ARX,编个初组的命令,呵呵