返回实体的捕捉点信息,自定义实体重载该函数,返回捕捉信息
virtual Mcad::ErrorStatus getOsnapPoints(McDb::OsnapMode osnapMode, int gsSelectionMark, const McGePoint3d& pickPoint, const McGePoint3d& lastPoint, const McGeMatrix3d& viewXform, McGePoint3dArray& snapPoints, McDbIntArray& geomIds) const;
参数 |
说明 |
McDb::OsnapMode osnapMode |
捕捉类型 |
int gsSelectionMark |
暂没有使用 |
const McGePoint3d& pickPoint |
当前鼠标拾取点 |
const McGePoint3d& lastPoint |
前一次的鼠标拾取点 |
const McGeMatrix3d& viewXform |
暂没有使用 |
McGePoint3dArray& snapPoints |
返回捕捉的点坐标数组 |
McDbIntArray& geomIds |
暂没有使用 |
如果成功返回Mcad::eOk
例如:参考samplesCustomEntityCustomEntity.sln例程
Mcad::ErrorStatus CLinkBlock::getOsnapPoints( McDb::OsnapMode osnapMode, int gsSelectionMark, const McGePoint3d& pickPoint, const McGePoint3d& lastPoint, const McGeMatrix3d& viewXform, McGePoint3dArray& snapPoints, McDbIntArray& geomIds) const { assertReadEnabled(); if(osnapMode == AcDb::kOsModeEnd ) { McDbBlockReference tmpBlkRef; tmpBlkRef.setPosition(m_pos); tmpBlkRef.setScaleFactors(m_scale); tmpBlkRef.setRotation(m_dRotation); tmpBlkRef.setBlockTableRecord(m_idBlkRec); McGeMatrix3d mat = tmpBlkRef.blockTransform(); for(int i =0; i < m_aryLinkPoint.length();i++) { AcGePoint3d tmp = m_aryLinkPoint[i]; tmp.transformBy(mat); snapPoints.append(tmp); } } else if(osnapMode == AcDb::kOsModeIns) { snapPoints.append(m_pos); } return Acad::eOk; }