sketchucation logo sketchucation
    • Login
    πŸ›£οΈ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Making changes visible

    scheduled pinned locked moved Developers' Forum
    7 Posts 4 Posters 145 Views 4 Watching
    loading-more-posts
    • oldest-to-newest
    • newest-to-oldest
    • most-votes
    reply
    • reply-as-topic
    guest-login-reply
    deleted-message
    • RichMorinR Offline
      RichMorin
      last edited by

      I have a plugin which adds a number of colored faces to the model. Sometimes, the faces do not appear unless the user plays with the view. I'd like a way for the plugin to make them appear.

      Details

      The incoming model has three layers (Layer0, outline, spaces), stacked as horizontal planes. The plugin adds a fourth layer (walls) above the first three. Normally, the model is viewed from the top, allowing the user to view the composition of the layers (eg, walls superimposed on spaces).

      Sometimes, when the plugin is finished, the walls do not appear. However, they can be made to appear by selecting a different view (eg, oblique) and then switching back to the top view. I've tried a few things (eg, View.refresh) without success. Suggestions, anyone?

      -r

      one-reply-to-this-post last-reply-time reply quote 0
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        How about:

        A)
        view.zoom_extents view.zoom(0.98)

        B) toggle the "walls" layer off then back on

        C) if there are more than 1 members of the Pages collection, switch to another page then back to the current one.
        Speed it up thus:
        model.options['PageOptions']['ShowTransition']=false

        I'm not here much anymore.

        one-reply-to-this-post last-reply-time reply quote 0
        • thomthomT Offline
          thomthom
          last edited by

          Sample model / script?

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

          one-reply-to-this-post last-reply-time reply quote 0
          • A Offline
            Aerilius
            last edited by

            What about Sketchup.active_model.active_view.invalidate ? (that is one of the few that work outside of a tool)

            Edit: Ok, that is probably equal to View.refresh

            one-reply-to-this-post last-reply-time reply quote 0
            • thomthomT Offline
              thomthom
              last edited by

              @aerilius said:

              Edit: Ok, that is probably equal to View.refresh

              Not quite. View.invalidate is a polite request and SketchUp will update the view when it feels like it. So many invalidations in quick succession might be ignored.

              View.refresh is an order - if you call this repeatedly it'll slow down the viewport.

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

              one-reply-to-this-post last-reply-time reply quote 0
              • RichMorinR Offline
                RichMorin
                last edited by

                I added this code

                
                    active_view = Sketchup.active_model.active_view
                    active_view.zoom_extents
                    active_view.zoom(1.0)
                
                

                and the window now refreshes. However, the position and scaling are modified.
                Is there any way to just get the refresh or refresh to the old state?

                -r

                one-reply-to-this-post last-reply-time reply quote 0
                • Dan RathbunD Offline
                  Dan Rathbun
                  last edited by

                  You have to save the view's camera properties to a new Sketchup::Camera instance, then restore it.

                      view = Sketchup.active_model.active_view
                      vcam = view.camera
                      props = [vcam.eye,vcam.target,vcam.up,vcam.perspective?]
                      cam = Sketchup;;Camera.new(*props)
                      view.zoom_extents
                      view.camera= cam
                  

                  I'm not here much anymore.

                  one-reply-to-this-post last-reply-time 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