sketchucation logo sketchucation
    • Login
    1. Home
    2. jackjack1234
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    J
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 6
    • Groups 1

    jackjack1234

    @jackjack1234

    10
    Reputation
    1
    Profile views
    6
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    jackjack1234 Unfollow Follow
    registered-users

    Latest posts made by jackjack1234

    • RE: Updating sketchup broke my (very simple) extension

      That makes a lot of sense. I guess the real problem is I’m not very experienced with components.
      Would this work:
      At the start of the script create a few components representing every possible color element (so 5 colors = 5 components). Then as the script goes and reads from my file it goes through each ‘v’ value it assess it and places the correct colored component in that location (based on the x, y, z).
      If that would work, do you know any simple tutorials that do this I could use to make this from? (I tend to learn best be either reverse engineering or altering a similar example). Like I said before, I’m still a pretty green programmer, but so far this has been very helpful.
      I think if I can figure out how to save a component in ruby and later call and place a component I should be able to get this to work.

      posted in Plugins
      J
      jackjack1234
    • RE: Updating sketchup broke my (very simple) extension

      Thanks! You just solved my problem! (I didn’t copy that exactly, I actually just added in the face.back_material = [r, g, b] and defined before doing the push.pull and that solved everything (odd that it worked in 7.0).

      I will work on doing it a bit more elegantly with defining materials and just calling for them because that does sound like a much better solution.

      While you are solving all my problems, here is another question. I’ve always wanted to import a very large set of boxes (voxels, whatever you want to call them) using this technique. But any time I try it with more than say 15,000 using the code I gave above my computer just sits there for hours appearing like it’s doing nothing so I cancel the construction.

      I asked this along time ago on this forum and someone said that it was because each time I did a push.pull action sketchup would check with EVERY piece of the geometry (built that that point) and look for intersections. So as I built more and more boxes, I increased the construction time more and more for each element.

      Do you have any idea if there is a more efficient way I could do this? (or a way to disable that check). Maybe building all the faces at the same time and doing some sort of single ‘group’ push pull? Any thoughts?

      posted in Plugins
      J
      jackjack1234
    • RE: Updating sketchup broke my (very simple) extension

      Sure I can show you what I mean. I found an old laptop with 7.0 still on it. The two figures that follow are from the side and from above.

      Image

      I used the exact same script/data in both shots, so the only difference is that the new one is made with 7.1 vs 7.0. If you want to see for yourself what I think is happening try this in sketchup:
      • Draw a square
      • Paint the surface red
      • Pull it up
      • Delete a side and notice the color inside is now grey! That’s the grey I’m seeing in the second ‘bad’ image
      • In the old version the color inside would be red! I think that is what’s causing all of this. I’m just not sure how to control the inside surface color in my script (as you can probably tell, I’m not the best programmer in the world).
      Does that clarify my problem for you?

      (Also I tried updating my graphics drivers but that didn’t change anything… worth a shot though)

      Since I have this laptop working now, I’m okay for the moment. But I’d rather fix this issue since it seems like it should be simple… Any ideas?

      posted in Plugins
      J
      jackjack1234
    • RE: Updating sketchup broke my (very simple) extension

      My mistake. I will do that next time.

      Thanks for taking a look. I'm hoping this is simple solution...

      posted in Plugins
      J
      jackjack1234
    • RE: Updating sketchup broke my (very simple) extension

      Here is one of the scripts I would use (I change it based on how many things I’m importing and the amount of color I’m using. It’s pretty simple, but maybe there is a more efficient way to do this? I’ll try updating the graphic drivers I guess. Thanks.


      require 'sketchup'
      Sketchup.send_action "showRubyPanel;"
      UI.menu("PlugIns").add_item("Draw boxes") {
        UI.messagebox("Beginning now") 
      
        # Call method.
        draw_boxes
      }
      def draw_boxes
      
        # Get handles to model and the entities collection it contains.
        model = Sketchup.active_model
        entities = model.entities
        
       File.open('C;\Program Files\Google\Google SketchUp 7\Plugins\data.txt').each_line {|line|
       values = line.split(' ')
           x1 = values[0].to_f
           y1 = values[1].to_f
           z1 = values[2].to_f
           color = values[3].to_f
           size = 5
      
           x2 = (x1 + 5) 
           y2 = (y1 + 5)
         
          
          # Create a series of "points", each a 3-item array containing x, y, and z.
          pt1 = [x1, y1, z1]
          pt2 = [x2, y1, z1]
          pt3 = [x2, y2, z1]
          pt4 = [x1, y2, z1]
          
          case color 
              when 5.91..1000 then      
                face1 = entities.add_face pt1, pt2, pt3, pt4
                face1.material = [255,0,0]
                face1.pushpull size, true
              when 5.71..5.90 then      
                face2 = entities.add_face pt1, pt2, pt3, pt4
                face2.material = [255,86,25]
                face2.pushpull size, true
              when 5.51..5.70 then      
                face3 = entities.add_face pt1, pt2, pt3, pt4
                face3.material = [255,220,25]
                face3.pushpull size, true
              when 5.31..5.50 then      
                face4 = entities.add_face pt1, pt2, pt3, pt4
                face4.material = [254,254,76]
                face4.pushpull size, true
              else
                face5 = entities.add_face pt1, pt2, pt3, pt4
                face5.material = [0,0,255]
                face5.pushpull size, true
            end
            }
            end
      

      posted in Plugins
      J
      jackjack1234
    • Updating sketchup broke my (very simple) extension

      Updating sketchup broke my (very simple) extension…

      I made a very simple ruby script that would open a text file with four values (x, y, z, V). It would then draw a box of known size and color using the following technique:

      case value
          when 5.91..1000 then      
            face1 = entities.add_face pt1, pt2, pt3, pt4
            face1.material = [255,0,0]
            face1.pushpull size, true
      

      I would draw several hundred boxes doing this and when done I would use transparency effects to ‘see’ through them. I haven’t done this in a few months, but I know it was working before I updated to the newest version of 7.1 (free). I tried to today and I noticed that when I use transparency it now shows me the inside of each box and this means I can’t see any other boxes beyond the first layer. As best I can tell the default color is being applied to every ‘inner’ surface in each box, which causes my extension to be useless.

      Does anyone know how to change this? (either making the default color 100% transparent, or improving how I construct the boxes to I can define the inner colors?)
      I’m in need of this script and I just can’t seem to figure it out on my own.

      Thanks

      posted in Plugins
      J
      jackjack1234