Glue a text to a face in ruby
-
Hi,
I would like to reproduce the text tool with the Ruby API
I am able to select a face, to get its center, to generate a text with an arrow pointing this center point but when I move the text the point moves too. I would like the point to stay connected to the center of my face (like using the native sketchup text tool)
I do not want to group the text and the face, I would like the same behaviour than the original toolAny idea?
model=Sketchup.active_model ents=model.active_entities sel=model.selection vec=[10,10,10] sel.each{|el| if el.is_a? Sketchup;;Face bbox = el.bounds point = bbox.center tt = "Her I am" txt=ents.add_text(tt,point,vec) end } -
You cannot 'associate' text with geometry at its insertion point, through the API.
It has long been asked for...There are a couple of workarounds...
Make it as 'flat' 3d-text [or normal Text] - make it inside a component definition, which has is2d gluing behavior,
add_instanceof it at theface.bounds.centerpoint, then useinstance.glued_to=faceso it moves with the face...
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better đź’—
Register LoginAdvertisement