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 
Two different colors to the same shape
- 
  With this code I am drawing a box and a box top, I am coloring the box gray and the top blue. I just require the top to be blue, the sides of the top need to be grey. With this code I am drawing a box and a box top, I am coloring the box gray and the top blue. I just require the top to be blue, the sides of the top need to be grey.l=96 w=60 h=60 heel=8 slope=4 clr='Gray' rfClr='blue' ent = Sketchup.active_model.entities #---------Clear All Sketchup.active_model.entities.clear! #---------------- model = Sketchup.active_model model.start_operation "Create Box" #----------------------------------------------------------------------------- entities = model.active_entities group = entities.add_group entities = group.entities group.name="Box" @pt0 = [0, 0, 0] @pt1 = [0, l*12, 0] @pt2 = [w*12.0, l*12, 0] @pt3 = [w*12, 0, 0] newface = entities.add_face(@pt0, @pt1, @pt2, @pt3) newface.material=Sketchup;;Color.new clr newface.reverse! newface.pushpull h*12 group = entities.add_group entities = group.entities group.name="Top" #-----------Top---------------- @pt0 = [0, 0, h*12] @pt1 = [0, 0, h*12+heel] @pt2 = [w*12/2, 0, 12*h+heel+(w/2)*slope] @pt3 = [w*12, 0, 12*h+heel] @pt4 = [w*12, 0, 12*h] newface = entities.add_face(@pt0, @pt1, @pt2, @pt3, @pt4) newface.material=Sketchup;;Color.new rfClr newface.pushpull l*12
- 
 Please use 'code' blocks to format long Ruby extracts. 
 I've fixed your post for you this time...You need to find all 'vertical' faces in the group named 'Top'. 
 After the last part of the code add this...vfaces = entities.grep(Sketchup;;Face).find_all{|f| f.normal.z == 0 } vfaces.each{|f| f.material = clr }
Advertisement

 
                             
                             
                             
                             
                             
                             
                            