⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
  • [CExt] C array to Ruby Array?

    4
    0 Votes
    4 Posts
    261 Views
    AdamBA
    Generally No, because the underlying representations are different. (eg Integer in Ruby is actually an integer times 4) Doubles are the exception as the representation in C and Ruby are the same IEEE format. So the values can simply be copied. However the container is another matter; in C, arrays are little more than syntactic sugar, in Ruby an Array is a real live object, so you're kinda out luck. The best you could do would be something like: extern double *reals extern int rcount; static VALUE method_getRealArray(VALUE rarray) { if (rcount < RARRAY_LEN(rarray)) { memcpy(RARRAY_PTR(rarray), reals, sizeof(double)* rcount); return Qtrue; } else { return Qfalse; } }
  • Textarea line separators on Mac

    7
    0 Votes
    7 Posts
    382 Views
    M
    @unknownuser said: I personally see no productivity or functionality gains from bothering with each platforms newline patterns, unless you just want to. This isn't the file I want given the input textarea: [image: GfrM_two.jpg] You have to convert crlf to newline because Ruby converts newline to crlf as it writes the file on a PC. Ugh. # ta_sep.rb require 'sketchup' html=" <html> <body> <textarea id='ta'>one two</textarea> <script> onload = function() { location = 'skp;go'; } </script> </body> </html>" wd = UI;;WebDialog.new( "Test", true, "test", 400, 300, 100, 100, true ) wd.set_html( html ) wd.add_action_callback( "go" ) do | dlg, msg | val = wd.get_element_value( 'ta' ) # val.gsub!( /\r\n/, "\n" ) pn = UI.savepanel( "Save As ...", File.dirname(__FILE__), 't.txt' ) file = File.new( pn, 'w' ) file.puts( val ) file.close() end wd.show() I think this is correct cross-platform code if you uncomment the gsub!(). For this I be thanking you and Notepad++ (View/Show Symbol/Show All Characters). Ruby's lovely ability to handle everything with newlines, platform-independently, does not extend to text read from a browser's textarea widgets.
  • Lock a layer

    6
    0 Votes
    6 Posts
    12k Views
    Bob JamesB
  • Python/Ruby vs. Ruby/Python

    5
    0 Votes
    5 Posts
    320 Views
    M
    Don't think I want to dust off Decaf until I've got time to go after it. I forget where I put my mains in Java. There's tons of my Java on my site: http://www.MartinRinehart.com , including the original Decaf tokenizer. There's a whole new vocabulary (words, not tokens; phrases, not expressions; sentences, not statements; etc.) that I'll need to document before anyone could realize that I wasn't just babbling. See "The Project", my site, for more.
  • Animation along a path

    17
    0 Votes
    17 Posts
    1k Views
    chrisglasierC
    Here is a first step solution I have come up with: [image: VJb0_Path01.png] [image: KJmX_Path002.png] It does not use a curve because I want to give the animator something to identify intermediate stops - clicking on the last leg required. The lines are 'loose' but can be regenerated from the vertices stored in the name's record. I can also make the start finish points for the animation from them in Javascript. They should also be useful to avoid clashes. I understand vertex sorting better now and intend to implement that after I can get some actual animation going Anyway it is a start that I can understand - thanks to TIG.
  • Programming in C, C++ for Mac and Windows?

    51
    0 Votes
    51 Posts
    9k Views
    thomthomT
    Just wanted to make sure - some times something appear to work - but later turns out to be very wrong.
  • [ruby doc] Model - undocumented methods

    8
    0 Votes
    8 Posts
    3k Views
    J
    @unknownuser said: It's so cute and quirky, we've decided to keep it. (I agree with you that it's attached to the wrong object, BTW. But once a method's in the wild it's really, really hard to change it.) Cheers, Well this is going to sound condescending no matter how i put it so i'll dispense with any niceties and just be blunt, hope you all can handle it...? It seems the API was written by people who have no experience using it. This is what happens when you get a bunch of low level C hackers who hardly use high-level scripting languages to spec out an API. I think it would behoove the dev team to gather input from the soldiers in the trenches instead of just barking orders from the White House. Dan (along with Jim and others) has documented time and again the atrocities of the API and i have noticed many more. The fact is that we need to look towards a major release where all these blasphemies can be rectified into a beautiful API we can all love. Look i know mistakes are unavoidable and i am in no way saying i am better than anyone here. So lets put our collective heads together and make this API all it can be! Are you with me?
  • Ruby extension module using C/C++

    17
    0 Votes
    17 Posts
    4k Views
    Dan RathbunD
    @thomthom said: 404 - files not found. Well.. sorry. I suppose I might have copied them in there manually to try and get SU to use those versions. It seems I remember a previous post awhile back about SU using old msvcrt versions. Anyway, the point of the post was where are the DLLs. They are usually put by the application installer into the Windows/System32 folder and registered using regsvr32.exe, but normally the installer is not supposed to overwrite newer versions with older versions. If an application must use and older version, it can keep a local copy in it's program folder and specifically load the local copy. (Which may be how I ended up with copies in the SU folder, I was trying to see SU would use those instead of the ones in my Windows/System32 folder. I have a problem with the MCVCRT and I cannot update several applications, including MS Visual Studio and .NET; something has gotten 'out of whack' on my machine.)
  • OpenSUP - open source sketchup related old project

    6
    0 Votes
    6 Posts
    663 Views
    tbdT
    that's the one I took as well - free and fast compiler (PellesC) and easier to debug (using OllyDbg)
  • SDK, optimization, and cross platform support

    7
    0 Votes
    7 Posts
    1k Views
    thomthomT
    cheers!
  • Is there a &quot;Save Selection&quot; ruby script out there

    3
    0 Votes
    3 Posts
    204 Views
    DavidBoulderD
    Thanks that looks nice. I thought about that at first. I can make a component out of the selection and save out to a file or just keep the component on a layer in the current file. It doesn't quite work for what I want here, because I want these views to be something the user can edit while they are in. Not necessary change geometry, but we have a lot of attributes, and while they are in their search view want them to be able to select an item to change its name, material, etc. If I have them working in a copy it would be problem to get it back into the model, in particular since the selection isn't just object in a single group, but pieces from all over the model hierarchy.
  • Rendering_options['ForegroundColor'] controls view.draw_text

    12
    0 Votes
    12 Posts
    796 Views
    fredo6F
    Sketchup.active_model.rendering_options['ForegroundColor'] = color works fine for draw_text method. However there is a very weird side effect, probably because the change of rendering is done within the draw method of a Tool. This effect is that the SU main window seems to loose the focus, so that any call to UI.messagebox or UI.inputbox is blocked and does not show the dialog box (you have to press Alt to unlock this situation). I did not find a way to circumvent this side effect. Fredo
  • Tool &lt;&gt; WebDialog &lt;&gt; Observers relationship

    23
    0 Votes
    23 Posts
    1k Views
    T
    @thomthom said: You're missing a puts. @thomthom said: > def onCancel(reason,view) > @web_dialog.close > end > Do you need to close the webdialog here? It does not stop the Tool. It is just a single stage tool. If an user presses escape I want to close the webdialog and deactivate.the_tool. Invoking @dlg.set_on_close {Sketchup.active_model.active_view.remove_observer ProperTool::get_view_observer; **Sketchup.active_model.select_tool(nil)**} will close the tool... and will trigger @web_dialog.close again. That is why it fires up twice.
  • WebDialog.set_html() Gotchas

    9
    0 Votes
    9 Posts
    1k Views
    M
    "Any customer can have a car painted any color that he wants so long as it is black." H. Ford There is no doubt that JavaScript is the best language for code running in the browser. Ruby is absolutely the best choice for SketchUp plugins. For similar reasons we've chosen HTML and CSS. However, if you know a man whose pet Python is named Monty, you may infer something about his personal language choice. (Monty just reminded me that van Rossum works for Google. There's hope.)
  • IE9 looking good

    24
    0 Votes
    24 Posts
    2k Views
    M
    @hfm said: Well yeah, I/we have been ranting about updating IE. But it feels more like the're changing it with every number. If you are a very big, very rich software company you can have team A working on version N, while team B works on version N+1. As a guess, the IE8 team is now on IE10.
  • Set camera, and move shape by end point

    7
    0 Votes
    7 Posts
    359 Views
    M
    @lib said: Martin I will have a look at the API you offer , I think it is going to help me in my project. Do keep us posted!
  • Open Komodo

    2
    0 Votes
    2 Posts
    446 Views
    R
    I thought the post was Open Kimono. Boy was I disappointed.
  • Units Strings i18n

    8
    0 Votes
    8 Posts
    1k Views
    TIGT
    OK, you [almost] got me... Webster's US spelling ideas were to base America's English spellings on the original roots - which he took usually to be Latin - as in ***center/centrum, color/em, labor/em, honor/em etc, instead of centre, colour, labour, honour etc used in Johnson's 'English' English taken via the French... [***actually even 'kentrus' is also a Greek word for a 'spur-point', but became the more usual meaning 'center' when in Latin] So, although some words did originate in Greek, they had long been borrowed into Latin - like Greek's metron/metros which became Latin's meteri/metiri/metrum [both concerning 'measure']... Words like 'metrology' do come from two Greek roots - 'measure' and study' - metron-logos... The word 'meter' for a measuring device is [probably] from the Greek root too... English is also proficient at wrongly combining Greek and Latin roots into single words - e.g. 'Television' [Tele=Far (Greek) + Visio=Sight (Latin)] - which might have been more logical as something like Teletheamation or Videoeminus ??? The French Commission in charge of sorting out their newfangled 'metric' system chose the word 'metre' as the length-unit's name - most say from the Greek root 'metron'>'a measure' - and it is often prefixed with Greek 'number-roots' like deca, kilo, giga, micro, nano etc, but also several Latin rooted ones like deci, centi, milli, micro [Gr&L!] etc, to confuse things completely. Latin's 'metrum' ain't that different anyway and the French did make Latin's 'center/centrum'>'centre' so why not with 'metre'? So I still believe that Webster's spelling of 'meter' for a unit of length was taken from the Latin root 'meter(i)' as it was his preferred root source - albeit perhaps mistakenly, if the French had indeed taken it from Greek as 'metre' ! To quote Webster's Dictionary directly on this: 'Meter' = Old English mēter, from Latin metrum, from Greek metron = measure, meter; Anglo-French metre, from Latin metrum... What's in a name ? ... I used the word 'invent' in invisible 'quotes' - they did 'make' the 'metric' system - by definition it is based on their newfangled 'metres' !
  • SU 6.0 latest version?

    9
    0 Votes
    9 Posts
    387 Views
    thomthomT
    Or did you actually want the new SU 7 version? And you're surprised you had to pay to upgrade?
  • Win32ole.so procedure/load issue

    13
    0 Votes
    13 Posts
    5k Views
    M
    @thomthom said: @cjthompson said: Sketchup only uses 1.8. 1.8.0 to be exact. Thanks very much - that would certainly make sense!

Advertisement