| Author |
Message |
Bob
Guest
|
Posted:
Thu Jan 06, 2005 11:19 pm Post subject:
Changing text alignment. |
|
|
Hey group, here's one for ya.
Using VLISP and ActiveX I have opened a second acad dwg document and created
some a text object. I am able to change this object's properties (layer,
color, text height, and alignment), but not able to see the results of
changing the object's alignment. (layer, color and height update)
So, how can I get my text alignment to update?
Here is my code:
(setq ACADObject (vlax-get-acad-object)
ACADCollection (vlax-get-property ACADObject 'Documents)
NewDoc (vlax-invoke-method ACADCollection 'Add)
CModelSpace (vlax-get-property NewDoc 'ModelSpace)
LayerCollection (vlax-get-property NewDoc 'Layers)
testLayer (vla-add LayerCollection "testing")
);setq
(setq InPt (list 50 50 0)
TxtHt 20
TxtStr "Hello World!"
TxtObj (vla-addtext CModelSpace TxtStr (vlax-3D-point InPt) TxtHt)
);setq
(vla-put-layer TxtObj "testing")
(vla-put-color TxtObj acred)
(vla-put-height TxtObj 1)
(vla-put-alignment TxtObj acAlignmentCenter)
|
|
| Back to top |
|
 |
T.Willey
Guest
|
Posted:
Fri Jan 07, 2005 12:04 am Post subject:
Re: Changing text alignment. |
|
|
When text has an alignment of left then it is place by the InsertionPoint properity, but if it is anything else, then it is placed by the TextAlignmentPoint.
So try changing the TextAlignmentPoint the the InsertionPoint value when going from left aligned to anything else, and vice versa for going from any alignment other then left to left.
Hope that helped.
Tim |
|
| Back to top |
|
 |
Bob
Guest
|
Posted:
Fri Jan 07, 2005 2:18 am Post subject:
Re: Changing text alignment. |
|
|
Tim,
Thanks for the response. Still not working. Possibly I'm doing something
wrong. Here's my code.
When I check the properties of the text object it shows the alignment as
Center. But it isn't aligned center. If I change it using normal ACAD
commands to say Right, then it changes the way I would expect it to. If I
then change the alignment using normal ACAD commands back to Center the text
updates as it should. How can I force it to update?
(setq ACADObject (vlax-get-acad-object)
ACADCollection (vlax-get-property ACADObject 'Documents)
NewDoc (vlax-invoke-method ACADCollection 'Add)
CModelSpace (vlax-get-property NewDoc 'ModelSpace)
LayerCollection (vlax-get-property NewDoc 'Layers)
testLayer (vla-add LayerCollection "testing")
);setq
(setq InPt (list 50 50 0)
TxtHt 20
TxtStr "Hello World!"
TxtObj (vla-addtext CModelSpace TxtStr (vlax-3D-point InPt) TxtHt)
);setq
(vla-put-alignment TxtObj acAlignmentCenter)
(vla-put-textalignmentpoint TxtObj (vlax-3D-point InPt))
(vla-put-alignment TxtObj acAlignmentCenter)
(vla-update TxtObj)
"T.Willey" <nospam@address.withheld> wrote in message
news:22742695.1105038313987.JavaMail.jive@jiveforum1.autodesk.com...
| Quote: | When text has an alignment of left then it is place by the InsertionPoint
properity, but if it is anything else, then it is placed by the
TextAlignmentPoint.
So try changing the TextAlignmentPoint the the InsertionPoint value when
going from left aligned to anything else, and vice versa for going from
any alignment other then left to left.
Hope that helped.
Tim |
|
|
| Back to top |
|
 |
|
|
|
|