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

    Posts

    Recent Best Controversial
    • Edge Orientation on a Rectangle

      Hello all,
      I have a script that i have been running quite frequently for quite a few months. It seemed to work nicely and consistently, but now it has suddenly changed and I'm wondering if it has something to do with the start and end positions of edges on rectangle faces being changed. I'll explain a bit more...
      So, my plug-in would require the user to draw a rectangle and select the two edges between the point/vertex where the rectangle was initiated (after some time I found the convention of how the edge vectors were oriented). But since mid-January this convention has suddenly changed (I think) and the layout that is drawn on top of this rectangle and depends on this orientation has changed.

      Am I imagining this?
      Does anyone have any insights on this?

      laura

      posted in Developers' Forum
      T
      tpoz
    • RE: Behavior: shadows_face_sun

      Hey,
      It turns out that thomthom's first suggestion was the one!
      I thought I had tried that, thanks for the posts everyone!

      Laura

      posted in Developers' Forum
      T
      tpoz
    • Behavior: shadows_face_sun

      Hello everyone!
      I have a question about behavior. I am trying to draw a 2d component and have it follow the sun using .shadows_face_sun. I can't seem to make it follow the sun.
      Here is some code:

      
      shruw = 15
      shruh = 20
      shr0 = [shruw/2,0,0]
      shr1 = [-shruw/2,0,0]
      shr2 = [-shruw/2,0,shruh]
      shr3 = [shruw/2,0,shruh]
      
      point = Geom;;Point3d 0,0,0
      transform = Geom;;Transformation.new point
      trees = model.definitions.add("MyShrub")
      shrubbie = trees.entities.add_face(shr0, shr1, shr2, shr3)
      shrubbie.material = "ForestGreen"
      shrubbie.back_material = "ForestGreen"
      
      model.active_entities.add_instance(trees, transform)
      model.active_view.zoom_extents
      trees.behavior.shadows_face_sun = true
      
      

      I've tried a few other things like

      
      behavior = model.definitions[0].behavior
       beehive = behavior.always_face_camera = true
      
      

      I think I am using the definition wrong or something when i use behavior.

      Any help is greatly appreciated!
      Thanks,
      Laura

      posted in Developers' Forum
      T
      tpoz
    • Making components...

      Hello y'all,
      I'm having quite a hard time trying to figure out how to make components 😞
      I can retrieve components from the Component Samples folder and that seems to work, but what I really want to do is ask the user what the dimensions are (of a generic house or an image of a tree) and make the 'house' those dimensions.
      I think my problem is that I don't know how to define the edges/faces as a component. I don't really know what to replace

      componentdefinition= definition.load path
      

      with, or how to define my 'house' in the DefinitionList, or if this even makes sense.

      Any help would be greatly appreciated πŸ˜„
      Thanks,
      laura

      posted in Developers' Forum
      T
      tpoz
    • RE: Photo-match in the xy plane

      Hello!
      Thanks for both of your advice.
      honoluludesktop: I haven't been able to find a straight-forward way of making the photo lay parallel to the ground plane to the model. It may be because I'm unable to move the direction to the blue (z) axis? ...But I'm not sure.
      xrok1: I have tried this and it needs a bit of input (like the dimensions of the full-extents of the model) in order to draw a rectangular 'ground' and have the 'material' be the exact same size as the actual model.
      Are there any other options? Or easier ways to do these?
      Thanks!
      tpoz

      posted in SketchUp Discussions
      T
      tpoz
    • Photo-match in the xy plane

      Hello all,
      I am trying to do some shade analysis, nothing to fancy or quantitative, I just want to have an idea of where the sun shines (and where it doesn't) over time. I have made a model, put different times in different scenes, exported a 2d .png, overlayed them in the gimp (using multiply) and saved them as one .png.
      I would like to take this and put it back into SketchUp and photo-match it, but in the xy plane (the ground) not parallel to the z-axis. Is there any simple way of doing this? I have fiddled around with the adjustments but haven't been able to achieve it...
      Is this something that can be done?
      Thanks to anyone who has any input πŸ˜„
      laura

      posted in SketchUp Discussions sketchup
      T
      tpoz
    • RE: Output Text ?

      Thanks Chris for the wonderful advice...I'll try to get on it. But don't be surprised if you see a post from me soon on how to accomplish some of this stuff! πŸ˜‰

      Thanks again!
      laura

      posted in Developers' Forum
      T
      tpoz
    • RE: Output Text ?

      Thank you Chris...and Chris for replying!
      I'll try to be a bit more clear about what I need to convey to the user:
      The user will input preferences (vegetables, path widths, etc.)from dropdown menus in a few input boxes that will pop up. Because this is user-specific and I would like the script to be as user-friendly as possible I would like to output a user-specific table with things like planting times, harvesting times, vegetable symbol/colour (to use with the garden graphic), etc.
      for the user to be able to use as a reference.
      I will have all the information stored in a hash database in my script, your Entities.add_text comment made me wonder: is there anything fancy i can do with entity info if i label everything? (I apologize if this is a dumb question, I just thought I'd ask πŸ˜„)

      Thanks for any feedback!!
      laura

      posted in Developers' Forum
      T
      tpoz
    • Output Text ?

      Hello all,

      I'll cut right to the chase... I have written a gardening script for SketchUp that requires input of user preferences (veggies, path widths etc.) to determine garden layout. The user gets a graphical representation of their layout, and in addition I would like to be able to write text to a .txt file or .xls file or something so that the user has their information from the graphic available to print out or just view in a straightforward written manner.
      Does anyone know of a way that I could achieve this? Even to be able to write within SketchUp (not in the console, but on the image) would improve my situation greatly.

      Thanks in advance,
      laura

      posted in Developers' Forum
      T
      tpoz
    • Changing the orientation and position of the axis?

      Hello all,
      I am writing a little program with a user interface that is supposed to draw rectangular openings on a face that is user specified (with constraints) but I have run into a bit of a snag.
      Here is the essence of my program:
      -the a user draws a rectangle, with the rectangle tool, and is 'allowed' to translate and rotate this rectangle in the x-y plane
      -based on the dimensions of the rectangle and some input for opening width and such, it is straightforward to define the four points of each opening...if the rectangle is just at the origin.
      I've tried to make a transformation to the axes using Geom::Transformation.axes origin, xaxis, yaxis, zaxis,
      but am unable to make these openings on the user's rectangle.
      I think part of the problem is that I am misinterpreting what transformation.axes really does. Does anyone have any input as to how I could do this or a better explanation of transformation.axes or anything really?!
      Thanks!
      laura
      p.s. if this is unclear, please, let me know πŸ˜„

      posted in Developers' Forum
      T
      tpoz
    • RE: Iterating over multiple hashes

      Thank you so much for the response!
      It works great!

      posted in Developers' Forum
      T
      tpoz
    • Iterating over multiple hashes

      Hello all,
      I have a number of hashes to store info for me, they all have the same keys but each has a different value for each key. I've made a user interface which enables a user to input a list of strings corresponding to a value in the hash. Because the list is input by the user, it is important for me to have the ability to iterate over the hashes (say, from a list of the hash names) without having to call each one in an "if" statement every time I need to do an operation (one could imagine how tedious and inefficient it has been to call all my hashes individually ).

      I thought something like this...
      ` a={:name => "eh", :word=> %w{apple, ascend}}
      b={:name => "bee", :word=> %w{ball}}
      c={:name => "sea", :word=> %w{}}
      d={:name => "d", :word => %w{door dog down}}

      word_size_array = Array.new
      user_specified_list = ["a", "c"]
      array_of_hash_names = %w{a b c d}

      user_specified_list.each do |x|
      array_of_hash_names.each |y|
      if y[:name] == x
      word_size_array << y[:word].length
      end
      end`
      would have worked but it doesn't.

      Instead, I have to do something like this...
      user_specified_list.each do |x| if a[:name] == x word_size_array << a[:word].length elsif b[:name] == x word_size_array << b[:word].length elsif c[:name] == x word_size_array << c[:word].length elsif d[:name] == x word_size_array << d[:word].length else end end
      ...for about 15 (and counting) hashes!

      I would like to be able to call the hash using a ".each" or "do" loop but I have not been able to find the trick that would allow me to do this. Does someone have a way to do this (or an easier way to do this database-type stuff;) ?)

      All input is welcome,
      Thanks,
      laura

      posted in Developers' Forum
      T
      tpoz
    • RE: Access to hashes

      Hello,

      Sorry for the confusion! Thanks for pointing this out Fredo6. I'll try to better explain my predicament...
      I have list2 (beaphash and spihash - a list of all hashes) and list1 (user-generated list where each of the elements refers to a hash). So, I have a user-generated list (this code is just a snippet) and I want to access the the hashes that correspond to list1 and pull, say, the length of the "companion" array from these hashes.

          
      beaphash = Hash["companion" => %w{carrot corn pea}, "antagonist" => %w{beet broccoli onion}, "name" => "bean(pole)"]
      spihash = {"companion" => %w{lettuce pea radish}, "antagonist" => %w{}, "name" => "spinach"}
      tomhash = {"companion"=> %w{bean(pole) potato}, "antagonist" => %w{carrot}, "name"=> "tomato"}
      
      list1 = %w{bean(pole) tomato}
      list2 = %w{beaphash spihash tomhash}
      list3 = Array.new
      
          list1.each do|x|
            list2.each do|y|
              if y["name"] == x
              list3 << (y["companion"]).length
              puts "Hey,  hash length; #{y.length} and name from hash; #{y["name"]} and name from list1; #{x}"
              puts "But beaphash name is #{beaphash["name"]}"
              else
              end
            end
          end
      
      

      ...then I can interleave list1 and list3 to make a new hash.
      I realize that I may have made this more complicated than it needs to be and there may be a simpler solution...I'm really new to Ruby!
      Any help would be very much appreciated!

      Thanks,
      laura

      posted in Developers' Forum
      T
      tpoz
    • RE: Access to hashes

      Hello,
      I guess the problem actually coming from me putting it in a loop:

      
      beaphash = Hash["companion" => %w{carrot corn pea}, "antagonist" => %w{beet broccoli onion}, "name" => "bean(pole)"]
      spihash = {"companion" => %w{lettuce pea radish}, "antagonist" => %w{}, "name" => "spinach"}
      
      list1 = %w{bean(pole) spinach}
      list2 = %w{beaphash,spihash}
      
      list1.each do|x|
        list2.each do|y|
          puts "Hey,  hash length; #{y.length} and name from hash; #{y["name"]} and name from list1; #{x}"
          puts "But beaphash name is #{beaphash["name"]}"
        end
      end
      
      

      I cannot find documentation to tell me what to do with the y in y["name"], which I am assuming is the problem since i can access the hashes by naming them by hand...
      Does anyone have some input?
      laura

      posted in Developers' Forum
      T
      tpoz
    • RE: Access to hashes

      Hi Jim,

      I'm making a vegetable hash and tried two ways of creating the hash. Could it be that I have arrays in there?

      
      beaphash = Hash["companion" => %w{carrot corn pea}, "antagonist" => %w{beet broccoli onion}, "name" => "bean(pole)"] 
      carhash = {"companion" => %w{bean(bush) lettuce leek onion pea bean(pole) radish tomato}, "antagonist" => %w{}, "name" => "carrot"}
      spihash = {"companion" => %w{lettuce pea radish}, "antagonist" => %w{}, "name" => "spinach"}
      
      

      I have tried to do this with arrays (keeping track of the index) and I have found similar results (it gives me a number). As you suggested, I think there must be something fundamental going on.

      Thanks!
      laura

      posted in Developers' Forum
      T
      tpoz
    • RE: Access to hashes

      ooops!
      I can re-post if you like...

      posted in Developers' Forum
      T
      tpoz
    • Access to hashes

      Hello,
      I'm trying to build a database in which to store information and I'm using hashes and arrays to store the info. The only problem is that I'm having a hard time retrieving the info from the hashes.
      I've tried commands such as hash.index("key"), hash.fetch("key"), hash["key"] and have had no luck with accessing the values to the keys.
      Can someone please help me out? I've looked through a few Ruby books but the syntax don't seem to work.
      Thanks,
      tpoz

      posted in Developers' Forum
      T
      tpoz
    • RE: Time Section Help...

      Thanks Jim!

      posted in Developers' Forum
      T
      tpoz
    • Time Section Help...

      Hello,

      I'm pretty new to Ruby and SketchUp and am trying to write a Ruby script using ShadowInfo and various other classes. My problem is that I can't find too much info on how to give all the keys a value. Some keys, like ["City"] or ["DisplayShadows"] have 'accepted' the values I gave, but my biggest prob is the ["ShadowTime"] key, it seems to not accept the time I give it and stays at Fri Nov 08 08:30:00 EST 2002.

      I have looked at some Ruby resources and used commands like Time.local or .gm, but it seems Sketchup doesn't know these because I get an error if I use them. In the Sketchup/Ruby code resources there is reference to a Time Section of which ShadowTime is in; but I can't find out what this means.

      Thanks for any help!
      tpoz

      posted in Developers' Forum
      T
      tpoz
    • 1 / 1