ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • Understanding repeating code In Ruby?

    5
    0 Votes
    5 Posts
    328 Views
    J
    With this, you can use any combination of ABCD. blocks = UI.inputbox(["Blocks [ABCD]?"])[0] populateA() if blocks[/A/] populateB() if blocks[/B/] populateC() if blocks[/C/] populateD() if blocks[/D/] Or even.. blocks = UI.inputbox(["Blocks [ABCD]?"])[0] letters = blocks.split(//) letters.each do |letter| populate(letter, etc) end
  • Inche fraction in ruby script

    7
    0 Votes
    7 Posts
    875 Views
    N
    wow thank you guys its really appreciated
  • Implementing Todds' Progress Bar?

    12
    0 Votes
    12 Posts
    752 Views
    T
    Thanks guys, without your input, I would have been watching the Bachelor .............I'm kidding! I will post this Ruby when I get it in STILL better shape.
  • Snapto in Sketchup 6

    14
    0 Votes
    14 Posts
    631 Views
    Dan RathbunD
    Updated code example again to handle downloaded component paths pointing to the Temp folder. Is ther any current Component Tool plugin that has something similar to this "Save All" feature?
  • BoundingBox.intersect

    10
    0 Votes
    10 Posts
    1k Views
    P
    I'm seeing the same problem, tested on both Mac and PC with SU 7.1.6 this is clearly a bug as the function does not do what it's name represents. although this would be renamed and used to find if 2 bounding boxes are within the same projected space. I recently posted pretty much the same post here: http://forums.sketchucation.com/viewtopic.php?f=180&t=29156
  • SU 7.1.6 Geom::BoundingBox.intersect does not return empty

    9
    0 Votes
    9 Posts
    881 Views
    P
    @jim said: I haven't ever tried to use this .intersect method, but maybe it's just poorly named. What if you think of it in terms of "overlap"? What it appears to do is give you the length of overlap of the BB's projected infinitely along the Axes. Hopefully the model will explain better. Jim - that is exactly my though - the function acts more as an overlap on the PROJECTIONS of the bounding boxes as opposed to it's literal and more logic meaning of actual intersection of SHARED space. @cjthompson said: cjthompson - Thanks. I personally have a workaround for my needs. but though I'd post it here hoping that a dev. can possibly pick up on this and maybe work this through. your solution is nice though! Chris - this is indeed the same issue
  • Run batch file from ruby as admistrator

    7
    0 Votes
    7 Posts
    4k Views
    S
    yes I know, but that easiest solution slipped through my hands
  • Note disappears when sang is deleted

    3
    0 Votes
    3 Posts
    215 Views
    P
    Thanks a lot Thomas.
  • Retrieve Color Layer assigned by Sketchup

    16
    0 Votes
    16 Posts
    1k Views
    C
    Hy, TIG plugin ListLayerColors after some modifications, can create new colors in the pallet with layer's colors require 'sketchup.rb' ### class CreateLayerColors def CreateLayerColors ;;get() model=Sketchup.active_model entities = model.active_entities materials=model.materials layers=model.layers if model.rendering_options["DisplayColorByLayer"]==false model.rendering_options["DisplayColorByLayer"]=true already_on=false else already_on=true end#if # create temporary entities for exporting layers vecteur = Geom;;Vector3d.new 0,0,1 centre = Geom;;Point3d.new 0,0,0 group_temp=entities.add_group() entities = group_temp.entities x =0 layers.each {|layer| model.active_layer = layer centre = [centre[0], centre[1], centre[2] + x] edges = entities.add_circle centre, vecteur, 0.01 cercle = entities.add_face(edges) x= x + 0.01 } model.save "temp" mpath = Sketchup.find_support_file "temp", "Plugins/" model.export(mpath +".obj",false) mtl=mpath+".mtl" text=IO.readlines(mtl) 0.upto(text.length-1) do |i| if text[i]=~/^newmtl */ name=text[i].slice(7..-2)### layer name only rgbR=((text[i+2].slice(3..11).to_f)*255).to_i.to_s### color rgb values rgbG=((text[i+2].slice(12..20).to_f)*255).to_i.to_s### color rgb values rgbB=((text[i+2].slice(21..29).to_f)*255).to_i.to_s### color rgb values couleur_calque = Sketchup;;Color.new(rgbR.to_i, rgbG.to_i, rgbB.to_i) unless materials[name] new_matiere = materials.add name new_matiere.color = couleur_calque new_matiere = new_matiere.name else materials[name].color = couleur_calque end end#if end#upto File.delete(mpath+".obj") File.delete(mtl) File.delete(mpath) group_temp.erase! ### model.rendering_options["DisplayColorByLayer"]=false if already_on==false ### end#def end#class ### menu # add menu items if(not file_loaded?("CreateLayerColors.rb")) UI.menu("Plugins").add_item("Create Layer Colors"){CreateLayerColors;;get} end#if file_loaded("CreateLayerColors.rb") ### CreateColorLayer Christophe
  • Change Toolbar Icon Size

    8
    0 Votes
    8 Posts
    4k Views
    Chris FullmerC
    Ruby is not the programming language of SketchUp. SketchUp is written in a compiled, closed down language and we do not get to see what makes SketchUp work. They have opened small portals into SketchUp. That is where Ruby comes in. Ruby is allowed to interface with the core SketchUp program. But it can only do what they have designed it do it. They have not allowed us access to change the toolbar icon possible sizes, therefore we can not do it. But the workaround is to make your own icons on the screen like some of us have played with. Or to make a Web Dialog with your own icons. Besides, I bet no one would want you to change their icon size for them. People have very strong feelings about how their UI is set up. And no one would want a script to come in and change things outside the realm of that script (like global icon size). Good luck with it, Chris
  • Face.clone

    16
    0 Votes
    16 Posts
    4k Views
    K
    Didier - thanks for posting this. For my current purposes, I sometimes have another face bounded by the inner loops that I don't want to erase, so If I copy a bunch of faces together, and copy the inner loop faces first, then they'll get deleted when I copy the outer faces. So, creating a group, copying the group, and immediately exploding the original group is the best method for me. Dan - thanks for the info on face.clone and face.dup. I saw <Deleted Entity: xxxxxxxxx> pop up in the ruby console, but I just assumed that the face was immediately deleted because it was placed on top of the other face. -- Karen
  • Executing a ruby file

    4
    0 Votes
    4 Posts
    206 Views
    Dan RathbunD
    @thomthom said: So from that you know the command to trigger the command: create_box ... That is assuming that box.rb is loaded. HOWEVER... there is a bug in box.rb, if Tools/make_pano_pm.rb is also loaded (it loads after box.rb,) and redefines the create_box method; so the box object is never created. I posted a fixed version of box.rb [Example] box.rb version 2.0.0
  • SketchUp API docs

    5
    0 Votes
    5 Posts
    849 Views
    thomthomT
    The effect of how many sets you use are as following: 1 set: The origin of the texture, width and height is taken from the material width and height 2 sets: Origin and scale+alignment 3 sets: Origin, scale+alignment, Skew 4 sets: Origin, scale+alignment, Skew, Distortion
  • Google earth import view ruby action

    7
    0 Votes
    7 Posts
    789 Views
    Dan RathbunD
    @simonstaton said: oh crap, so no way of moving it out of the menu and onto my toolbar? (1) You CANNOT move anything out of any menu. (2) The Google Toolbar already has all the buttons. Toggle it with: Sketchup.send_action( 10617 )* Show it: UI.set_toolbar_visible('Google', true)* Hide it: UI.set_toolbar_visible('Google', false)
  • Launch an Application in RUBY

    14
    0 Votes
    14 Posts
    2k Views
    S
    dont worry i needed to put a "+" between to two solved! thanks tig
  • Making an alert

    3
    0 Votes
    3 Posts
    155 Views
    S
    perefect thanks
  • Exploding selected model using ruby numeric values

    10
    0 Votes
    10 Posts
    654 Views
    S
    Hi Tig, I have sent you a pm with more details about the attributes exporter.
  • Ruby code: Random colored faces ?

    7
    0 Votes
    7 Posts
    843 Views
    Didier BurD
    Hi @unknownuser said: I picked the order of the faces anticlockwise You just have to reverse the order of points when creating the face, or to check the normal after creating it: myface=Sketchup.active_model.entities.add_face(p1,p2,...pn) # Default normal to blue (up) face.reverse! if face.normal.z<0
  • Component layer?

    4
    0 Votes
    4 Posts
    219 Views
    thomthomT
    You can assigned the entities in the ComponentDefinition a layer, and you can assign ComponentInstances a layer. And while practically you can apply a layer to a definition, SketchUp ignores this.
  • String.unpack - signed 4byte little-endian integer?

    17
    0 Votes
    17 Posts
    2k Views
    thomthomT
    That sounds good. I still haven't been able to look at this. Trying to crunch out Vertex Tools.

Advertisement