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

    Scene (Page) animation of Section Cuts

    Scheduled Pinned Locked Moved Developers' Forum
    10 Posts 2 Posters 565 Views 2 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.
    • M Offline
      marksup
      last edited by

      I wish to automate the generation and presentation of Section Cut animation via Scenes.
      Creating the Scenes, each with its own active Section Plane, was straightforward.

      However, I am not sure if it then possible to automatically animate these Scenes.
      I have tried to employ a PagesObserver, and searched the Sketchup.send_action options, each to no avail...

      1. Is it possible to determine and/or set the Display Section Cuts option?

      2. Is it possible to determine and/or deactivate Display Section Planes?

      3. How can a set of Scenes then be automatically sequentially displayed (including the transition animation), or alternatively how can the Scene + Play Animation (or View + Animation + Play) function be invoked?

      Any ideas, anyone?!

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        Sketchup.active_model.rendering_options.to_a.sort [["BackgroundColor", #<Sketchup::Color:0xaf66560>], ["BandColor", #<Sketchup::Color:0xaf66518>], ["ConstructionColor", #<Sketchup::Color:0xaf664d0>], ["DepthQueWidth", 4], ["DisplayColorByLayer", false], ["DisplayDims", true], ["DisplayFog", false], ["DisplayInstanceAxes", false], ["DisplaySectionPlanes", false], ["DisplaySketchAxes", true], ["DisplayText", true], ["DisplayWatermarks", true], ["DrawDepthQue", false], ["DrawGround", false], ["DrawHidden", false], ["DrawHorizon", true], ["DrawLineEnds", true], ["DrawProfilesOnly", false], ["DrawSilhouettes", true], ["DrawUnderground", true], ["EdgeColorMode", 1], ["EdgeDisplayMode", 1], ["EdgeType", 0], ["ExtendLines", true], ["FaceBackColor", #<Sketchup::Color:0xaf66080>], ["FaceColorMode", 0], ["FaceFrontColor", #<Sketchup::Color:0xaf66008>], ["FogColor", #<Sketchup::Color:0xaf65f90>], ["FogEndDist", -1.0], ["FogStartDist", -1.0], ["FogUseBkColor", true], ["ForegroundColor", #<Sketchup::Color:0xaf65e70>], ["GroundColor", #<Sketchup::Color:0xaf65e28>], ["GroundTransparency", 50], ["HideConstructionGeometry", false], ["HighlightColor", #<Sketchup::Color:0xaf65d80>], ["HorizonColor", #<Sketchup::Color:0xaf65d38>], ["InactiveFade", 0.25], ["InactiveHidden", false], ["InstanceFade", 0.5], ["InstanceHidden", false], ["JitterEdges", false], ["LineEndWidth", 7], ["LineExtension", 2], ["LockedColor", #<Sketchup::Color:0xaf65b70>], ["MaterialTransparency", true], ["ModelTransparency", false], ["RenderMode", 2], ["SectionActiveColor", #<Sketchup::Color:0xaf65a98>], ["SectionCutWidth", 3], ["SectionDefaultCutColor", #<Sketchup::Color:0xaf65a20>], ["SectionInactiveColor", #<Sketchup::Color:0xaf659d8>], ["ShowViewName", true], ["SilhouetteWidth", 2], ["SkyColor", #<Sketchup::Color:0xaf65930>], ["Texture", true], ["TransparencySort", 0]]
        The "DisplaySectionPlanes" can be set true/false
        Sketchup.active_model.rendering_options["DisplaySectionPlanes"]=true
        etc...
        However... there are other "options" too...
        Sketchup.active_model.options.to_a.each{|o| p o.name} "PageOptions" "UnitsOptions" "SlideshowOptions" "NamedOptions" "PrintOptions"
        These include relevant ones, like:
        Sketchup.active_model.options["PageOptions"].sort [["ShowTransition", true], ["TransitionTime", 2.0]]
        and
        Sketchup.active_model.options["SlideshowOptions"].sort [["LoopSlideshow", true], ["SlideTime", 1.0]]

        The model.pages [and 'page] also allows you to set a page current, individual page properties etc... these are probably what you need in tandem...

        http://www.sketchup.com/intl/en/developer/docs/ourdoc/pages

        TIG

        1 Reply Last reply Reply Quote 0
        • M Offline
          marksup
          last edited by

          Hi TIG,

          Thanks - hidden in rendering_options is indeed the simple answer to displaying (or not) Section Planes.

          But critically Display of Section Cuts is missing, and if not active, any Section Plane animation is invisible!

          Also, still no API method of activating Scene Animation, i.e. any way of sequentially displaying multiple Scenes.

          And incidentally, there appears to be no option to decide Scene/Page 'Include in animation'

          1 Reply Last reply Reply Quote 0
          • M Offline
            marksup
            last edited by

            PS - I'm also struggling to create a 'Reset' Scene which deactivates an active Section Cut Plane if one exists. It can be done interactively, but is it possible in Ruby?!

            1 Reply Last reply Reply Quote 0
            • TIGT Offline
              TIG Moderator
              last edited by

              There are only a few API SectionPlane methods.
              In v2014 there is SectionPlane.active to set a given section plane active, you need to iterate its container's entities to find it.
              http://www.sketchup.com/intl/en/developer/docs/ourdoc/sectionplane

              If a Scene tab is saved/updated its SectionPlane state will saved with it.
              When you change between the Scene-tabs the section-cut will animate...

              Since each section-cut state is linked to a Scene-tab 'page', then setting the next page in pages as the current page will animate to that next SectionPlane.

              A page has many options... http://www.sketchup.com/intl/en/developer/docs/ourdoc/page
              These control all aspects of what you 'see' like shadows and section-cuts...
              So you CAN set section-cuts on/off with...
              http://www.sketchup.com/intl/en/developer/docs/ourdoc/page#use_section_planes=
              which allows you to set the page's SectionPlane visibility on/off [.use_section_planes? to get true/false].

              It's well worth taking some time to explore the API guide - even it is sometimes scant or error prone...

              TIG

              1 Reply Last reply Reply Quote 0
              • M Offline
                marksup
                last edited by

                Thanks again for your response, sadly I have in fact been perusing the API guide daily for over 5 years! - thus this query regarding basic but apparently missing function.

                My understanding is that .use_section_planes does NOT intrinsically decide if a Section Cut is active or not, it merely decides to remember, or not, any active Section Cut at the time the Scene was saved or last updated. Thus my queries (e.g. how to switch on Section Cut display, and how to create a Scene with .use_section_planes = true referencing no active Section Plane) remain.

                I guess any existing Cutting Planes could be stored, deleted, the 'Reset Scene' created, and then the Cutting Planes recreated, but this would not exactly be elegant - and might upset any existing Scenes which referenced the Cutting Planes.

                I'm still hoping that some obscure API methodology will offer a solution to some extent!

                1 Reply Last reply Reply Quote 0
                • TIGT Offline
                  TIG Moderator
                  last edited by

                  You can use page.update to re-save a page with modified settings.
                  The .use_section_planes determines whether or not the page [scene] shows the active section cut.
                  As explained earlier, in v2014 you can set the active section-plane.
                  If the model has several pages each with their own section-plane how about this ?
                  Your code adds an attribute to the section-plane which is the page.name
                  Now [in v2014 at least] you can ensure that that a page has its section-plane set current, and that the page uses section-planes ?
                  For speed you can initially assemble an array of all section-planes in the model/definitions and inspect those in your attribute search...

                  Earlier you also asked about how to test if a page is in an animation.
                  The page.name==page.label is true if it is, BUT is false if not - because then the label is the name within () - so it is a simple way to filter out non-animated scenes...
                  E.G.
                  animated_pages = model.pages.find_all{|page| page.name==page.label }
                  Now 'animated_pages' is just the pages that are animated...

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    marksup
                    last edited by

                    I have figured out how to create a 'Reset' Scene - which will always display without any active Section Cuts...

                    scene = Sketchup.active_model.pages["Reset"]
                    if not scene
                    temporary_plane = Sketchup.active_model.entities.add_section_plane([0, 0, 0], [0, 0, -1]) # Not activated
                    scene = current_model.pages.add("Reset")
                    #scene.use_section_planes = true # Unnecessary since defaults to true
                    Sketchup.active_model.entities.erase_entities(temporary_plane)
                    else
                    scene.update(63) # Update All except for Section Planes
                    end

                    Regarding 'Include in Animation' - the requirement would be to SET the value (for use by the standard View + Animation + Play function)

                    1 Reply Last reply Reply Quote 0
                    • M Offline
                      marksup
                      last edited by

                      Correction! (a Scene is only interested in active Section Planes)...

                      temporary_plane = current_model.entities.add_section_plane([0, 0, 9999], [0, 0, -1]).activate

                      1 Reply Last reply Reply Quote 0
                      • TIGT Offline
                        TIG Moderator
                        last edited by

                        You can 'get' & 'set' [with = ] page.name
                        BUT you can only 'get' the page.label
                        By default the page.name==page.label and so it's in the animated set...

                        Sorry, but the API is lacking page.label= or similar...
                        Of course, the Animation class can be used filtering out () labels, BUT you can't change a page.label in code 😕

                        TIG

                        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