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

    Making changes visible

    Scheduled Pinned Locked Moved Developers' Forum
    7 Posts 4 Posters 128 Views 4 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.
    • 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

      1 Reply Last reply 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.

        1 Reply Last reply 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

          1 Reply Last reply 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

            1 Reply Last reply 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

              1 Reply Last reply 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

                1 Reply Last reply 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.

                  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