If I use ALE_Block_PutStringOnAttributes on a IAxDbDocument Interface (ODBX document) there are some problem for the attributes that are other than left justified.
If the InsertionPoint is different than the TextAlignmentPoint, the process puts them in coincidence, visually shifting the position of the attribute.
If I open the file and move or copy the block all goes ok... Workaround?
(defun ALE_Block_PutStringOnAttributes (VlaObj ValLst / AttLst TmpLst VlaDoc SstPrp TxtObj AlgTyp ObjClr FthClr TxtVal
TxtOri LenOri LenVal)
(setq
AttLst (ALE_Block_GetAttributes VlaObj)
VlaDoc (vla-get-Document VlaObj) ; un IAxDbDocument non ha questa proprietà a
SstPrp (vlax-property-available-p VlaDoc 'SelectionSets); differenza di IAcadDocument: An AutoCAD drawing
FthClr (vla-get-Color (ALE_Utl_GetItem (vla-get-Layers VlaDoc) (vla-Get-Layer VlaObj)))
)
(foreach ForElm ValLst
(if (setq TmpLst (assoc (strcase (car ForElm)) AttLst))
(progn
(or (setq TxtVal (cdr ForElm)) (setq TxtVal ""))
(setq TxtOri (vla-Get-textstring (setq TxtObj (cadddr TmpLst))))
(vla-Put-textstring TxtObj TxtVal)
(or
SstPrp ; only for IAxDbDocument
(= acAlignmentLeft (setq AlgTyp (vla-Get-Alignment TxtObj))) ; and /= acAlignmentLeft
(progn ; try to fix ScaleFactor
(if (= acAlignmentFit AlgTyp)
(progn
(setq LenOri (strlen TxtOri) LenVal (strlen TxtVal))
(and (zerop LenOri) (setq LenOri 1)) (and (zerop LenVal) (setq LenVal 1))
(vla-Put-ScaleFactor TxtObj (/ (* (vla-Get-ScaleFactor TxtObj) (strlen TxtOri)) (strlen TxtVal)))
); il testo comunque non viene ottimizzato se il font è proporzionale
)
(entmod (entget (vlax-vla-object->ename TxtObj))); per aggiornare la dimensione del testo
)
)
(vla-update TxtObj)
);progn
)
)
(vla-update VlaObj)
)