sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    πŸ›£οΈ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Plugin Help - modify Add Section Cut Face

    Scheduled Pinned Locked Moved Plugins
    4 Posts 3 Posters 595 Views 3 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.
    • bmikeB Offline
      bmike
      last edited by

      I need a bit of help with TIGs 'Add Section Cut Face'.
      I want to limit my choices with the script, have it default to width of 2, unlocked group, do not hide edges, and fill be 'DarkGray'.

      I managed to get all the variables sorted - but I cannot get 'DarkGray' to default for color of the fill. I still get black:

      ### ##############################
       def dialog(sfix)
      ### get colours and layer
         model = Sketchup.active_model
         mlayers = model.layers
         alayer=model.active_layer
         model.active_layer=nil
         deflayer=model.active_layer.name
         model.active_layer=alayer
         dlayer = "CUT-"+sfix
          layers = []
           mlayers.each{|layer|layers << layer.name if layer.name != deflayer}
           layers=[dlayer,deflayer]+layers.sort!
           layers = layers.join('|')
         colours = Sketchup;;Color.names.join('|')
         cedges = colours ###v1.3
         colours = "<Default>|<No_Face>|"+colours ###v1.3###v2.5
      ###
         prompts = ["Cut-Face Color; ", "Cut-Edge Color; ", "Cut-Edge Width", "Keep Un-Faced Edges; ", "Hide Edges; ", "Lock Cut; ", "Cut Layer; "] ###v2.2/2.5
         title = "Section-Cut Parameters"
         @@colour = Sketchup;;Color.names[7] if not @@colour ### DarkGray
         @@edge = Sketchup;;Color.names[7] if not @@edge     ### Black
         @@width = 2 if not @@width
         @@edges = "No" if not @@edges ###v2.2
         @@hide = "No" if not @@hide ###v2.2
         @@lock = "No" if not @@lock
         @@layer = dlayer ### default
         values = [@@colour, @@edge, @@width, @@edges, @@hide, @@lock, @@layer]### ###v2.2/2.5
         popups = [colours, cedges, "", "Yes|No", "Yes|No", "Yes|No", layers] ###v2.2
         results = inputbox( prompts, values, popups, title )
         return nil if not results
         ### do processing of results
         @@colour = results[0]
         @@edge = results[1]
         @@width = results[2]
         @@width = 1 if @@width < 1
         @@width = 20 if @@width > 20
         @@edges = results[3] ###v2.2
         @@hide = results[4] ###v2.2
         @@lock = results[5] ###v2.5
         @@layer = results[6] ###v2.2
         if @@colour=="<No_Face>" ###v2.5
           @@edges="Yes"
           @@hide="No"
         end#if
         return true
       end #def dialog
      

      I think this is the relevant line:

      @@colour = Sketchup::Color.names[7] if not @@colour ### DarkGray

      I've played around with the 7 in brackets, it certainly changes the color... but i cannot find reference to how the colors are numbered... going to the materials palette brought back 0135, which is 'Moccasin'.

      Any help?

      mike beganyi design + consulting llc

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

        @@colour = Sketchup::Color.names[7] if not @@colour
        ' 7' is 'Black' - find which number is ' DarkGray' - remembering that the list starts at 0...

        Hint - try ' 24' πŸ˜‰

        This one-liner in the Ruby Console lists all built-in colors and their 'index'...
        Sketchup::Color.names.each_with_index{|e,i|puts e+" = "+i.to_s}

        TIG

        1 Reply Last reply Reply Quote 0
        • bmikeB Offline
          bmike
          last edited by

          Thanks much...!

          I tried counting in the list that pops up in the plugin, that didn't seem to correspond, then I went to the materials palette and learned that the numbers there don't seem to mean anything...

          All set now. Put in '24' and it is working fine.
          I can now just slide the layer toggle and I'm good to go.
          Makes for updating a document set much easier.

          mike beganyi design + consulting llc

          1 Reply Last reply Reply Quote 0
          • T Offline
            the.pjt
            last edited by

            you are one of the best supporters ... when we want to modify a TIG's code which teacher is better than author himself ? πŸ˜„

            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