ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • Separate objects in a group.

    7
    0 Votes
    7 Posts
    246 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
    86 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
    95 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
    160 Views
    thomthomT
  • Where did the Ruby API go

    5
    0 Votes
    5 Posts
    99 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
    14k 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
    672 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
    187 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
    193 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
    319 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
    969 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
    7k 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
    1k 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
    406 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!
  • My plugin work on Windows not on Mac

    18
    0 Votes
    18 Posts
    214 Views
    D
    if I change the rubies encoding to uft8 and I zapp the gremlins I get this which shows the css for font size is not good. use ems [image: DcYM_2012-11-3008.31.12pm.png]
  • Workaround for &quot;selectSelectionTool&quot; Mac bug?

    6
    0 Votes
    6 Posts
    109 Views
    bradB
    Howdy from Boulder, I do not see a bug in our database for this issue. I'll log a bug for you guys. Take care.
  • Webdialogs: Debugging Javascript on Mac

    4
    0 Votes
    4 Posts
    74 Views
    thomthomT
    The forum search isn't that good. I have more luck using Google to search it.
  • Does someone feel fit to adjust CGAL for usage out of ruby?

    13
    0 Votes
    13 Posts
    829 Views
    N
    I've been toying around on AWS today and I realised something. One of the RGAL's dependencies is Qt3. The precompiled CGAL library in the Ubuntu repository is NOT compiled with Qt3. This means that you have to compile CGAL yourself which is always a hassle. I don't know about other platforms though. It's possible that mac's precompiled CGAL works a charm If bootstrap fails at rb_Nef_polyhedron_3.cpp because it can't find qapplication.h, you have two options. *Either comment out the show method in the cpp file (dont forget to comment out the rice refference to it at the bottom of the file) and the two lines (qapplication and Qt_widget) in the rb_Nef_polyhedron_3.h file *Or get your act together and compile CGAL from scratch remembering to set the Qt3 flag to true. Ideally, it would be nice to have the Nef_polyhedron return a qt_widget object that ruby can then put in its own qt application. I have the feeling that that just isn't possible though.

Advertisement