🏢 PlaceMaker | 25% off for February including new Google Earth data imports! Learn more
  • Mac UI.messagebox - hud and timeout

    38
    0 Votes
    38 Posts
    2k Views
    D
    That's what was happening here, the block bit, until I put it in it's own thread. @bht= Thread.new { Thread.current["name"] = "BHT"; system("bht_su"); Thread.exit} john
  • Was Yukihiro Matsumoto interested in Math?

    5
    0 Votes
    5 Posts
    1k Views
    T
    Thank you gentlemen: much appreciated, and I promise not to do math past my bedtime again. (Unless I forget!)
  • Program format

    11
    0 Votes
    11 Posts
    677 Views
    Dan RathbunD
    Keith.. updated the template example. Moved the definition of WIN and MAC constants up to the Object level. I had an inline comment, that said they'd be inherited by all nested namespaces. They would not have been. I've been working with mixin modules and subclasses lately, and got some braincells crossed. We've asked Google to define these when Sketchup starts but they have not, as yet.
  • Inputbox control with while loop

    6
    0 Votes
    6 Posts
    311 Views
    Dan RathbunD
    You must uncheck "Use default value" first ... ADD: OR.. you can hilight "[Default]" at the top of the list, and change the default to what you want most of your code to do with TAB characters. Then change the specific few languages that you want to be different (ie: Python, Javascript, Java, HTML and CSS, all use 4 space tabs, instead of 2. Likely all the C language family as well. C, C++ and C#.)
  • Subtract two angle

    8
    0 Votes
    8 Posts
    270 Views
    thomthomT
    What Every Programmer Should Know About Floating-Point Arithmetic A.K.A. "Why don’t my numbers add up?"
  • ACT / Film and Stage Extension Strings

    3
    0 Votes
    3 Posts
    185 Views
    Dan RathbunD
    Thanks John... seemed to paste OK into Notepad. I saved as UNIX EOLs, and "UTF-8 without BOM". Will try it tomarrow.
  • No pushpull when touching ????

    15
    0 Votes
    15 Posts
    185 Views
    TIGT
    I did put it in Ruby red to stress it was somehow 'special' without going into the added confusion of 'classes' - with an example to explain it too... OK it maybe ought to have a 'capital-letter', but we all say float not **F**loat quite a lot too without much of an issue ! But no dander is up [yet]...
  • Push Pull direction?

    20
    0 Votes
    20 Posts
    422 Views
    TIGT
    Sorry, I don't quite understand your point... The tool initializes, it runs self.draw_pulley(), which runs self.dialog() and tests for the validity of its ' return'. If the user cancels the dialog ' nil' is returned and it stops. If the user enters valid inputs it returns ' true' and the remaining steps are executed to completion. If the user enters invalid input it then re-runs self.draw_pulley() [], which in turn runs self.dialog() and tests for its validity in its ' return' etc etc in a loop until either the user cancels or enters valid input... [ after it re-calls the method it immediately returns ' nil' to the previously executing version of the method, so that one goes no further] Note how two sets of references are taken from the ' results', one to test their validity and if OK then another @ set to be used in the next methods and also remembered for the next time... I left it this way because that's what you originally showed... personally I feel that a simple UI.messagebox("Values outside limits !\nExiting.") return nil would do, but at least this way the user does get chances to try again with a valid input in a new dialog - if they want to give up they can just cancel the dialog at any time...
  • [Code] Scarpino's SphereTool Sample ver 2.1.0

    15
    0 Votes
    15 Posts
    4k Views
    Dan RathbunD
    @driven said: I'll make some nicer ones if you want, this was my first attempt at making icons in SU... john A note about toolbar icons. GIFs are not the best. (They are good for print ads, cartoons, etc.) But the edges look ragged. You should save as PNG, as the edges are anti-aliased. (smoothed via blending.)
  • [Code] Scarpino's SphereUtil Sample ver 1.1.0

    3
    0 Votes
    3 Posts
    1k Views
    Dan RathbunD
    Fixed a small booboo (see the docheader in file.) @John.. perhaps a good example tool, to make a path, might be a modified edition of the "Examples/linetool.rb"
  • .scene_transition_finished?

    5
    0 Votes
    5 Posts
    64 Views
    Dan RathbunD
    @unknownuser said: Thank you, this is exactly what I was looking for! It is really weird. I have checked all observers, but didn't remember this method hidden in SketchUp::Pages! Yup.. it is overlooked because is does not have a protoclass defined, nor it's own page in the API reference.
  • Ruby transformation issue?

    4
    0 Votes
    4 Posts
    93 Views
    TIGT
    So as I thought I had explained... make a transformation [tb] for 'base' and use it just on that entity group.entities.transform_entities(tb, **base**) THEN make and use another transformation [t] on the whole 'group'... Also note that your approximations of PI etc could be replaced by 60.degrees or other values in degrees, to give consistently accurate angles...
  • Yet another script Idea

    2
    0 Votes
    2 Posts
    284 Views
    C
    @remus said: this is mre a long term wish if anyone's ever feeling really kind My limited knowledge of ruby tells me it should be possible, but i reiterate the limited part. So, what would be really cool is to have a ruby that could cut standard sized countersunk holes for you. Much like the holes wizard in solidworks if anyones used that before. ideally, it would kinda go like this: 1)start ruby 2)click where you want the hole 3)select hole size and wether or not to countersink it thanks I know this is an old post, but a search for "countersink" brings up nothing newer, so I'll second this! I guess it may be a variation on "holes" scripts, but the specific functionality of this script's understanding standard hardware sizes, the correct bevel angles (they're not 45) and countersink depths, etc. would be tremendous for those of us sending models to metal fabricators! I'd modify the requested functionality -- since holes don't copy easily, I think that starting the script, selecting the fastener, then click, click, click... to "drill" countersunk holes. To ice the cake the script would understand correct pilot hole diameters as well as clear-hole diameters -- so you'd set the screw size (ie #10 or M6), then toggle for Clear/Pilot, check box for countersink, and off you'd go! And while I'm wishing, it could place the appropriate screw component (or not). If wishes were horses... -Carl-
  • Structure of my Ruby files

    9
    0 Votes
    9 Posts
    172 Views
    Dan RathbunD
    require 'sketchup.rb' This is cross-platform, not Windows only. It belongs at the top of the file. # pull in the standard API hooks. This NOT true. The API "hooks" are always loaded (if embedded Ruby is loaded,) by the Sketchup executable. (sketchup.exe) 'sketchup.rb' adds a few global methods like file_loaded() and file_loaded?(), and does not need to be required, unless you will use methods from that file, in the specific script, you are writing. You should read the "Tools/sketchup.rb' file to see what methods it has that you can use.
  • Interaction with objects for simulation

    16
    0 Votes
    16 Posts
    462 Views
    Dan RathbunD
    @nickinwv said: "Do I need SU Pro to use dynamic components?" Not to use. You can can insert them (from say the 3D Warehouse, or the samples installed with Sketchup.) You can copy them, scale them, move them, etc. You can change their options. You can interact with them, via the Click Interact tool. (You'd need to turn on the DC toolbar.) Pro is only required if you wish to create or edit DCs via the app's GUI. Setting their options is somewhat involved (and there's a whole separate forum here for discussing DCs.) Advice... Learn Standard Ruby first. (The Sketchup API is just 3 modules, with encapsulated classes, that extends Ruby.) Then start with simple plugins and macros first. (Learn to crawl, before you try to walk, and before attempting to run.) Study what others have done first. (Stand on the shoulders of giants. Pay attention to the work of the most prolific coders in the Code Snippets index, and the Plugins Index (Plugins Forum).) Animation is an advanced catagory. Make sure you visit the Code Snippets index. (Jim Foltz posted an animation example I believe.)
  • How to install a Ruby Gem for use in SketchUp

    27
    0 Votes
    27 Posts
    9k Views
    Dan RathbunD
    Good job Derek ! 1) Now can you d/l and install gems from within Sketchup embedded Ruby ?? 2) You are running OSX Lion, so I assume your machine is Intel based. I wonder why you need to add platform dir paths for a PowerPC (MacOS9) platform ?? 3) The following dir paths should not have files in them, only subdirs. Why add them ?? " /Library/Ruby/Site" " /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby" 4) You also add the current working directory, ie: " ." (which can change from time to time, via calls to Dir.chdir in other author's plugins.) So, is this necessary for RubyGems ?? 5) After require('rubygems') returns (sucessfully,) has it added any paths to the $LOAD_PATH array ??
  • Undocumented Geom::Transformation methods?

    2
    0 Votes
    2 Posts
    88 Views
    Dan RathbunD
    They are added by the DC extension.
  • SketchUp developer IRC channel - #sketchup-dev

    6
    0 Votes
    6 Posts
    399 Views
    RichMorinR
    I was out of town for a couple of weeks, so the channel went away, but I've restarted it.
  • Auto-running a Mac '.command' File from Sketchup?

    15
    0 Votes
    15 Posts
    3k Views
    Dan RathbunD
    Well I am NOT an expert on threads. Doc: http://www.ruby-doc.org/core-1.8.6/Thread.html What we DO know is that they were CRAP on PC with Ruby v1.8.0 They are better, in v1.8.6-p287, likely even better in v1.8.7 branch. But they are still Green threads, not native threads (at least on PC.) I'm not sure if Apple tweeked the Ruby editions they install on Macs, and what 'kind' of threads you get, on Apple platforms. If you want your "thing" to work on older SU versions, the API's thread-like UI.start_timer() block method may be a better choice. Otherwise... if the rdocs are too techno.. check out all the books on Ruby. Maybe tutorials on the web. We've avoided them on PC because they were too problematic (... likely because PC Sketchup was running Ruby v1.8.0 for so many versions.) I never (on my machine,) ran Sketchup with the obsolete initial release of v1.8.0; always something >= v1.8.6-p111 ~ If YOU get comfy with Threads on Mac (under Sketchup,) a tutorial may help others out.
  • [Code] orient_faces.rb v1.2

    9
    0 Votes
    9 Posts
    4k Views
    Dan RathbunD
    @dan rathbun said: This code extends API base class **Sketchup::Face** ... There should be warning, in the OP, and probably the file header doc. @dan rathbun said: without checking to see if the methods exist first, I knew you'd fix it promptly. @dan rathbun said: despite that fact that TIG always tells others not to do this. Couldn't resist teasing. (I DID notice it was 4 years old.) I still believe that adding methods like this, belong in a community project, like SKX. (I still have hopes of reviving that project, or starting a similar one.) @dan rathbun said: This script is going my API doghouse list. I really do not have a "script dog house" list. (Have thought of doing one though.)

Advertisement