void initApp() { acedRegCmds->addCommand( _T("ASDK_THIRD"), _T("ASDK_SNAP2PLINE"), _T("SNAP2PLINE"), ACRX_CMD_TRANSPARENT, snapToWholePolyline ); acedRegCmds->addCommand( _T("ASDK_THIRD"), _T("ASDK_SNAP2SEG"), _T("SNAP2SEG"), ACRX_CMD_TRANSPARENT, snapToPolylineSegments ); // Add parent protocol extension class description object to hierarchy AsdkThirdOsnapInfo::rxInit(); acrxBuildClassHierarchy(); // Create the protocol extension objects AsdkThirdOsnapEntityInfo *pEntityInfo = new AsdkThirdOsnapEntityInfo; AsdkThirdOsnapCurveInfo *pCurveInfo = new AsdkThirdOsnapCurveInfo; AsdkThirdOsnapPolylineInfo *pPolylineInfo = new AsdkThirdOsnapPolylineInfo; // Register the protocol extension object with parent class object AcDbEntity::desc()->addX( AsdkThirdOsnapInfo::desc(), pEntityInfo ); AcDbCurve::desc()->addX( AsdkThirdOsnapInfo::desc(), pCurveInfo ); AcDbPolyline::desc()->addX( AsdkThirdOsnapInfo::desc(), pPolylineInfo ); acdbCustomOsnapManager()->addCustomOsnapMode( &thirdMode ); acdbCustomOsnapManager()->activateOsnapMode( _T("_third") ); snapToWholePolyline(); }
void initApp() { acedRegCmds->addCommand( "ASDK_DIVISOR", "ASDK_SNAP2PLINE", "SNAP2PLINE", ACRX_CMD_TRANSPARENT, snapToWholePolyline ); acedRegCmds->addCommand( "ASDK_DIVISOR", "ASDK_SNAP2SEG", "SNAP2SEG", ACRX_CMD_TRANSPARENT, snapToPolylineSegments ); // Add parent protocol extension class to hierarchy AsdkDivOsnapInfo<3>::rxInit(); AsdkDivOsnapInfo<4>::rxInit(); AsdkDivOsnapInfo<5>::rxInit(); acrxBuildClassHierarchy(); ASDK_DEFINE_DIVISOR_OSNAP(3,thirdMode,"_third"); ASDK_DEFINE_DIVISOR_OSNAP(4,fourthMode,"_fourth"); ASDK_DEFINE_DIVISOR_OSNAP(5,fifthMode,"_fifth"); snapToWholePolyline(); }