sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Rendering_options['ForegroundColor'] controls view.draw_text

    Scheduled Pinned Locked Moved Developers' Forum
    12 Posts 5 Posters 589 Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • thomthomT Offline
      thomthom
      last edited by

      I just realised that the colour of view.draw_text is controlled by Sketchup.active_model.rendering_options['ForegroundColor'].

      I don't understand at all why view.draw_text's colour is tied to this property. But at least you can know what colour the text is drawn in and adjust the background colour accordingly.

      Thomas Thomassen — SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        Ok - more oddity:

        Styles -> Edges -> Color sets Sketchup.active_model.rendering_options['ForegroundColor'] from the SU UI.

        Typing Sketchup.active_model.rendering_options['ForegroundColor'] = 'pink' into the ruby console changes the edge colours to pink.

        But this from within the draw method of a Tool;

        
        Sketchup.active_model.rendering_options['ForegroundColor'] = 'red'
        view.draw_text( [520,220,0], 'Hello World' )
        Sketchup.active_model.rendering_options['ForegroundColor'] = 'blue'
        view.draw_text( [520,240,0], 'Foo Bar' )
        Sketchup.active_model.rendering_options['ForegroundColor'] = 'black'
        
        

        This does not update the Edge colour in the viewport. But Sketchup.active_model.rendering_options['ForegroundColor'] value is still updated.

        In any case - this snippet let you draw text in the viewport and not mess with the edge style.

        
        cache = Sketchup.active_model.rendering_options['ForegroundColor']
        Sketchup.active_model.rendering_options['ForegroundColor'] = 'red'
        view.draw_text( [520,220,0], 'Hello World' )
        Sketchup.active_model.rendering_options['ForegroundColor'] = cache
        
        

        I was wondering if the Edge colours would flicker when doing this - but I've noticed nothing. Maybe because I don't seem to be able to make any effect from within my Tool's draw method.

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • chrisglasierC Offline
          chrisglasier
          last edited by

          So can I link this to my bounding box question, and your and Chris F's replies, viz:

          Objects to be moved are selected; a draw tool is used to trace or slightly offset the bounding box points with colour set as you say here. So when another selection is made there would be two boxes, say one fake red one, and the normal blue one for the destination. Both would be cleared on "Store route" or something.

          Your post just got me thinking out loud (TOL), but if there are any comments that would be good.

          Thanks

          With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

          1 Reply Last reply Reply Quote 0
          • Dan RathbunD Offline
            Dan Rathbun
            last edited by

            @ThomThom, ... last week when I was playing with the RenderingOptions, the controls in the SU dialogs did not reflect my changes until I called UI.refresh_inspectors. (I recall we had a discussion with TIG in the Observers thread, about whether these changes were temporary or permanent; I didn't realize at that time, that the dialogs needed to be refreshed.)

            Regarding view draw changes, remember that ver 7.1 added View.refresh

            .. what's that old saying?
            "Believe nothing that you read, and half of what you see!"

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • thomthomT Offline
              thomthom
              last edited by

              @dan rathbun said:

              last week when I was playing with the RenderingOptions, the controls in the SU dialogs did not reflect my changes until I called UI.refresh_inspectors

              Would that also refresh the edge colours? because they should be changing as well - but doesn't.

              Thomas Thomassen — SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              1 Reply Last reply Reply Quote 0
              • Dan RathbunD Offline
                Dan Rathbun
                last edited by

                @thomthom said:

                Typing Sketchup.active_model.rendering_options['ForegroundColor'] = 'pink' into the ruby console changes the edge colours to pink.

                How does this differ from view.drawing_color="pink" ??

                I'm not here much anymore.

                1 Reply Last reply Reply Quote 0
                • Dan RathbunD Offline
                  Dan Rathbun
                  last edited by

                  @thomthom said:

                  This does not update the Edge colour in the viewport. But Sketchup.active_model.rendering_options['ForegroundColor'] value is still updated.

                  @ThomThom - I get an immediate change in the displayed edge color when I change rendering_options['ForegroundColor'].

                  You didn't turn of your DCs again did ya?

                  EDIT - Oh never mind, you mean within a Tool.

                  I'm not here much anymore.

                  1 Reply Last reply Reply Quote 0
                  • thomthomT Offline
                    thomthom
                    last edited by

                    @dan rathbun said:

                    @thomthom said:

                    Typing Sketchup.active_model.rendering_options['ForegroundColor'] = 'pink' into the ruby console changes the edge colours to pink.

                    How does this differ from view.drawing_color="pink" ??

                    rendering_options['ForegroundColor'] is the Edge Colour setting.

                    view.drawing_color defines the colour used by view.draw and view.draw2d.

                    But view.draw_text doesn't use the colour set by view.drawing_color instead it annoyingly uses rendering_options['ForegroundColor'].

                    Thomas Thomassen — SketchUp Monkey & Coding addict
                    List of my plugins and link to the CookieWare fund

                    1 Reply Last reply Reply Quote 0
                    • Dan RathbunD Offline
                      Dan Rathbun
                      last edited by

                      I would say this is a bug, as I would have tried using view.drawing_color=

                      I'm not here much anymore.

                      1 Reply Last reply Reply Quote 0
                      • thomthomT Offline
                        thomthom
                        last edited by

                        @dan rathbun said:

                        I would say this is a bug, as I would have tried using view.drawing_color=

                        Yea - it was only by accident I realised it used the edge colour. I thought it was fixed to black - like view.draw when y ou try to draw a face. But then I changed the viewport background and the text changed to white - as well as the edge colour.

                        Thomas Thomassen — SketchUp Monkey & Coding addict
                        List of my plugins and link to the CookieWare fund

                        1 Reply Last reply Reply Quote 0
                        • AdamBA Offline
                          AdamB
                          last edited by

                          Its a bug though. Introduced in the last couple of version of SU. I posted a bug to Google sometime back.

                          Previous to that, you could use drawing_color (as expected) to control text color.

                          Developer of LightUp Click for website

                          1 Reply Last reply Reply Quote 0
                          • fredo6F Offline
                            fredo6
                            last edited by

                            Sketchup.active_model.rendering_options['ForegroundColor'] = color works fine for draw_text method.
                            However there is a very weird side effect, probably because the change of rendering is done within the draw method of a Tool.
                            This effect is that the SU main window seems to loose the focus, so that any call to UI.messagebox or UI.inputbox is blocked and does not show the dialog box (you have to press Alt to unlock this situation).

                            I did not find a way to circumvent this side effect.

                            Fredo

                            1 Reply Last reply Reply Quote 0
                            • 1 / 1
                            • First post
                              Last post
                            Buy SketchPlus
                            Buy SUbD
                            Buy WrapR
                            Buy eBook
                            Buy Modelur
                            Buy Vertex Tools
                            Buy SketchCuisine
                            Buy FormFonts

                            Advertisement