Thanks, this is exactly what I was looking for. While BricsCAD is my primary target, all of my routines still need to run on AutoCAD as well. A couple, not this one, require that I have distinct code for each.
This is the complete function I am updating at the moment:
(defun HASD:AddMText ( ptIns nHt nRot sStyle sText sJust / )
(cond
((= sJust "TL") (setq sJustify acAttachmentPointTopLeft))
((= sJust "TC") (setq sJustify acAttachmentPointTopCenter))
((= sJust "TR") (setq sJustify acAttachmentPointTopRight))
((= sJust "ML") (setq sJustify acAttachmentPointMiddleLeft))
((= sJust "MC") (setq sJustify acAttachmentPointMiddleCenter))
((= sJust "MR") (setq sJustify acAttachmentPointMiddleRight))
((= sJust "BL") (setq sJustify acAttachmentPointBottomLeft))
((= sJust "BC") (setq sJustify acAttachmentPointBottomCenter))
((= sJust "BR") (setq sJustify acAttachmentPointBottomRight))
(t (setq sJustify acAttachmentPointMiddleCenter))
)
(setq nTextWidth 0) ; width of Mtext object still needs to be calculated
(vla-SetVariable thisdrawing "TEXTSIZE" nHT)
(setq myMText (vla-AddMText mspace (vlax-3d-point ptIns) nTextWidth sText))
(if (= (vlax-property-available-p myMText 'AttachmentPoint) T)
(vlax-put-property myMText 'AttachmentPoint sJustify))
(if (= (vlax-property-available-p myMText 'Rotation) T)
(vlax-put-property myMText 'Rotation (HASD:D2R nRot)))
(if (= (vlax-property-available-p myMText 'StyleName) T)
(vlax-put-property myMText 'StyleName sStyle))
(if (= (vlax-property-available-p myMText 'InsertionPoint) T)
(vlax-put-property myMText 'InsertionPoint (vlax-3d-point ptIns)))
(princ)
)