objectarx二次开发,文字实体AcDbText获取插入点不准确的问题

AcDbText::position Function

AcGePoint3d position() const;

	This function returns the insertion point of the text in WCS coordinates.
	If vertical mode is AcDb::kTextBase and horizontal mode is either AcDb::kTextLeft, AcDb::kTextAlign, or AcDb::kTextFit, then the position point is the insertion point for the text object and, for AcDb::kTextLeft, the alignment point (DXF group code 11) is automatically calculated based on the other parameters in the text object.
	For all other vertical and horizontal mode combinations, the alignment point is used as the insertion point of the text and the position point is automatically calculated based on the other parameters in the text object.
	The position value is the WCS equivalent of DXF group code 10.
大概意思就是:verticalMode() == AcDb::kTextBase时,如果 horizontalMode()== AcDb::kTextLeft 或 horizontalMode()== AcDb::kTextAlign 或 horizontalMode()== AcDb::kTextFit,那么position() 函数就是文字的插入点,否则alignmentPoint ()就是插入点

AcDbText::alignmentPoint Function

AcGePoint3d alignmentPoint() const;

	This function returns the alignment point of the text.
	If vertical mode is AcDb::kTextBase and horizontal mode is either AcDb::kTextLeft, AcDb::kTextAlign, or AcDb::kTextFit, then the position point (DXF group code 10) is the insertion point for the text object and, for AcDb::kTextLeft, the alignment point is automatically calculated based on the other parameters in the text object.
	For all other vertical and horizontal mode combinations, the alignment point is used as the insertion point of the text and the position point is automatically calculated based on the other parameters in the text object.
	The alignment point value is the WCS equivalent of DXF group code 11.

获取文字插入点函数如下

	AcDbText * pEntityPtr;
	AcGePoint3d insertPosition;
	if (pEntityPtr->verticalMode() == AcDb::kTextBase)
	{
		TextHorzMode hzModel = pEntityPtr->horizontalMode();
		if (hzModel == AcDb::kTextLeft ||hzModel == AcDb::kTextAlign || hzModel == AcDb::kTextFit)
		{
			insertPosition = pEntityPtr->position();
		}else{
			insertPosition = pEntityPtr->alignmentPoint();
		}
	}else{
			insertPosition = pEntityPtr->alignmentPoint();
	}

如有问题,欢迎拍砖留言指正

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值