Hide all texts from View menu

text

#1

I only use SketchUp 2d text for notes to myself as I model. All text visible in the presentation is added in Layout. It’s a bit cumbersome to always have to hide these texts manually on their own layer. I propose text visibility should be toggled from View (and styles) consistently to guidelines or hidden geometry.


#2

That’s a RenderingOption you could add a toggle for to the menu.


#3

You mean it already exists under the hood but just isn’t exposed to the user? :open_mouth:

That makes it even easier to add it to Sketchup :stuck_out_tongue: .


#4

I smell a new Eneroth plugin coming. :wink:


#5

Quick test,… works well.

UI.menu('View').add_item UI::Command::new('Text') {
  opts = Sketchup::active_model.rendering_options
  opts['DisplayText']= !opts['DisplayText']
}.set_validation_proc {
  Sketchup::active_model.rendering_options['DisplayText'] ? MF_CHECKED : MF_UNCHECKED
}

UI.menu('View').add_item UI::Command::new('Dimensions') {
  opts = Sketchup::active_model.rendering_options
  opts['DisplayDims']= !opts['DisplayDims']
}.set_validation_proc {
  Sketchup::active_model.rendering_options['DisplayDims'] ? MF_CHECKED : MF_UNCHECKED
}

#6

The problem with an extension is that it would end up at the end of the menu, after Animations, not with Axes, guides and the other toggles where it belongs :frowning: .


#7

It would be cool if we could use set_validtion_proc in that way.


#8

Well it works fine for me !
(ie, the method returns the command reference,
not the result of the block argument it was passed.)

Not you ?


#9

You can tell the menu item where in the menu to insert itself by providing an index to the add_item method.


#10

… but it may only work on PC as I remember ?

ADD: This argument is undocumented, so it’s use may be one of
those things that will not allow an extension to pass EW inspection.


#11

There are already [old] example scripts to reassign all Text [and Dims] to their own layers…
After that just switch their Text [or Dims] layer OFF ?


#12

No. add_item returns a menu id number.

#<NoMethodError: undefined method `set_validation_proc' for 50220:Fixnum>

A correct call would look like this:


id = UI.menu('View').add_item(UI::Command::new('Text') {
  opts = Sketchup::active_model.rendering_options
  opts['DisplayText']= !opts['DisplayText']
})

UI.menu("View").set_validation_proc(id) {
    Sketchup::active_model.rendering_options['DisplayText'] ? MF_CHECKED : MF_UNCHECKED
}



#13

Do you mean trough the entire model and all levels, i.e. also in (nested) groups and components in “one” operation?


#14

Strange that it works for me, because in my API world the UI::Command instance object itself has a set_validation_proc instance method. The newly created command object is what I am calling the set_validation_proc method upon, as it is what is returned from the call to ::new().

I paste this into the console, and it works fine:

UI.menu('View').add_item UI::Command::new('Dimensions') {
  opts = Sketchup::active_model.rendering_options
  opts['DisplayDims']= !opts['DisplayDims']
}.set_validation_proc {
  Sketchup::active_model.rendering_options['DisplayDims'] ? MF_CHECKED : MF_UNCHECKED
},7

UI.menu('View').add_item UI::Command::new('Text') {
  opts = Sketchup::active_model.rendering_options
  opts['DisplayText']= !opts['DisplayText']
}.set_validation_proc {
  Sketchup::active_model.rendering_options['DisplayText'] ? MF_CHECKED : MF_UNCHECKED
},9

Resulting in:


#15

I may have mis-placed parenthesis… yes that was it. I had themaround add_item instead of around the entire command + set_validation_proc


#16

I know, I am teasin’ ya’ :stuck_out_tongue_winking_eye:

And the whole point of the thread is that she doesn’t want to do this …

So we talk about doing what she wants.
(Ie, your taking the thread a bit off-topic, … not far, but a wee bit.)

I observe that this FR should also add checkboxes to the
Styles panel > Edit tab > Modeling Settings sub-panel for Dimensions and Text.

Ie, just to have a thorough implementation.


#17

[quote=“DanRathbun, post:16, topic:38746”]
And the whole point of the thread is that she doesn’t want to do this …
[/quote] …And there are many things that I wish could be done…
But before we get “flying-cars”, let’s look at the solutions that are already available to us…

As we all know, there is currently there is no visibility Text [or Dims] toggle - it might happen, but till then there are other alternatives…


#18

I’m scratchin’ my head in bemusement,… not understanding
why you don’t “get” what’s happening in this thread !

No tiddledeewinks ! Hence this whole thread and the OP’s request.

It has already happened in several of my posts above,
… ie, it is a proper temporary solution to the exact feature request.

In the OP, the requester specifically dismissed your alternative.

…, therefore you repeatedly pushing your alternative is definitely taking the discussion off-topic. (A separate but linked thread would have been more respectful of the request, as asked.)


#19

I give up.


#20

I think it works for toolbars since [quote=“DanRathbun, post:14, topic:38746”]
UI.menu(‘View’).add_item UI::Command::new(‘Dimensions’) {
opts = Sketchup::active_model.rendering_options
opts[‘DisplayDims’]= !opts[‘DisplayDims’]
}.set_validation_proc {
Sketchup::active_model.rendering_options[‘DisplayDims’] ? MF_CHECKED : MF_UNCHECKED
},7

UI.menu(‘View’).add_item UI::Command::new(‘Text’) {
opts = Sketchup::active_model.rendering_options
opts[‘DisplayText’]= !opts[‘DisplayText’]
}.set_validation_proc {
Sketchup::active_model.rendering_options[‘DisplayText’] ? MF_CHECKED : MF_UNCHECKED
},9
[/quote]

This code works for me on Windows 7. I’m a bit impressed about how it also shows up on the desired position in the menu :smiley: . I had no idea there was a position argument for add_item.

Regarding the actual feature request I would also want these settings to be available in the Style window and to be saved to the style. I’ve tested the DisplayText rendering options and it is indeed saved to scenes under the Style and Fog category. However it is not saved to the style itself. Two scenes that saves Style and Fog can both use the same style and have different values for this rendering option.

In general it would be nice with some explanation or documentation about which rendering options belong to the style and which belongs to the scene directly because this is somewhat confusing. With the current terminology it seems text visibility classifies as a fog option :stuck_out_tongue: .