- UID
- 7119
- 积分
- 111
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-7-1
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
void projectLine(ads_name sellectLine)
{
struct resbuf *pointbuf,*eb;
AcGePoint3d newstart,newend;
pointbuf=acdbEntGet(sellectLine);
eb=pointbuf;
//get start point
do eb=eb->rbnext;
while (eb->restype!=10);
AcGePoint3d startPt(eb->resval.rpoint[X],
eb->resval.rpoint[Y],eb->resval.rpoint[Z]);
//get end point
eb=eb->rbnext;
AcGePoint3d EndPt(eb->resval.rpoint[X],
eb->resval.rpoint[Y],eb->resval.rpoint[Z]);
project_45(startPt,newstart);
project_45(EndPt,newend);
AcDbLine *pLine=new AcDbLine(newstart,newend);
//pline add to database
AcDbBlockTable *pBlockTable;
acdbHostApplicationServices()->workingDatabase()->
getSymbolTable(pBlockTable,AcDb::kForWrite);
AcDbBlockTableRecord *pBlockTableRecord;
pBlockTable->getAt(ACDB_MODEL_SPACE,pBlockTableRecord,
AcDb::kForWrite);
pBlockTable->close();
AcDbObjectId lineId;
pBlockTableRecord->appendAcDbEntity(lineId,pLine);
pBlockTableRecord->close();
pLine->close();
acutRelRb(pointbuf);
//return lineId;
}
void SelectSprPipe()
{
//select pipe system layer
struct resbuf sprsys;
char sbuf1[10];
ads_name namesprsys;
sprsys.restype=8;
strcpy(sbuf1,"pipelayer");
sprsys.resval.rstring=sbuf1;
sprsys.rbnext=NULL;
acedSSGet("x",NULL,NULL,&sprsys,namesprsys);
//select first entity
ads_name prient;
ads_name rearent;
if (acdbEntNext(NULL,prient)!=RTNORM)
{
acdbFail("No entities selected!\n");
}
projectLine(prient);
while (acdbEntNext(prient,rearent)==RTNORM);
{
acdbEntNext(prient,rearent);
projectLine(rearent);
}
acedSSFree(namesprsys);
}
过程是选择PIPILAYER中所有的线段,取起点和终点,投影后生成新线段。如果没有while (acdbEntNext(prient,rearent)==RTNORM)这个循环,没有问题。可是有了循环,编译一切正常,但在CAD下运行就死机了。
请教各位~~~ |
|