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/> struct resbuf *Cirlist;<br/> ads_point PT1={0,0,0};<br/> Cirlist=acutBuildList(RTDXF0,"CIRCLE",100,"AcDbEntity",100,"AcDbCircle",8,"0",40,0.8,10,PT1,0);<br/> acdbEntMake(Cirlist);</p><p>用ARX的类生成一个圆的代码:<br/>ads_real rad=3.0;<br/> AcGePoint3d Cpt(0,0,0);<br/> AcGeVector3d Vec(0,0,1);<br/> AcDbCircle *nc=new AcDbCircle();<br/> nc->setCenter(Cpt);<br/> nc->setRadius(rad);<br/> AcDbBlockTable *btable;<br/> acdbHostApplicationServices()->workingDatabase()->getSymbolTable(btable,AcDb::kForRead);<br/> AcDbBlockTableRecord *brecord;<br/> btable->getAt(ACDB_MODEL_SPACE,brecord,AcDb::kForWrite);<br/> brecord->appendAcDbEntity(nc);<br/> nc->close();<br/> btable->close();<br/> brecord->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/> ads_point pt1;<br/> AcDbObjectId ObjID;<br/> if (acedEntSel("\n请选个对象:",name,pt1)!=RTNORM)return;<br/> acdbGetObjectId(ObjID,name);<br/> if (ObjID.isErased()==TRUE) {<br/> acutPrintf("\n对象给我们删除了\n");<br/> }else{<br/> acutPrintf("\n对象存在\n");<br/> }<br/>当选到对象是命令行就会提示:<br/>Command: test</p><p>请选个对象:<br/>对象存在<br/></p><p>2、<br/>ads_name name;<br/> ads_point pt1;<br/> AcDbObjectId ObjID;<br/> if (acedEntSel("\n请选个对象:",name,pt1)!=RTNORM)return;<br/> acdbGetObjectId(ObjID,name);<br/> acdbEntDel(name);<br/> if (ObjID.isErased()==TRUE) {<br/> acutPrintf("\n对象给我们删除了\n");<br/> }else{<br/> acutPrintf("\n对象存在\n");<br/> }<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,&sslen);<br/>for (int i=0;sslen>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()>i;i++) {<br/> ObjID=ALLID.at(i);<br/> acdbOpenObject(pEnt,ObjID,AcDb::kForWrite);<br/> pEnt->setColorIndex(1);<br/> pEnt->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/> AcDbEntity *pEnt1,*pEnt2;<br/> AcGePoint3dArray PTlist;<br/> acdbOpenObject(pEnt1,ObjID1,AcDb::kForRead);<br/> acdbOpenObject(pEnt2,ObjID2,AcDb::kForRead);<br/> pEnt1->intersectWith(pEnt2,AcDb::kExtendArg,PTlist);<br/> pEnt1->close();<br/> pEnt2->close();<br/> return PTlist;<br/>}</p>
wtq
发表于 2007-10-30 23:23:00
谢谢大哥,太谢谢了!