ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • 'require' problem with RBS

    13
    0 Votes
    13 Posts
    794 Views
    JuantxoJ
    @dan rathbun said: So... what happens if you wrap the very long string inside =begin =end The same, .rbs fails. Thank you Dan for your advice. Really I don't look for a solution. I only want to advert others about this. It's difficult to debug this error. Yesterday I scrambled the code but it didn't work. It was difficult to find out why. After a long time I discovered that by mistake I put a comment too long in same line and that was the reason.
  • Sketchup version numbers (M1 and M2)

    9
    0 Votes
    9 Posts
    501 Views
    Dan RathbunD
    @unknownuser said: @Dan: thanks for the info. 11752 builds is not bad for a single version 8.0 (~33 years at 1 build per day!) WHAT !! ... where do you get 33 years from ?? The 8.0 development cycle from start to 8.0.M2 release is no more than 701 DAYS ! ... and there are at least 24 more language builds above 11752, so make it 11776 total ... That's at least 16 (almost 17 builds per day.) Subtract 100 Sundays. And it's more like 11776 / 601 = at least 19 builds per day, if they worked 6 days a week.
  • Draw infinite lines?

    18
    0 Votes
    18 Posts
    740 Views
    thomthomT
    @tig said: Isn't it pointless to worry about this infinity-ness, provided that they 'appear' infinitely long ? Yes, that is what I try to do. Draw a line that appear to be infinite - that i ends in the SU horizon. Like the protractor tool does when you rotate. Or like an Guide Line does. I was thinking that if you could calculate where the projection meet, you could then use that as a measurement of how long the line should be, provided you could work out what the screen point represented in world coordinates.
  • Stop processing rest of file?

    14
    0 Votes
    14 Posts
    467 Views
    Dan RathbunD
    @thomthom said: @dan rathbun said: Hmm ... I see rescue modifiers do not work with require(), for some reason ? What you mean? What modifiers? The conditional keywords if and unless can be used in block position: [ if| unless] ( expression) statements end or modifier position: statement [ if| unless] ( expression) **rescue** can also be used in modifier poistion, but ... my attempt at this: require('booboo.rb') rescue nil ... does NOT trap the LoadError (because LoadError < ScriptError < Exception, and rescue only traps RuntimeError and subclasses by default.) For a one-liner, we must use semi-colons: begin require('booboo.rb'); rescue Exception; nil; end
  • Sketchup::Text Font

    2
    0 Votes
    2 Posts
    946 Views
    thomthomT
    @anton_s said: Is there a way to change sketchup::text font and size through some code? Not per entity - it is a model setting. From the UI you change it from Model Info > Text Not sure if it is exposed via the API...
  • 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
    314 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
    271 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
    195 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
    429 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
    66 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
    96 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
    285 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.)

Advertisement