- UID
- 192350
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2004-11-13
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
ARX自定义捕捉(AcDbCustomOsnapInfo)中的两个问题
1. 如果同时捕捉一条直线的中点与最近点,例子如下,但在捕捉中点的时候非常不易,总是受最近点的影响. 猜想可以pickPoint与中点之间的显示距离小于一定像素时,只追加中点,而不再追加最近点,但又不能计算它们之间的显示距离(像素值)
Acad::ErrorStatus
AsdkThirdOsnapCurveInfo::getOsnapInfo(
AcDbEntity* pickedObject,
int gsSelectionMark,
const AcGePoint3d& pickPoint,
const AcGePoint3d& lastPoint,
const AcGeMatrix3d& viewXform,
AcArray<AcGePoint3d>& snapPoints,
AcArray<int>& geomIdsForPts,
AcArray<AcGeCurve3d*>& snapCurves,
AcArray<int>& geomIdsForLines)
{
if(pickedObject->isKindOf(AcDbLine::desc()))
{
AcDbLine *pLine=AcDbLine::cast(pickedObject);
double startParam, endParam;
Acad::ErrorStatus es=pLine->getStartParam( startParam);
es=pLine->getEndParam( endParam );
AcGePoint3d pt;
es=pLine->getPointAtParam( 0.5*(startParam + endParam), pt );
snapPoints.append(pt);
pLine->getClosestPointTo(pickPoint, pt);
snapPoints.append(pt);
}
return Acad::eOk;
}
2. 怎样捕捉圆(圆弧的圆心)?问题是:鼠标移到圆弧上时,并没有显示圆心符号. 如果加上以下一段:
AcGeLine3d *pLine1=new AcGeLine3d(pt, pt+AcGeVector3d(1, 0, 0));
snapCurves.append(pLine1);
能显示圆心符号,并能进行X方向的对象追踪,但鼠标移到圆心位置时,圆心符号即消失.
AsdkThirdOsnapCurveInfo::getOsnapInfo(
AcDbEntity* pickedObject,
int gsSelectionMark,
const AcGePoint3d& pickPoint,
const AcGePoint3d& lastPoint,
const AcGeMatrix3d& viewXform,
AcArray<AcGePoint3d>& snapPoints,
AcArray<int>& geomIdsForPts,
AcArray<AcGeCurve3d*>& snapCurves,
AcArray<int>& geomIdsForLines)
{
if(pickedObject->isKindOf(AcDbArc::desc()))
{
AcDbArc *pArc=AcDbArc::cast(pickedObject);
AcGePoint3d pt;
pArc->getStartPoint(pt);
snapPoints.append(pt);
pArc->getEndPoint(pt);
snapPoints.append(pt);
pt=pArc->center();
snapPoints.append(pt);
//AcGeLine3d *pLine1=new AcGeLine3d(pt, pt+AcGeVector3d(1, 0, 0));
//snapCurves.append(pLine1);
//AcGeLine3d *pLine2=new AcGeLine3d(pt, pt+AcGeVector3d(0, 1, 0));
//snapCurves.append(pLine2);
//AcGeCircArc3d *pCircle=new AcGeCircArc3d(pt, AcGeVector3d(0, 0, 1), 1);
//snapCurves.append(pCircle);
pArc->getClosestPointTo(pickPoint, pt);
snapPoints.append(pt);
geomIdsForPts.append(pArc->id().asOldId());
geomIdsForPts.append(pArc->id().asOldId());
return Acad::eOk;
}
return Acad::eOk;
}
高手快来帮一把啊,这两个问题搞得我很郁闷. |
|