why below code highlight symbol, instead of highlight selected attribute only? [2:06 PM]…
- User
why below code highlight symbol, instead of highlight selected attribute only? [2:06 PM] TRUONG, Do Quoc // Get the block reference object
AcDbBlockReference *blkRef;
acdbOpenObject(blkRef, blkRefId, AcDb::kForRead);
// Get the attribute collection of the block reference
AcDbObjectIterator *pIter = blkRef->attributeExtension();
// Iterate through the attribute collection
while (!pIter->done())
{
// Get the attribute object
AcDbAttribute *pAttribute;
acdbOpenObject(pAttribute, pIter->objectId(), AcDb::kForRead);
// Create a subentity path for the attribute object
AcDbFullSubentPath subPath;
subPath.objectIds().append(blkRef->objectId());
// Append the attribute object ID to the subentity path
subPath.objectIds().append(pAttribute->objectId());
// Highlight the attribute object
blkRef->highlight(subPath);
// Close the attribute object
pAttribute->close();
// Move to the next attribute object
pIter->step();
}
// Close the block reference object
blkRef->close();
// Delete the attribute iterator
delete pIter;
- Assistant
The code is highlighting the entire block reference object (blkRef) instead of just highlighting the selected attribute object. This is because the line "blkRef->highlight(subPath);" is highlighting the subentity path, which includes both the block reference object and the attribute object. If you only want to highlight the selected attribute object, you can remove this line and it will only highlight the attribute object itself.