🏒 PlaceMaker | 25% off for February including new Google Earth data imports! Learn more
  • 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
    205 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
    842 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
    782 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
    152 Views
    S
    perefect thanks
  • Exploding selected model using ruby numeric values

    10
    0 Votes
    10 Posts
    653 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
    836 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
    217 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.
  • Script and custom tool work together ?

    6
    0 Votes
    6 Posts
    293 Views
    Didier BurD
    Cool, thanks a million
  • How does one get the current model axis?

    11
    0 Votes
    11 Posts
    537 Views
    Dan RathbunD
    Question(s) on Axes: (Background: I am used to how other CAD / Modeling applications had a World Originand a World Axes [ie, WCS], and this allowed the user to create any number of named User Origins [offset from the World Origin, specified with a vector;] meaning the World origin was always remembered, but could itself be moved by the user. AutoCAD used to call these a UCS. I suppose then you could define the Axes for these UCS.) So... in Sketchup, currently: (a) I assume (and this is part of the question; I'd like a confirm,) that the Georeferencing Location for the model is based on the Sketchup model's World Origin. (b) IF the user moves the "World Origin" with the Axes Tool, would that shift the model geographically, if it (the model,) was then re-uploaded to Google Earth?
  • CadalogBeamTool Not Working

    4
    0 Votes
    4 Posts
    765 Views
    L
    Does beam tool have all the steel cross sections for ansi. I'm only getting a few cross sections. I was hoping it would have the complete aisc catalogue. Has one been created to date?
  • Free PR for Plugin Developers

    3
    0 Votes
    3 Posts
    266 Views
    M
    @thomthom said: "treeware" = book? Yes!
  • How to Get &quot; are there shadows on a face?&quot;

    4
    0 Votes
    4 Posts
    306 Views
    TIGT
    I recall that there's a '1001 shadow tool' to draw shadows on faces as new grouped faces - this is possibly the basis of what you want... http://www.1001shadows.com/en/index.html
  • Use Ruby's Unit-testing functionality in Sketchup

    15
    0 Votes
    15 Posts
    2k Views
    L
    the code snippet is not an actual test, but just to prove it works. now the real work starts. thanks for the hint on directing the SU output.

Advertisement