![]() |
【转帖】学习arx,编个初组的命令,呵呵
学习arx,编个初组的命令,呵呵
三点画弧arx源代码: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59acdbblocktablerecord *getmodelspace(acdb::openmode mode){ acdbdatabase *pdwg = acdbhostapplicationservices()->workingdatabase(); acdbblocktable *pblocktable; acdbblocktablerecord *pmodelspace; pdwg->getsymboltable(pblocktable, acdb::kforread); pblocktable->getat(acdb_model_space, pmodelspace, mode); pblocktable->close(); return pmodelspace; } //功能:三点画弧 //编程:包达勇 //时间: 我也发发,最简单的jig class crectjig :public acedjig { public: crectjig() { pline = 0; ncolor = 1; } ~crectjig() { if (pline) { delete pline; pline = 0; } } void setcolor(int color){ncolor = color;} bool doit() { if(!pline) pline = new acdbpolyline; ads_point pt1; if(ads_getpoint(null,str,pt1)!=rtnorm) { return false; } pts = transucs2wcs(aspnt3d(pt1),false); pte = acgepoint3d(pts.x+1,pts.y+1,0); pline->addvertexat(0,acgepoint2d(pts.x,pts.y)); pline->addvertexat(1,acgepoint2d(pts.x,pte.y)); pline->addvertexat(2,acgepoint2d(pte.x,pte.y)); pline->addvertexat(3,acgepoint2d(pte.x,pts.y)); pline->setclosed(adesk::ktrue); pline->setcolorindex(ncolor); setdispprompt("一些描述"); acedjig::dragstatus stat = drag(); if (stat != acedjig::knormal) return false; return true; } dragstatus sampler() { dragstatus stat; setuserinputcontrols((userinputcontrols) (acedjig::kaccept3dcoordinates | acedjig::knonegativeresponseaccepted | acedjig::knozeroresponseaccepted)); acgepoint3d pt; stat = acquirepoint(pt); if (!pt.isequalto(pte)) pte = pt; else if (stat == acedjig::knormal) return acedjig::knochange; return stat; } adesk::boolean update() { pline->setpointat(0,acgepoint2d(pts.x,pts.y)); pline->setpointat(1,acgepoint2d(pts.x,pte.y)); pline->setpointat(2,acgepoint2d(pte.x,pte.y)); pline->setpointat(3,acgepoint2d(pte.x,pts.y)); return adesk::ktrue; } acdbentity* entity() const { return pline; } public: acdbpolyline * pline; acgepoint3d pts,pte; int ncolor; }; transucs2wcs()是一个函数转换点的,ucs到世界坐标的 |
所有的时间均为北京时间。 现在的时间是 09:01 AM. |