sketchucation logo sketchucation
    • Login
    1. Home
    2. RickW
    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!
    πŸ”Œ Smart Spline | Fluid way to handle splines for furniture design and complex structures. Download
    R
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 36
    • Posts 779
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Collaborative Effort - Ruby Template, RDoc, and Localization

      @tomot said:

      I applaud your efforts towards bringing some order to the Ruby script writing chaos. I also see you have taken it upon yourself to direct a task which I think should be directed by SU Google staff.

      But it appears they are again missing in action. Unless perhaps via private email you have their blessing in this endeavor.

      Actually, Scott Lininger did provide input on the template file. I do know from private correspondence that they are very busy on some things and may not be responding as much as they would like, and hope Scott will have some time for input on this as well.

      But yes, it is a rather self-appointed task πŸ˜„

      I've thought about the xml vs. plain text issue. I suppose a standalone menu-generating script could be required and then called to create the menus by parsing the xml (which would need a <code> section added to Todd's example, I think). The drawback to me is that it becomes one more thing to write, distribute, support, and incorporate in the script, in addition to the extra menu file/s (which bothers me as well, but what do you do?). The benefit is that it clearly delimits each field's function.

      posted in Developers' Forum
      R
      RickW
    • RE: Groupbytextures.rb

      For some reason (which I will try to figure out later), G/Cs are not exploding as expected. If you run it a few times (# of times to run = # of levels of nested groups), it will eventually get everything grouped correctly.

      posted in Developers' Forum
      R
      RickW
    • RE: Greeble Beta (Updated Feb-06-2009)

      @chris fullmer said:

      I like how your code consolidates it all down to just 2 lines though. I already can see all the extra fluff I have in there, so I'll clean it up.

      If the forum didn't wrap the line, you would see a single line of code. πŸ˜„ It's called a "ternary expression" since it has three parts (binary is 2 parts, ternary is 3 parts), and it is essentially just a very compact if:then:else statement.

      The parts are:
      (argument) ? (result_if_true) : (result_if_false)

      It's best for short tests, but will work for longer ones, and you can nest them:

      def guessme(x=10)
        my_number = rand(x.to_i)+1
        while (guess = ((UI.inputbox(["Guess a number between 1 and #{x} inclusive;"]))[0]).to_i)
          (guess == my_number) ? (UI.messagebox("You're right!");return nil) ; (return nil if UI.messagebox("Too #{(guess>my_number) ? ("high") ; ("low")}. Try again?", MB_YESNO)==7)
        end
      end
      
      
      posted in Developers' Forum
      R
      RickW
    • RE: Greeble Beta (Updated Feb-06-2009)

      Definitely test with face.valid?

      if face.valid?
        #do code here
      end
      

      As for SU6/7 issues, it could be an issue of the model.start_operation(name,true) breaking SU6, since SU6 only takes one argument. I use this:

      (Sketchup.version[0,1].to_i<7) ? (view.model.start_operation "name here") ; (view.model.start_operation "name here", true)
      
      

      obviously changing "name here" to something a bit more descriptive πŸ˜„

      posted in Developers' Forum
      R
      RickW
    • [Plugin] GoldenGauge now available

      GoldenGauge is now available (free!) at Smustard.com

      gg1.jpg

      It creates a vertical 2x2 grid based on 3 point selections (start, width, height). The grid is independently scaled vertically and horizontally.

      I will add enhancements to another version.

      posted in Plugins
      R
      RickW
    • RE: Golden Mean Gauge

      GoldenGauge is now available for free at Smustard.com

      posted in Developers' Forum
      R
      RickW
    • RE: Collaborative Effort - Ruby Template, RDoc, and Localization

      @thomthom said:

      So use user completely replaces the menu language file?

      Just wondering about packaging. What if you want to include multiple language packs? (Or maybe this isn't the scope for this? This is purely a bare minimum way of allowing localization?)

      Someone replaces the contents of that file, yes. As far as Smustard goes, my goal is to have all our menu items converted over, and users could download "language packs" of the whole library of .menu files for their language (we'll see how quickly that gets done). πŸ˜„

      My goals in leaving it plain text is that it is most accessible (IMO) that way and it requires the least amount of processing in the ruby script, but there might be drawbacks. Input is definitely welcome.

      Obviously, for other authors, the issue is slightly more complicated, but only slightly. Each menu file could be appended with the proper country extension (for example, "myrubyscript-de.menu", "myrubyscript-mx.menu", "myrubyscript-enUS.menu" etc) and then the user removes the extension for the one they want to use ("myrubyscript.menu"). For Windowizer4, I tried making it automatic based on the SU-reported locale, but that was not reliable and so most users ended up renaming the .html file anyway.

      posted in Developers' Forum
      R
      RickW
    • RE: Collaborative Effort - Ruby Template, RDoc, and Localization

      I'm considering adding this to the ruby template, but wanted to get input. After a rather infamous incident recently, I thought about easing the localization effort for menus, and came up with this:

      1. create a "menus" subfolder in the Plugins folder (to keep things tidy)

      2. in that folder, create a text file with the same name as your .rb file, with the extension ".menu" and put each menu item text string on a separate line, like this (the submenu, submenu2, etc names are only to illustrate where they are in the menu structure for this particular example):

      context menu label
      submenu label
      submenu item label
      submenu2 label
      submenu2 item1 label
      submenu2 item2 label
      submenu2 item3 label
      submenu2 item4 label
      submenu2 item5 label
      submenu2 item6 label
      
      # This file may be translated for localization
      
      
      1. use the following example code to read the lines from the .menu file into your menu structure:
      unless file_loaded?(__FILE__)
      	file_loaded(__FILE__)
      	menunames = IO.readlines(File.dirname(__FILE__)+"/menus/"+File.basename(__FILE__, ".rb")+".menu").collect{|x| x.chop}
      	UI.add_context_menu_handler do |menu|
      		menu.add_item(menunames[0]) { code }
      	end
      	$submenu ? (organizer = $submenu) ; (organizer = UI.menu("Plugins"))
      	submenu = organizer.add_submenu(menunames[1])
      		submenu.add_item(menunames[2]) { code }
      		submenu2 = submenu.add_submenu(menunames[3])
      			submenu2.add_item(menunames[4]) { code }
      			submenu2.add_item(menunames[5]) { code }
      
      			submenu2.add_separator
      
      			submenu2.add_item(menunames[6]) { code }
      			submenu2.add_item(menunames[7]) { code }
      			submenu2.add_item(menunames[8]) { code }
      			submenu2.add_item(menunames[9]) { code }
      end
      
      

      This particular example does everything except submenus and separators for the context menu.

      As I see it, this will make localization a breeze, since someone only has to translate the .menu file, which is plain text. It also eliminates copyright problems, since the code is unchanged.

      Thoughts?

      posted in Developers' Forum
      R
      RickW
    • RE: Golden Mean Gauge

      I'm on it. πŸ˜„

      posted in Developers' Forum
      R
      RickW
    • RE: Copy along path ruby strange behavior

      I've tried multiple ways to reverse polylines, but there doesn't seem to be a reliable way to permanently affect the geometry.

      I included a reverse-direction option in FlightPath, I should probably look into the same kind of option for PathCopy.

      PS - that guy in the image looks a bit lost. Did someone tell him to stand in the corner? πŸ˜„

      posted in Developers' Forum
      R
      RickW
    • RE: Greeble Beta (Updated Feb-06-2009)

      Change all the ".to_i" methods to ".to_l" when handling the user input data, and you'll have metric support. Users will be able to enter 50mm, 12m, 23'4", etc. and it will be converted to SU units automatically.

      Oddly enough, though the ruby console will convert 1.km to SU units, it will not work from within a text string.

      posted in Developers' Forum
      R
      RickW
    • RE: Collaborative Effort - Ruby Template, RDoc, and Localization

      Developers,

      Please note that the menu information is also part of the template, designed to function with Organizer.rb (even though Organizer.rb is NOT required for the menu to work).

      If you choose to not use this menu template, please also remove the top line of the header "# Supports Organizer.rb". Otherwise, users trying to use OrganizerEdit to make your work compatible with Organizer will not be able to do so. Then I'll get support requests, and I'll have to forward them on to you to fix the issues πŸ˜„

      Here is the documentation for creating Organizer-compatible menus (though the work has already been done in this template)

      posted in Developers' Forum
      R
      RickW
    • RE: Greeble Beta (Updated Feb-06-2009)

      Nice job, Chris!

      The next step would be to get min/max offset parameters (that could be the same if consistency is desired) to randomize the offset size.

      posted in Developers' Forum
      R
      RickW
    • RE: Collaborative Effort - Ruby Template, RDoc, and Localization

      There is a list syntax. See the RDoc docs for more info.

      posted in Developers' Forum
      R
      RickW
    • RE: Guy charging U$100 for package containing free rubies!!

      If nothing else, this situation highlights the need for better localization capability for scripts. If creating translations was as easy as a simple text file with one-to-one replacements, he could package and sell the translation file and the icon sets, and leave the script acquisition to the user. The toolbars could even be coded to only display buttons for downloaded scripts.

      He clearly did some work to create the buttons and the translations, and if he can get paid for it, then more power to him - as long as he leaves distribution to the authors (unless they agree to let him distribute).

      I tried to have broad localization for Windowizer4, and got a lot of support from this community (thanks again), but I'm still trying to find a better solution (code-wise) for translating webDialogs. If we can solve the translation issue, this situation would be less likely.

      posted in Developers' Forum
      R
      RickW
    • RE: To RickW: NightSky trouble

      I can tell you that turning off NightSky will turn off the sky in SketchUp, rather than restore the setting prior to using NightSky. I will look into changing that.

      As for the dialog box problem, all I can think of is that there must be a security issue with your browser settings, because the html is about as basic as it gets.

      posted in Developers' Forum
      R
      RickW
    • RE: Collaborative Effort - Ruby Template, RDoc, and Localization

      @thomthom said:

      I want to have a look into how easy it is to reliably extract plugin data in regards to auto updaters etc. Maybe include an compatible list, a list that states which SU version it's compatible. And optionally, and list of plugins that might be incompatible with?

      It should be straightforward, using a regexp to parse the file. The fields are known (that's the point of this exercise), so writing a parser should be easy. The challenge, IMO, is to keep it easily human-readable, while allowing machine readability.

      @thomthom said:

      What I'd like as alternative for the text is where it's allowed to copy, modify and distribute for non-commercial use. I'm not really sure how it's best phrased these sort of things.

      I'm not an attorney, but this might work:
      Permission to use, copy, modify, and distribute this software for noncommercial purposes and without fee is hereby granted, provided that the above copyright notice appear in all copies. Commercial distribution, in whole or in part, is expressly prohibited without the expressed, written consent of the author.

      Edited per Gai. I found both "express written" and "expressed written" online, didn't know if one was more correct for legal jargon.

      posted in Developers' Forum
      R
      RickW
    • RE: To RickW: NightSky trouble

      That IS strange. Did you extract the nightskydialog.html file from the .zip download?
      Also, try turning it on & off with the ruby console open and see if there are any error messages.

      posted in Developers' Forum
      R
      RickW
    • RE: The curruption will (did) prevail - rant

      @mr s said:

      The other 98% are interested only in TV, Sports and Sex etc. In so far as they do take an interest in politics, they like it presented to them in simple soap-opera style.
      A simple telegenic appearance with meaningless catchphrases such as "Change" and a wife whose fashion choices can be discussed endlessly are on about the level required for most.

      That's about right, thanks to our dumbed-down government-run education system and our leftist news/entertainment industry, which teach us to trust the government to take care of us.

      I personally am sick of the rhetoric that the government will solve our problems and the media's complicity in spreading that message. The government can't even solve its own problems (deficit spending, public debt, overinflated bureaucracy, gross inefficiency), much less ours. And yet, we (collectively) have been conditioned to believe we can't take care of ourselves.

      How, then, is it even conceivable that for over 150 years, the US managed to survive without government welfare, government healthcare, government retirement pay, government work programs, and other government fiscal insanity?

      The Constitution was established for certain stated purposes, namely to create and set the limits of a new national government for the USA. In outlining the form of that national government, it stated the following reasons and goals for that government:

      1. form a more perfect union (the new form of national government dictated by the Constitution, as compared to that under the Articles of Confederation)
      2. establish justice (through the court system)
      3. ensure domestic tranquility (through the rule of law, not the rule of majority)
      4. provide for the common defense (strong military)
      5. promote the general welfare (not "provide" - the government should create an environment of success, partly by regulating fair practices, but primarily by staying out of the way of what the people can and should do for themselves and each other)
      6. secure the blessings of liberty (liberty being the freedom that comes from a limited government. More government equals less liberty)
        And what has happened since 1787?

      @unknownuser said:

      Paradoxically enough, the release of initiative and enterprise made possible by popular self-government ultimately generates disintegrating forces from within. Again and again after freedom has brought opportunity and some degree of plenty, the competent become selfish, luxury-loving and complacent, the incompetent and the unfortunate grow envious and covetous, and all three groups turn aside from the hard road of freedom to worship the Golden Calf of economic security. The historical cycle seems to be: From bondage to spiritual faith; from spiritual faith to courage; from courage to liberty; from liberty to abundance; from abundance to selfishness; from selfishness to apathy; from apathy to dependency; and from dependency back to bondage once more.

      At the stage between apathy and dependency, men always turn in fear to economic and political panaceas. New conditions, it is claimed, require new remedies. Under such circumstances, the competent citizen is certainly not a fool if he insists upon using the compass of history when forced to sail uncharted seas. Usually so-called new remedies are not new at all. Compulsory planned economy, for example, was tried by the Chinese some three milleniums ago, and by the Romans in the early centuries of the Christian era. It was applied in Germany, Italy and Russia long before the present war broke out. Yet it is being seriously advocated today as a solution of our economic problems in the United States. Its proponents confidently assert that government can successfully plan and control all major business activity in the nation, and still not interfere with our political freedom and our hard-won civil and religious liberties. The lessons of history all point in exactly the reverse direction. - Henning W. Prentis, Industrial Management in a Republic, p. 22 (1943)

      Are we now in that stage between apathy and dependency? Economic woes have caused many to look to the government for a panacea. A charismatic leader said he could help government make that happen. Each new government program, each new entitlement pushes society further into dependency and that much closer to bondage. It's disconcerting to realize that equally describes 1930s Germany as well as modern day America. Would that we could learn from history before we find ourselves condemned to repeat it.

      posted in Corner Bar
      R
      RickW
    • 1 / 1