⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
  • Moving Axis / Origin of a Group

    3
    0 Votes
    3 Posts
    92 Views
    M
    Tig, ok this did the trick! THX!
  • Upgrading OSX from 10.5 to Mountain Lion?

    18
    0 Votes
    18 Posts
    2k Views
    D
    I've got that on my macBook Pro and when I completely dorked my iMac 48hrs ago, I wanted to use it to do a rescue but both partitions where to small... I kicked myself because I haven't used the 'old' OS on it since I updated, just haven't found a reason to and had forgotten it was there, taking up space. luckily, I was able to use unix in single user mode to rm the offending software and rescue my drive [no backups...] word of warning LittleSnitch and CodeWeaver combined, can dork pThread's causing complete system lockdown.
  • Is mac set_html working, again?

    16
    0 Votes
    16 Posts
    2k Views
    D
    I nicked this from the other thread, because thought it was appropiate to something I wanted to say... @thomthom said: @jolran said: So doing like that and putting in an image for button like below would work on Mac? It used to work, then it didn't. Then it might be working for some. But not me. I wouldn't rely on it. I agree, for now, for general release plugins, but I like using set_html with Heredoc for simple short scripts, like toolbar buttons. If your on the 'evil' WebKit version you could use the same basics but write to file the use set_file I'll dig up the unix call to check webkit version, then a conditional could do either/or thoughts... john
  • .get_element_value with radio button sets

    22
    0 Votes
    22 Posts
    1k Views
    jolranJ
    Ahh, I see John. If I get it right the sethtml thing is working cause of updated Mountain Lion? Thomthom, I have been searching through threads where you discuss just this issue, thats why I also asked this question. Being not confident in Webdialog, the platform issues are a bit confusing sometimes. But I take your word for it and try to fix it with set_file instead. Thanks.
  • Separate objects in a group.

    7
    0 Votes
    7 Posts
    336 Views
    TIGT
    A screen shot of your planks showing them an not being conjoined would have helped zoom in on a solution more quickly. My solution assumes they all touch each other...
  • Add entities to a layer

    6
    0 Votes
    6 Posts
    139 Views
    S
    thank you very much for the detailed explanation TIG. It cleared the doubted areas about the layers.
  • Ruby Code Completion

    9
    0 Votes
    9 Posts
    2k Views
    Dan RathbunD
    Somewhere in one of the SU Bridge topic threads I posted a SketchupExtension script example that works for installing the SUB files in a common install directory. ADD: OK, found it here: Re: Notepad++ SU8 Ruby API Autocomplete .. and the d/l link is: bridge_ext.rb This very important especially if you are a developer, and have several side-by-side SketchUp installs of various versions / MR levels. It lets the IDE/Editor have a single valid path to SUB.exe, no matter which SketchUp version you are testing your code on.
  • Reset Tranformation of component/instance

    4
    0 Votes
    4 Posts
    141 Views
    M
    Thx Dan for the links. After a search of 15 minut I tend to ask someone. Thomthom: I see what you mean. Thx!
  • [Utility] make-rbz

    2
    0 Votes
    2 Posts
    187 Views
    thomthomT
  • Where did the Ruby API go

    5
    0 Votes
    5 Posts
    164 Views
    TIGT
    It does seem to have now been fixed for the API docs sub-pages links
  • Can you get a list of OSX fonts somehow?

    110
    0 Votes
    110 Posts
    15k Views
    D
    This is probably my last effort on this.... circles, but, I finally figured out find in Ruby Console, escapes, escapes, escapes... THE THIRD WAY... no Font Book... no fc-list... just plain old find >> mdls... not the fastest, but not too bad. inculed is Dan's tester, these all created 3D text from console, only Font Book and usr/local/bin/fc-list do that out of the can. a=(`find /System/Library/Fonts\ /Library/Fonts\ ~/Library/Fonts\ \\( -name "*.ttf" -o -name "*.otf" \\) -type f`).split("\n").map! { |f| f.gsub(" ", "\\ ")} #need this or something to catch spaces in filenames b=(a.collect{|x| `mdls -name com_apple_ats_name_family -raw #{x}`}).map! { |f| f.split(",")[0]} #the other items in each array are unicode strings for other languages, if you want those use Font Book c=b.map { |f| f[/[("\s]+([^"\n]+)[)"\s]+/m,1] }.uniq!.sort![2..-1] #[0] is empty, [1] is a dot file, could remove them macFonts = c chunksize = 1 chunk = 1 limit = macFonts.length model = Sketchup.active_model fsize = 1.0 linespacing = 1.2 bold = false italic = false thick = 0.05 filled = true quality = 0.0 i = 0 while i < limit begin # model.start_operation("3D Fontnames (#{chunk})") # chunksize.times do |n| # break if i == limit # item = macFonts[i] grp = model.entities.add_group() grp.entities.add_3d_text( "#{item}", TextAlignCenter, "#{item}", bold, italic, fsize, quality, 0.0, filled, thick ) grp.name= item grp.move!( Geom;;Transformation.new(Geom;;Vector3d.new(0,-(i*linespacing),0)) ) # i += 1 # end # chunk # model.commit_operation() # rescue Exception => e puts("\n*** macFonts group Error! ***") puts(" i = #{i}") puts(" chunk = #{chunk}") puts(" font = #{macFonts[i]}\n") model.abort_operation() puts("Error #<#{e.class.name}; #{e.message}>") puts(e.backtrace) if $VERBOSE raise end chunk += 1 end # while
  • Toolbars

    18
    0 Votes
    18 Posts
    813 Views
    thomthomT
    @driven said: TT + Dan, I can't seem to get that to work on a mac. do I need to create a menu item as well, grey it out, and the button follows? Error: #<NoMethodError: undefined methodset_validation_proc' for #UI::Toolbar:0x113cb6ec>` I have a menu entry for the 'master' toolbar, but don't really want/need lots of submenu items. john Sorry, wrong link. http://www.sketchup.com/intl/en/developer/docs/ourdoc/command#set_validation_proc Use it on the Command object.
  • Win 7 to Win 8 =&gt; no system() anymore...

    10
    0 Votes
    10 Posts
    304 Views
    Dan RathbunD
    @pixero said: @thomthom said: ... I then add a .rb file in the Plugins folder that adds that folder to the $LOAD_PATH array and then loops over all the rb and rbs files to load them. That way I'm working on my plugins in a location where I have full permissions. Could you please post how that file looks in its entirety? I would like to get that to work for me as well. @Pixero, and anyone else.. I have already posted such a script, ready-made for you to modify with your custom paths, be it a dropbox or just folders in your "user/documents" path (which you will always have full permissions to.) In addition, it adds an autoload feature that looks for sub-directories named " %(#408000)[!_autoload]", in ALL of the $LOAD_PATH directories, and if found, will call require on any loadable files it finds. I do this because this way you KNOW what files (in those custom paths,) will be automatically loading. Here's the link: [Code] !autoload.rb loads "!_autoload" folders
  • Webdialog visible/open?

    10
    0 Votes
    10 Posts
    374 Views
    Dan RathbunD
    @hgroeneveld said: What is passed to " def initialize(show_dialog)"??? The initialize() method is an "internal" Ruby method that all Ruby class objects have. IF you do not override it, the class just inherits a copy from it's superclass. This initialize() method is called automatically by Ruby at the end of the new() class constructor method, after new() has created the instance. Realize that initialize() is an instance method, and new() is a class method, therefor new() calls the initialize() instance method, in the instance object, that it just created, passing along the entire argument list it itself received. So when you do: @dlg = ShowDialog.new("Plugin Options") The new() method (internally,) will create the new instance of the ShowDialog class, (referenced internally as obj,) and THEN call the new instance's initialize() instance method, passing it the string argument "Plugin Options", like: obj.initialize("Plugin Options") Lastly, the new() method returns it's internal local reference to obj, which you then assign to a reference in the outer scope. In the example above, that reference is the @dlg variable. @hgroeneveld said: I put a msgbox there, but it never gets triggered... UI.messagebox() is a Ruby method, that when evaluated (after the messagebox closes,) returns nil, so in effect you would be passing nil into the initialize() method. So.. whatever arguments that you want to pass into the new instance, at creation time, are passed via the class constructor method new(), and YOU must override the instance method initialize() in order to process those arguments, whatever they may be. (Usually by assigning them to instance variables that the instance will later use.) This is all in Ruby, Part I, Chapter 2, Classes, Objects, and Variables
  • Loading PNG Textures in Ruby plugin and SketchUp freezes

    9
    0 Votes
    9 Posts
    399 Views
    J
    I've had problems when exporting PNG files from Corel Photo-Paint & importing them into SKUP. I found that I had to re-save the image files in IrfanView before they would play ball.
  • Html multiline, js to SketchUp

    16
    0 Votes
    16 Posts
    1k Views
    Dan RathbunD
    @myhand said: @dan rathbun said: (1) I said inside your module (not your directory!) ... Sorry Dan, I am being really thick here . Are you saying I should cut and paste the code in common.rb into MyPlugin.rb file...? It is what I told Chris to do (in case he didn't wish to have users of his code do a full Ruby install.) %(#8000FF)[An aside rant to any reader who won't read a book, and learn the basics, before diving in and attempting to write complex projects:] If you don't know what I meant by "inside your module" you likely did not follow the advice in my Newbie Guide, and have skipped over learning the nitty-gritty basics of Ruby. Yes it can be boring, but your just running into frustrations because you don't know the simple things. Really .. print out a chapter a day from the ol' "Pick-Axe" book, and put it next to toilet. Don't waste the time when your sitting on the pot. In a nutshell... you need to be writing all your code within YOUR unique top-level namespace (which is a module in Ruby.) Unwrapped code runs within the TOPLEVEL_BINDING, which is the global instance of Object ... and everything is a descendant of Object, so everything inherits whatever is defined in Object. Other authors do not want your objects, variables etc, propagating into their plugins. OK ... back on subject, ... "uri/common.rb" ... for now just leave it in the Ruby lib directory, where it belongs, and use a script similar to the one posted to push paths for a full Ruby install. See: Ruby LOAD PATHs script (Win32)
  • Using object ids to restore object instance references?

    8
    0 Votes
    8 Posts
    2k Views
    thomthomT
    Yea. Remember that the Ruby API was added in version 4 - it's on top of the C++ core in SketchUp.
  • JSON in Ruby

    48
    0 Votes
    48 Posts
    8k Views
    Dan RathbunD
    [quote="Myhand":31wco2xd]I see that %(#8000BF)[escape()] and %(#8000BF)[unescape()] are deprecated (in Javascript,) though, and that you are recommending to use [them] ***%(#BF4000)[ @unknownuser said: ]*** @unknownuser said: ](http://msdn.microsoft.com/en-us/library/dz4x90hk(v)":31wco2xd]The unescape function should not be used to decode Uniform Resource Identifiers (URI). Use decodeURI and decodeURIComponent functions instead. %(#8000BF)[decodeURI()] %(#8000BF)[decodeURIComponent()] Which do you recommend or should I continue with %(#8000BF)[unescape()]? The old functions are ASCII, the new ones are Unicode. Taking a look at the most recent released ECMA-262 (but not the latest proposed revision,) the old functions are no longer listed. see: ECMA-262, 5.1, Global Object: 15.1.3 URI Handling Function Properties ECMAScript Language Specification Standard ECMA-262 5.1 Edition / June 2011 Link to the downloadable PDF of the specification. But you need to handle the situation where an older browser does not have these functions so, write a wrapper in JS: var unesc = function(uri) { var test = false; if (typeof(decodeURI) == "function") test = true; return test ? decodeURI(uri) ; unescape(uri); }
  • Genetic algorithm bin packing

    7
    0 Votes
    7 Posts
    2k Views
    thomthomT
    Once you get your head wrapped around programming and you start to develop your plugin I recommend you read through this guide on how to ensure your plugin doesn't clash with other plugins: http://www.thomthom.net/thoughts/2012/01/golden-rules-of-sketchup-plugin-development/ There's also many more articles on my blog detailing various topics.
  • Curious dialog box

    17
    0 Votes
    17 Posts
    649 Views
    Chris FullmerC
    Yeah it was back before version 4 I think. It recorded the mouse position on the screen and mouse clicks. So if you re-positioned your SU window, the whole macro broke!

Advertisement