Unable to Locate Element After Scaling

Hello,

We have an MDL app that scales text/cell elements. We noticed that if the scale of the element was anything other 1, the ILocateCommandEvents will no longer be able to select those elements. Here's the code that we're using to scale elements. Are we doing anything wrong to make the element unselectable?

static void scale_element(const long attr_mode, MSElementDescrP *descrip, MSElementDescrCP original, const double factor)
{
	if ((attr_mode & ATTRIBUTE_SCALE) != ATTRIBUTE_SCALE)
	{
		return;
	}

	Dpoint3d origin;
	TextBlockPtr textBlock;
	switch (mdlElement_getType(&original->el))
	{
		case DgnPlatform::CELL_HEADER_ELM:
			mdlCell_extract(&origin, NULL, NULL, NULL, NULL, 0, &original->el);
			break;

		case DgnPlatform::TEXT_ELM:
		case DgnPlatform::TEXT_NODE_ELM:
			textBlock = TextHandlerBase::GetFirstTextPartValue(ElementHandle(original, false));
			origin = textBlock->GetUserOrigin();
			break;

			//mdlTextNode_extract(&origin, NULL, NULL, NULL, NULL, NULL, &original->el, original);
			//break;

		//Potential future enhancements
		case DgnPlatform::LINE_ELM:
		case DgnPlatform::LINE_STRING_ELM:
		case DgnPlatform::SHAPE_ELM:
			//mdlLinear_extract(&origin, NULL, &(element->el), modelRef);
			return;

		case DgnPlatform::ELLIPSE_ELM:
			//mdlArc_extract(&origin, NULL, NULL, NULL, NULL, NULL, NULL, &(element->el));
			return;				

		case DgnPlatform::DIMENSION_ELM:
			return;

		case DgnPlatform::CMPLX_STRING_ELM:
			return;

		case DgnPlatform::CMPLX_SHAPE_ELM:
			return;

		default:
			return;
	}

	Transform transform;
	mdlTMatrix_getIdentity(&transform);
	mdlTMatrix_scale(&transform, &transform, factor, factor, factor);
	mdlTMatrix_setOrigin(&transform, &origin);
	
	mdlElmdscr_transformAllowModification(descrip, &transform, MASTERFILE, MASTERFILE, DgnPlatform::TRANSFORM_OPTIONS_ModelFromElmdscr);
}

Thank you,

Kevin

Parents Reply Children
No Data