sketchucation logo sketchucation
    • Login
    1. Home
    2. glro
    3. Posts
    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
    G
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 29
    • Posts 403
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Ruby Script - Scene captures/animation

      @unknownuser said:

      @glro said:

      ...
      Is this a Pro feature? I looked for it in 8 and I don't see anything like it. Also I'm on a Mac... (missing feature on Mac?)

      i use sketchup pro, i don't know if it exists in normal sketchup

      you can check using window > preferences > extensions

      if advanced camera tools is in the list, you can do it also

      posted in Plugins
      G
      glro
    • RE: [Plugin] Create Section Drawing V1.3(update Dec16.2012.)

      @tak2hata said:

      ...
      #The ComponentDefinition named "BST_BASELINES" will add baselines to drawings.

      The problem for me when i use section plans is that there is no inference; you can not set their position precisely

      for a reinforced concrete structure, it may not be important; for a steel structure it is because you might have to be more precise

      is there a way to paste a section plan precisely to a point, or a line, for example?

      It is only a detail compared to all the work you have already done... congratulations...

      posted in Plugins
      G
      glro
    • Keyboard shortcuts automatic load

      it is possible to import keyboard shortcuts through the menu

      window > preferences > shortcut > import

      and then you are asked to choose a .dat file ...

      it seems simple, but even that is difficult for some users...

      would it be possible to write some code in ruby to do it automatically?

      posted in Plugins
      G
      glro
    • RE: UI.savepanel question

      @tig said:

      That's what I said; Sketchup returns some PC paths using \ but then needs / in some of its other methods, which is pretty illogical... 😒

      Your...
      filepath=filepath.tr("\\","/")
      can be done with a "change in place" '!', as I showed...
      filepath.tr!("\\","/")
      or as Thomthom says, you get the same results with...
      File.expand_path( filename )
      which also ensures all separators are /...

      All three ways will give the same result.

      yes, Ruby seems as powerful and confusing as human language...

      thank you for your help

      posted in Developers' Forum
      G
      glro
    • RE: UI.savepanel question

      @thomthom said:

      In ruby, always use / as path separator. Under Windows it will translate / to \ .

      If you need to use \ within a string, escape it: "Hello \\ World"

      Thank you for the answer

      The problem is that i don't choose to use "", UI.savepanel does

      I found the line of code that changes "" into "/"; and yes, "within a string, escape it"
      it is: filepath=filepath.tr("\","/")

      favicon

      (www.sketchucation.com)

      now it works

      
      model = Sketchup.active_model
      filepath = UI.savepanel("Save Model to","*.skp")
      # transform "\" into "/"
      filepath=filepath.tr("\\","/")
      #save the file
      Sketchup.active_model.save (filepath)  
      #open a new file (that is close the one that has just been saved)
      Sketchup.file_new
      #open the file that has just been saved
      Sketchup.open_file (filepath)
      
      
      posted in Developers' Forum
      G
      glro
    • UI.savepanel question

      trying to save the current model, using

      
      model = Sketchup.active_model
      path = UI.savepanel("Save Model to","*.skp")
      #this line retrieves the model path but with "\" instead of "/"
      #so later, the path is not recognised
      #how to change "\" into"/" in the path?
      #?????
      #save
      #nomsauv = "??path with / instead of \??"
      #Sketchup.active_model.save (nomsauv)  
      #Sketchup.file_new
      #Sketchup.open_file (nomsauv)  
      
      

      "" is interpreted as an escape character, and i can't find a way to change it into "/"

      Anybody has a solution?

      posted in Developers' Forum
      G
      glro
    • RE: Ruby Script - Scene captures/animation

      @beavieb said:

      Does anyone know of any scripts that allow you to mimic a certain camera lens? To be able to rotate views specific degrees while keeping the same x & y coordinates?
      To have complete control if you want to upload animations?

      Thanks,
      BB

      in the menu,
      window>preferences>extensions

      activate "advanced camera tools"

      translated from french, i don't know eaxctly how it is in english

      posted in Plugins
      G
      glro
    • RE: [Plugin] Component Libraries Loader

      i use this plugin as an alternative to sketchup native component browser; but, even with only one subfolder in the component folder, it takes a lot of room on the screen
      complete path to a component in the library

      would it be possible to have a button, or a key shortcut, that would open a window with only the chosen folder in sketchup component folder; by clicking on this folder, it would show its content, and it would be possible to pick up a component; like this
      reduced panels

      less room on the screen, easier to follow the path to the chosen component with the mouse

      posted in Plugins
      G
      glro
    • RE: A favor please

      @genma saotome said:

      I can't figure out Ruby... even what should be simple Ruby stuff, and so I need to ask a favor, I think a small task:

      I would like to have a plug-in that has two icons, with one issuing the command "Sketchup.break_edges=false" and the other doing "Sketchup.break_edges=true".

      Most of the time my work is done with break_edges-false but every now and then I switch, do some work, and switch back. Having a plugin w/ a pair of icons will be handy.

      Would someone here be so kind as to write this for me? I can do the icon art.

      Many thanks in advance.

      this is something simple enough for me to be able to do it

      unzip the file in the plugin folder

      it works on my computer


      Glro#tbe.zip

      posted in Plugins
      G
      glro
    • RE: Showing edges in color according to the main axes

      @gaieus said:

      Jim's custom toolbar plugin has such a button.

      [attachment=0:381h7ksq]<!-- ia0 -->CustomToolbar.png<!-- ia0 -->[/attachment:381h7ksq]
      The one right to it will toggle endpoints - also a good thing when trouble shooting or connecting mesh.

      thank you

      yes, i realized it later, and that i could do it myself...

      As an alternative to buttons, i like to use keyboard shortcuts; so i slightly modified Jim's plugin to assign a key to it

      Here is the code, without any garantee; it works with me, but i only copied and pasted, cannot explain what i did in detail ...

      require 'sketchup.rb'
      
      # Add a menu item to launch our plugin.
      UI.menu("PlugIns").add_item("colored_edges") { colored_edges }
      # -----------------------------------------------------------------------------
      
      def colored_edges
      
      mod = Sketchup.active_model # Open model
      ent = mod.entities # All entities in model
      sel = mod.selection # Current selection
       
      ro = Sketchup.active_model.rendering_options
        ecm = ro["EdgeColorMode"]
        if ecm != 2
          ecm = 2
          Sketchup.set_status_text "Egde Color Mode; by Axis"
        else
          ecm = 1
          Sketchup.set_status_text "Egde Color Mode; Default"
        end
        ro["EdgeColorMode"] = ecm
      
        end
        
      def axisedge_validation_proc
        if Sketchup.active_model.rendering_options["EdgeColorMode"] == 2
          return MF_CHECKED
        else
          return MF_UNCHECKED
        end
      end
      
      posted in Plugins
      G
      glro
    • Showing edges in color according to the main axes

      Insert a component far from the origin 0 0 0, and give it the right orientation, is difficult because the global axis are not visible in the window

      you have to memorize where they are, or zoom out to see it, and then zoom in again to insert the component precisely

      Sketchup gives the possibility to color the objects edges according to their direction, which is great because this way, you always know where the main axes are, even if you are far from the origin

      Would it be possible to write a plugin that would toggle the edges color to the main axes, just by pressing a key on the keyboard?


      edges color acccording to main axes

      posted in Plugins
      G
      glro
    • RE: Afficher des aretes de couleur RVB

      @unknownuser said:

      Il n'y a pas un mode de style qui n'affiche que les couleurs des arrêtes orientées sur ces axes ? 😉
      (il se peut aussi que je ne comprenne pas la question ❓
      [attachment=0:29zyt0ut]<!-- ia0 -->stylervb.jpg<!-- ia0 -->[/attachment:29zyt0ut]

      oui, c'est ca; mais pour y acceder, il faut cliquer plusieurs fois

      je me demandais s'il y aurait moyen de faire un programme en ruby pour y arriver; en parametrant une touche au clavier...

      j'ai regardé l'API sketchup, je n'ai rien vu qui correspond, mais je suis loin de tout connaitre en ruby...

      posted in Français
      G
      glro
    • Afficher des aretes de couleur RVB

      Existerait-il un moyen de le faire d'une touche au clavier?
      Par un plugin auquel on associerait une touche?

      quand on veut introduire un composant, et que la fenetre n'affiche pas les axes principaux, ca serait bien utile, parce que ca eviterait d'avoir a prendre du recul pour voir comment sont ces axes...

      posted in Français
      G
      glro
    • RE: [Plugin] Rotate 90 around [X, Y, Z] axis

      @hfm said:

      okay, very nice script... but could you please also make it work on X and Y axis? And make it so that you can select a shortcut for the tools?

      Tried to edit it myself but my knowledge of ruby is lacking 🤣
      [did get the 15 degrees to work though 😄 ]

      I don't know much about ruby either, but here is a simplified version of the plugin:

      rotate around the component origin instead of center
      only around z axis and 90 degrees
      no context menu, a line in the plugin menu instead (so you can add a keyboard shortcut (pop up menu, window>preferences>shortcut

      require 'sketchup.rb'
      ##
      ## Rotate selected component instance 90 degrees around Z axis
      ##
      ##  Copyright (c) 2010 Clark Bremer (aka daiku)
      ##  Northern Lights Timber Framing
      ##  clarkb@northernlightstimberframing.com
      ##
      ## 05/02/12; rotation autour de l'origine du composant, axe z seulement, acces menu deroulant ou raccourci clavier
      ## 9/10/2010;	Multiple Groups/Comps 
      ## 5/17/08;  All 3 axes.  Input from Matt666
      ## 4/24/08; Use center as rotation point instead of CI origin.  Also works on groups now.
      ##
      
      # Add a menu item to launch our plugin.
      UI.menu("PlugIns").add_item("rotation90z") { rotate90z }
      # -----------------------------------------------------------------------------
      
      
       def selected_comps_and_groups
           mm = Sketchup.active_model
           ss = mm.selection
       	return nil if ss.empty?
       	ss.each do |cc| 
       		return nil if not ((cc.instance_of? Sketchup;;ComponentInstance) or (cc.instance_of? Sketchup;;Group))
       	end	
          ss
       end
      
      #def rotate90(sel, axis)
      def rotate90z
      	sel = selected_comps_and_groups
      #	axis == "z"
      	rv = Geom;;Vector3d.new(0,0,1)
      #	rv = Geom;;Vector3d.new(0,0,1) if axis == "z"
      #	rv = Geom;;Vector3d.new(0,1,0) if axis == "y"
      #	rv = Geom;;Vector3d.new(1,0,0) if axis == "x"
      	ra = 90.degrees
      	#rt = Geom;;Transformation.rotation(rp, rv, ra) #autour du centre de la boite enveloppe 
      	sel.each do |ent|
      		# rp = Geom;;Point3d.new(ent.bounds.center) 		#rotation point
      		rp = Geom;;Point3d.new(ent.transformation.origin)
      		ent.transform!(Geom;;Transformation.rotation(rp, rv, ra))
      	end	
      end
      
      
      
      #if( not file_loaded?("rot90.rb") )
      #   UI.add_context_menu_handler do |menu|
      #		if menu == nil then 
      #			UI.messagebox("Error setting context menu handler")
      #		else
      #			if (sel = selected_comps_and_groups)
      #				sbm = menu.add_submenu("Rotate 90")
      #				sbm.add_item("Around Red") {rotate90 sel, "x"}
      #				sbm.add_item("Around Green") {rotate90 sel, "y"}
      #				sbm.add_item("Around Blue") {rotate90 sel, "z"}
      #			end
      #		end
      #        
      #	end
      #end
      
      
      #file_loaded("rot90.rb")
      
      posted in Plugins
      G
      glro
    • RE: [Plugin] Rotate 90 around [X, Y, Z] axis

      @jim said:

      @hfm said:

      okay, very nice script... but could you please also make it work on X and Y axis? And make it so that you can select a shortcut for the tools?

      Tried to edit it myself but my knowledge of ruby is lacking 🤣
      [did get the 15 degrees to work though 😄 ]

      I always wanted to make a rotator that is sensitive to the view. For example, it would rotate the selection around the axis that is closest to the axis from the camera to the target. If you wanted ro rotate around the Z, you could select the entities, go to Top view and press the shortcut. If you wanted to rotate around the Y axis, select the entities, go to the Front view and use the same shortcut.

      What do you think?

      My idea is that, having to change the view would take away the advantage of having the rotator sensitive to the view

      I have another suggestion: Rot90.rb rotate the component around (ent.bounds.center); would it be possible to rotate around the origin instead, as you did in your mover2.rb plugin?

      posted in Plugins
      G
      glro
    • RE: Convert a String to Float

      @thomthom said:

      hcal.to_f doesn't modify hcal, it returns a float. So you need to write it like so: hcal = hcal.to_f

      thanks to both you...

      yes, both codes work nicely; i spent 3 hours to look for a solution, and i get 2 different, in a few minutes, on sketchucation...

      learning ruby on the internet is an exciting experience

      posted in Developers' Forum
      G
      glro
    • Convert a String to Float

      i want to read a number from a text file on my hard drive, containing only this number

      i wrote this

      
      hcal = IO.read("C;\\...txt").chomp
      hcal.to_f
      
      

      but when i check

      hcal.class
      

      hcal is still a string, not a float...

      can you tell me where is my mistake?

      posted in Developers' Forum
      G
      glro
    • RE: Add automatically a file to send by e mail

      @tig said:

      You can't add 'arguments' to a UI.openURL() - it's a 'path' only tool.
      BUT you can write a cmd/bat file with the needed data and then open that [it 'executes'] and that can pass/use arguments written into it thus...

      START mailto;"someone@somewhere.com?subject=The%%20Title&cc=%%20&bcc=%%20&body=Hello%%20testing%%20123
      

      See here for more details http://www.robvanderwoude.com/email.php or http://www.paulsadowski.com/wsh/cmdmail.htm

      There are ways to escape the used special characters if you want...
      Just compile the message File.write to a temp file called say 'C:/Temp/emailer.cmd' then
      UI.openURL('file:///C:/Temp/emailer.cmd') to run it.
      You can even make it erase it self as it ends...

      i am not familiar with batch programs, but i shall try to understand the way to do it; thank you!

      posted in Plugins
      G
      glro
    • Add automatically a file to send by e mail

      this code launches the email program on the computer

      UI.openURL("mailto:???@???")

      Is there a way to add automatically a file?

      i didn't find anything here http://code.google.com/intl/fr/apis/sketchup/docs/ourdoc/ui.html#openURL

      posted in Plugins
      G
      glro
    • RE: [Plugin] Solids Penetration Check

      @voljanko said:

      Please help me find the solution for this bug:
      -when one solid is a subcomponent and a subgroup in a component, the plugin can't find the penetration.
      I know the problem is in line 132 def1=solid1.entities.parent ,but don't know what to do about it.
      Thanks

      EDIT:SOLVED

      i cannot help you concerning the ruby programming, but i tried your plugin on the model included in your post, and it worked perfectly; event when i made a component from the component and the group

      i tried it also on the file included; components with solids inside, it worked, but in a strange way; i would like to know which are the components that interfere, but the information vanishes when the program stops...


      where are the components that intersect?


      penetration detected

      posted in Plugins
      G
      glro
    • 1 / 1