How can I change my text object font via ruby API?
Appreciate your suggestions!
What platform are you programming for:
Apple-Mac OSX?
PC Windows?
BOTH (cross-platform)?
What is the text object used for:
WebDialog (HTML) ?
Model.add_note ?
View.tooltip ?
View.draw_text ?
Sketchup::Text class ?
I also.
And I wish to also change Sketchup::Text attribute
(:fontface, :fontsize, :bold, :italic, :align, :color),
both before adding text and later to change them.
I find no easy solution via Instance Methods for the Text class.
Will have to add to the API Wishlist.
And is there any document such as Ruby SU API Wishlist?=)
SketchUp RUBY API Wishlist
http://forums.sketchucation.com/viewtopic.php?f=180&t=13666
I realized how to at least, change Text Color, after creation, using
DrawingElement.material=
The Sketchup::Text class is a subclass of Sketchup::DrawingElement, so
inherits it's parent's methods.
# --- ruby ---
model = Sketchup.active_model
ents = model.entities
pt = Geom::Point3d.new(10,10,10)
t1 = ents.add_text('This is a Test', pt)
t1.vector=[10,10,10]
# change Text color to Magenta
t1.material=Sketchup::Color.new(200,0,200)
# --- end ruby ---
.material= also takes a Sketchup::Color Name
But it's a 3DText object still. Made up of Edges and Faces.
Can you change the text string after the fact?
Does it stay rotated to face the view like 2DText?
Does it have leaders and arrows like 2DText?
Basically Sketchup::Text is actually a Dimension Callout, and really
doesn't have much other use. (If we want to display a textnote on the
viewport we use Model.add_note instead.)
3DText I use for any text (flat or otherwise,) that needs to have a 3D
location, and stay oriented to the model, not the viewport.
In the Windows Registry there are 2 Keys, one 'TextStyle' (which I
think is for 2DText, and is empty of attributes;) and 'ThreeDText'
which holds the settings from the 3DText Edit dialog.
I'm wondering why there are no Options to do with Text settings in the
OptionsManager/OptionsProvider Interfaces?
The Text Settings get saved in the Model... but it would be nice to
have a global override saved in the Registry.
I'm need change other 'hidden' attribute, which is not documented in
APi :(
The API does NOT define Instance Methods to change Text attributes.
> you find the way to change this attribute
> (:fontface, :fontsize, :bold, :italic, :align, :color) ?
Those names are 'common' names I suggest, but NOT what the attribute
names may be in the C code of Sketchup.
> I'm need change other 'hidden' attribute, which is not documented in
> APi :(
ALL subclasses of DrawingElement class, inherit methods to access
attributes: 'hidden', 'visible', 'casts_shadows', 'receives_shadows',
'layer'
http://code.google.com/apis/sketchup/docs/ourdoc/drawingelement.html
.
> I'm need change other 'hidden' attribute, which is not documented in
> APi :(
[Czech]
ALL podtřídy třídy DrawingElement, dědí metody přístupu
atributy:
'hidden', 'visible', 'casts_shadows', 'receives_shadows', 'layer'
http://code.google.com/apis/sketchup/docs/ourdoc/drawingelement.html
(...translated with Google Translate:
http://translate.google.com/?hl=en&tab=wT#en|cs| )
.