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

    Cubic colored grid

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 2 Posters 441 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.
    • K Offline
      kayjay
      last edited by

      I downloaded the cubic colored grid ruby from the Ruby Library Depot. From the description given, the color of each grid section is suppossed to match the axis it is on. Mine are all black. I went into the ruby and found:

       group.material = Sketchup;;Color.new(255, 0, 0) 
      #----------------------------------------------------------------------------- Duplicates 2D grid
      
        model.start_operation "Duplicate 3D grid"
        pis2 = 1.5707963267948965
          transfo = Geom;;Transformation.rotation( [0,0,0], Geom;;Vector3d.new(1, 0, 0), pis2)
          new_group = group.copy
          new_group.material = Sketchup;;Color.new(0, 255, 0) 
          new_group.move!(transfo)
          transfo = Geom;;Transformation.rotation( [0,0,0], Geom;;Vector3d.new(0, -1, 0), pis2)
          new_group = group.copy
          new_group.material = Sketchup;;Color.new(0, 0, 255) 
          new_group.move!(transfo)
      

      I thought I had figured out that this type of line

      Sketchup;;Color.new(255, 0, 0)
      

      shows the color used (255) and, because the number moves its location in the sequence, WHERE it is used. When I tried to change 255 to a different color (chosen from the Materials menu) all it did was turn the grid into 2D.

      How do I change the colors?

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

        It will show balck if your style has edges set to be 'all the same color' - change it to 'by material' and they'll be colored.

        However tehre is an error in the script in that the RGB colors for the axes are wrong you need to swap the colors over - so R >>> B, G >>> R and B >>> G.

        Also the grid's spacing is stuck in integers which are translated into inches - if you want something else change the inputbox's values to say 1.m, 1.m and 100.mm...

        Finally, as the grids are all copied from one original flat one and colored to suit IF you have different length/width entered one of the vertical grids will be made too high - it's be a simple matter to draw each of the three grids separately to their respective correct size. If you are adjusting the script note that the X/Y sizes aretransposed inside of the calculations...

        TIG

        1 Reply Last reply Reply Quote 0
        • K Offline
          kayjay
          last edited by

          Thanks, TIG! Is there any way to set the edge option of "Color By Material" as a default setting?

          KJ

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

            @kayjay said:

            Thanks, TIG! Is there any way to set the edge option of "Color By Material" as a default setting?
            KJ

            You can a (re)set this in a Style or set it in the Style in your Template...
            To do it via Ruby...
            Sketchup.active_model.rendering_options["EdgeColorMode"]
            returns the current edge color setting...
            0 = All The Same
            1 = By Material
            2 = By Axis
            so reset it thus...
            Sketchup.active_model.rendering_options["EdgeColorMode"]=1
            to show the edges 'by material'...
            .

            TIG

            1 Reply Last reply Reply Quote 0
            • K Offline
              kayjay
              last edited by

              Thank you so much!

              KJ

              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