🏢 PlaceMaker | 25% off for February including new Google Earth data imports! Learn more
  • Use PickHelper to find nested Instances?

    16
    0 Votes
    16 Posts
    994 Views
    thomthomT
    So, you have a reference to a ComponentInstance_ And you want to sniff it out using the pickhelper? Maybe just some typo bug in your code?
  • Download Sketchup API in PDF ???

    5
    0 Votes
    5 Posts
    399 Views
    C
    will this work? http://www.alexschreyer.net/cad/sketchup-ruby-api-cheatsheet/
  • Importing Camera CAHV format - up and direction vectors?

    2
    0 Votes
    2 Posts
    429 Views
    J
    Chris, Have a look at the film and stage plugin - if I remember, there is some code in it which might be useful.
  • Hiding edges with fill_from_mesh

    13
    0 Votes
    13 Posts
    448 Views
    thomthomT
    That would either be using Entities.add_faces_from_mesh for each mesh - if its ok to merge them in the Entities collection. Otherwise you need to iterate one mesh and add all the polygons to the other.
  • Vector3d.linear_combination alternative form

    3
    0 Votes
    3 Posts
    152 Views
    C
    It looks like it's like it's the same as the four argument version, but works with 3 vectors at once, instead of just 2.
  • Alternate API, Pioneers Wanted

    28
    0 Votes
    28 Posts
    2k Views
    Dan RathbunD
    @jessejames said: I find the need to grab a group/comp by it's "bbox.center", "bbox.center_bottom", and "bbox.center_top" so important that i wrote a nice function to encapsulate all the calls required to retrieve these points. So maybe you would like to add this, maybe not. Let me know. It would be so nice to call obj.bounds.center('center'), obj.bounds.center('top'), or obj.bounds.center('bottom'), but that will have to wait. There is a plugin for this (that needs some language cleanup,) written by Sahi. It's called AxizComp.rb (Axis Components), see this thread (ther's some code snippets for other languages later in the thread.) http://forums.sketchucation.com/viewtopic.php?f=323&t=21635&hilit=axis#p181881 EDIT: With the release of SketchUp 2020, grips on object bounding boxes are now native ! https://help.sketchup.com/en/current-release-notes
  • Yet Another WebDialog Gotcha

    2
    0 Votes
    2 Posts
    159 Views
    J
    @martinrinehart said: Yet Another WebDialog Gotcha Seems to be annogolous with... @unknownuser said: Yet another Microsoft Windows Bug ...yes web dialogs are quite the cruel irony of SketchUp i would say. We sure could use a good ol built-in GUI about now.
  • [CExt] malloc vs ALLOC

    6
    0 Votes
    6 Posts
    358 Views
    thomthomT
    ALLOCA_N @unknownuser said: Allocates memory for n objects of c-type on the stack---this memory will be automatically freed when the function that invokes ALLOCA_N returns. Does that mean one does not need free the memory allocated by this variant? Are there times one can not rely on it?
  • Open URL on local disk

    20
    0 Votes
    20 Posts
    7k Views
    Dan RathbunD
    @martinrinehart said: I've set single click to open. An HTM opens in Chrome. Hey Martin, what's the fullpath to the Chrome executable on your PC ??
  • Untrapped Error

    5
    0 Votes
    5 Posts
    187 Views
    Dan RathbunD
    @martinrinehart said: > 64 rescue => e > 65 rslt += e.to_s().chomp() > 66 end > Your local reference e receives a pointer to an Exception object from the rescue clause, not a String object. You should use the instance method Exception.message to get the exception's string, like this: 65 rslt << e.message.chomp() (As a side-note on Optimization, generally speaking, + and += String concatenation, require Ruby to create at least one extra String object than String append <<. Ruby internally converts a+=b to a=a+b, OR a+='literal' to a=a+'literal', so using += doesn't gain you anything over <<, and may be twice as slow or more, in a loop.)
  • [CExt] C array to Ruby Array?

    4
    0 Votes
    4 Posts
    202 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
    300 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
    262 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
    772 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
    8k 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
    2k 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
    617 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!

Advertisement