Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
In AutoCAD 2108, I have a function that displays errors by highlighting the relevant entities. This is working well. I want to subsequently have a Next / Previous part of the function to "go to" each entity. This also works, but when I "Goto" the highlighting no longer shows (though if I test the entity's highlight state it is still highlighted).
My Goto function (below) causes a "Regenerating model" - I think that might be the issue. I've tried queue / flush / update, acdbEntUpd and issuing a REGEN but I can't get the highlight to come back.
Are there any other options?
//------------------------------------------------------------------------------ void Goto(double dX, double dY, BOOL bZoom) //------------------------------------------------------------------------------ { Acad::ErrorStatus es = Acad::eOk; AcDbDatabase* pDb = pApp->GetCurrentAcDb(); if (pDb != NULL) { // Get the viewport es = acedVports2VportTableRecords(); AcDbViewportTable *pVpT = NULL; AcDbViewportTableRecord *pActVp = NULL; AcGePoint2d centerpt; double height = 0.0L; double width = 0.0L; // Get the *Active view port es = pDb->getViewportTable(pVpT, AcDb::kForRead); if (pVpT != NULL) { es = pVpT->getAt(_T("*ACTIVE"), pActVp, AcDb::kForWrite); es = pVpT->close(); if (pActVp != NULL) { centerpt = pActVp->centerPoint(); height = pActVp->height(); width = pActVp->width(); // Close the Active viewport es = pActVp->close(); // Update the viewport es = acedVportTableRecords2Vports(); } } // Notify CString sMsg = _T(""); sMsg.Format(RESSTR(IDS_MOVINGTO), dX, dY); pApp->DisplayMessage(0, sMsg); // This is the same as ZoomTo - but without the unit conversion centerpt.x = dX; centerpt.y = dY; // Adjust for UCS acdbUcs2Wcs((double*)(¢erpt), (double*)(¢erpt), false); // Adjust zoom state based on design size if required DocSettings* pDocSettings = pApp->GetDocSettings(); if (bZoom && pDocSettings != NULL) { DistanceUnit unit; pApp->GetUnitSettings()->GetUserUnit(&unit); DocSettings::DesignSizes Sizes = pDocSettings->GetDesignSizes(); double basesize = Sizes.m_BaseSymbolSize.GetConvertedValue(unit); (height > 10.0L * basesize) ? height = 10.0L * basesize : height; (width > 10.0L * basesize) ? width = 10.0L * basesize : width; } // Got specified point if (height > 0.001 || width > 0.001) { AcDbViewTableRecord mVTR; mVTR.setCenterPoint(centerpt); mVTR.setHeight(height); mVTR.setWidth(width); es = acedSetCurrentView(&mVTR, NULL); } } }
Solved! Go to Solution.