Info about add_note method
-
Known bug - but I thought it was mentioned in the docs... ...must have dreamt...
-
I think I put a bug note at the bottom of the API page... yur not dreaming.
-
Here it is
-
Anyone experiences that the notes moves about?
Seems that if you use
model.add_note
when you are inside a group or component the note is added to that context and will shift about on the screen when orbiting. -
Well that method is a wrapper method (so it makes sense.)
It creates a
Sketchup::Text
object with leader set to hidden, and always face camera to true.
And I think it goes on the current layer.So you may want to just want to use:
model.entities.add_text
API Doc Error:
Model.add_note()
returns aSketchup::Text
instance object.
There is noNote
object in the API. -
@dan rathbun said:
It creates a
Sketchup::Text
object with leader set to hidden, and always face camera to true.
And I think it goes on the current layer.So you may want to just want to use:
model.entities.add_text
How? I looked at
add_text
, but it appear to only accept a 3D point - not a 2D screen point. -
You are correct. Strike what I said.
There is some unexposed setting. (vector and point are set to
nil
when you useModel.add_note
, but we cannot pass nil to the setter methods ofText
objects.)A note has the model as
.parent
, but when you do that in a component edit context, it gets theComponentDefinition
as it'sparent
.Any way to move it out of the definition's entities collection, and into the model's ??
-
@dan rathbun said:
Any way to move it out of the definition's entities collection, and into the model's ??
Group it (group1), add instance of group in
model.entities
(group2), explode group2, erase group1 ?Dirty hack - but better than closing the open group/component. I'll try.
-
If you are adding the note in code then undo the edit context back to the model entities before adding it ?
model=Sketchup.active_model ### model.close_active while model.active_path ### NOW add 'note' in the current entities - which are now the model's
-
@thomthom said:
Group it (group1), add instance of group in model.entities (group2), explode group2, erase group1 ?
It did add a Sketchup::Text entity to
model.entities
, but it is not visible. :s@tig said:
If you are adding the note in code then undo the edit context back to the model entities before adding it ?
That's what I'm doing now. But it's not a good solution because:
- It takes the user out of the current context.
model.close_active
is bugged - it doesn't add the event to the undo stack so then you undo the operation geometry gets shifted incorrectly because the change of context transformation is not accounted for.
-
A bug, for sure.
I thot about:
n = model.add_note("Note text.",xf,yf) inst2 = model.entities.add_instance(inst1.parent,inst1.transformation) eg = inst2.explode del = eg.find_all {|e| !e.is_a?(Sketchup;;Text) || ( e.is_a?(Sketchup;;Text) && e.point=nil && e.vector=nil ) } txt = eg - del eg = nil model.entities.erase_entities(del) n.erase!
-
Because the 'note' is always [?] being added to the 'active_entities' it's safe for us to group it immediately.
note=model.add_note("NOTE", xf, yf) gp=note.parent.entities.add_group(note) gi=model.entities.add_instance(gp.entities.parent, gp.transformation) gp.erase! gi.explode
As I'm typing this untested... we might need to work on the add_instance transformation[s] bit
-
@tig said:
Because the 'note' is always [?] being added to the 'active_entities' it's safe for us to group it immediately.
note=model.add_note("NOTE", xf, yf) gp=note.parent.entities.add_group(note) gi=model.entities.add_instance(gp.entities.parent, gp.transformation) gp.erase! gi.explode
As I'm typing this untested... we might need to work on the add_instance transformation[s] bit
That's what I tried:
http://forums.sketchucation.com/viewtopic.php?f=180&t=36940&view=unread#p431675It failed:
http://forums.sketchucation.com/viewtopic.php?f=180&t=36940&view=unread#p431678 -
Can the text and the position of this note be animated?
For example can I make a timer with this? -
@thomthom said:
That's what I tried:
http://forums.sketchucation.com/viewtopic.php?f=180&t=36940&view=unread#p431675
It failed:
http://forums.sketchucation.com/viewtopic.php?f=180&t=36940&view=unread#p431678
Is it because the transformation needs sorting ?
Unfortunately, I think that if you group any 'screen-text' and then explode it it loses its screen-text-ness -
The native
MoveTool
can move the note.
Advertisement