[求助]SPLINE的橡皮筋问题
版主或高手:在ARX中我需要用户自画样条曲线。1.如果用acedGetPoint得到系列点再画,则用户感觉不直观。2.如果用 acedIinitGet边拾点边橡皮筋,则只是直线。3.如果用acedCommand,并用钩子函数检测消息,可以得到曲线橡皮筋,而键盘、鼠标及弹出菜单的检测相当复杂,甚至不能。
还有其它办法吗?请大师一定赐教!!!
aaa
这段代码可以动态拉出一个SPLINE橡皮筋, 并以RButtonDown结束.但存在一些问题. 谁知道如果解决请一定告诉我:
1.无法Osnap2.如果想使用键盘回车结束绘制,如果检测?
void drag()
{
int track, type;
struct resbuf result;
AcGePoint3d pt;
//spline的橡皮筋
AcDbBlockTable *pBlockTable;
AcDbBlockTableRecord *pBlockTableRecord;
AcDbObjectId idSpline;
AcDbSpline *pSpline;
AcGePoint3dArray pts;
pts.append(AcGePoint3d(0, 0, 0));
acdbCurDwg()->getBlockTable(pBlockTable, AcDb::kForRead);
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite);
pBlockTable->close();
track = 1;
while (track > 0)
{
acedGrRead(track, &type, &result);
pt.x = result.resval.rpoint;
pt.y = result.resval.rpoint;
pt.z = result.resval.rpoint;
//acutPrintf("\n(track = %d, type = %d, %lf,%lf, %lf)", track, type, pt.x, pt.y, pt.z);
if (type == 2) // keyboard
{
//result.resval
}
if (type == 3) // LButtonDown
{
pts = pt;
pts.append(pt);
}
else if (type == 5) // MouseMove
{
if (pts.length() >= 2)
{
if (acdbOpenObject(pSpline, idSpline, AcDb::kForWrite) == Acad::eOk)
{
pSpline->erase();
pSpline->close();
}
pts = pt;
pSpline = new AcDbSpline(pts);
pBlockTableRecord->appendAcDbEntity(idSpline, pSpline);
pSpline->close();
}
}
else if (type == 25) // RButtonDown
{
if (acdbOpenObject(pSpline, idSpline, AcDb::kForWrite) == Acad::eOk)
{
pSpline->erase();
pSpline->close();
}
pts.removeLast();
if (pts.length() >= 2)
{
pSpline = new AcDbSpline(pts);
pBlockTableRecord->appendAcDbEntity(idSpline, pSpline);
pSpline->close();
}
track = 0;
}
}
pBlockTableRecord->close();
}
页:
[1]