Delete and update add_note don't work
-
Hello,
I create note:@note = Sketchup.active_model.add_note 'Note', 0.8, 0.9But I cannot delete and change the note. Help please, I used different methods, but none helped.
-
@note = Sketchup.active_model.add_note 'Note', 0.8, 0.9You may realised that is creating Sketchup::Text https://ruby.sketchup.com/Sketchup/Text.html
To change:@note.set_text "This is another note"Most probably to see changes, the view need to redraw.
Sketchup.active_model.active_view.invalidatedo delete:
@note.erase! -
@dezmo said:
@note = Sketchup.active_model.add_note 'Note', 0.8, 0.9You may realised that is creating Sketchup::Text https://ruby.sketchup.com/Sketchup/Text.html
To change:@note.set_text "This is another note"Most probably to see changes, the view need to redraw.
Sketchup.active_model.active_view.invalidatedo delete:
@note.erase!When i use:
@note.set_text "This is another note" Sketchup.active_model.active_view.invalidatethen I get this (check image)

the text is superimposed on each other. Sketchup 2020
-
@mr_creator said:
When i use:
> @note.set_text "This is another note" > Sketchup.active_model.active_view.invalidate >You didn't say what you didbefore.
I guess you actually did something like this:@note = Sketchup.active_model.add_note 'Note', 0.8, 0.9 @note = Sketchup.active_model.add_note 'Note', 0.8, 0.9 @note.set_text "This is another note" Sketchup.active_model.active_view.invalidateIf you can tell me what your goal is at all, I might be better able to suggest something...

-
The bare bones code is:
note=Sketchup.active_model.add_note("The initial note", 0.8, 0.9) ### where 'note' is a reference to that newly made text-entity Sketchup.active_model.active_view.invalidate ### refreshes the viewlater on you can use
note.text="This is the changed note" Sketchup.active_model.active_view.invalidateThe
@notewould only apply if you are reusing variables between methods etc.
Also theset_text(...)method operates outside of the undo-stack, whereas thetext=works within it.
Also, please parenthesize your arguments...
To erase the note usenote.erase! -
Just tested
Sketchup::Text#set_texton SU2020 and it (as Dezmo says) does not display the change until the view is redrawn. SoSketchup.active_model.active_view.invalidateis necessary to see the change.I'll open a documentation issue for this "quirk".
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