⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
  • Help with creating an API

    10
    0 Szavazatok
    10 Hozzászólások
    2k Megtekintések
    fredo6F
    Todd, Sorry for misunderstanding. I was just saying that, while you can or should use exceptions in your own code, you should try to provide 'error-free' API to external programmers, by trapping all problems and documenting the rules and error conventions of your interface. In your example Challenge #2, I just notice that this is what you do, since any call to your GetData() method, will never raise an exception! Fredo PS: I have two small remarks about your code sample, for the Integer?() method: Not a good habit to extend Ruby built-in class. Just imagine I do the same (knowing that the name "integer?" is quite natural) and override your code by mine. Better have a neutral method like Fredo6.Integer?(), so that at least you and me control ownership. I would rather use the following code to transform a string into an integer: def string_to_integer(s) (s && s.strip =~ /\A(\+|\-|\s*)(\s*)(\d*)\Z/) ? ($1.strip + $3).to_i ; nil end This returns the integer number if the string is valid, otherwise nil A more powerful variant allows the user entering mathematical expressions that would normally evaluate to an integer def string_to_integer2(s) return nil if s == nil || s =~ /[^\s\+\-\*\/\%(\)\d]/ begin eval "(#{s}) + 0" rescue Exception => detail nil end end For instance, string_to_integer2("(2 + 3) * 4") will return 20. The only issue with eval() is with security, as eval() could be used to delete files on your disk and other nasty things by accident. Hence, the first line to check that you only have digits with operation signs and parentheses. Fredo
  • Section Cut Face problems!

    6
    0 Szavazatok
    6 Hozzászólások
    2k Megtekintések
    TIGT
    @chris fullmer said: I'm going to guess its a problem on the EIS scripter's side. But maybe not. I don't know who made that one. Maybe if they are a forum regular they can sit and chat with TIG (did the section cut face, right?). Anyhow, glad its working now! Chris There are a couple of plugins that I know of - both by 'proper developers' - that rewrite certain built-in methods [they don't need to !], which then causes unexpected clashes with other scripts. One I know of is 'Demeter' - this is similar to 'EIS' so perhaps they've got some common 'bad' coding in them... .
  • Script check-->materials

    4
    0 Szavazatok
    4 Hozzászólások
    556 Megtekintések
    P
    works, thank you very much
  • Exchanging color to texture?

    18
    0 Szavazatok
    18 Hozzászólások
    2k Megtekintések
    tbdT
    @unknownuser said: How would the RGB way look? a lot more complicated ... you can try to save as png, find the offset inside the file where color is store, pack("m") @unknownuser said: What if the image was bigger say 64x64 pixels? donno. i used 1x1 pixel to keep the file to minimum make a hash of the file that you create via the script to see if it is written properly
  • Clearance plugin?

    9
    0 Szavazatok
    9 Hozzászólások
    1k Megtekintések
    AdamBA
    @unknownuser said: Adam, can you show me a picture of what you mean for the first case? Todd, 2 objects next to each other: [image: bXJr_SketchUpScreenSnapz005.png] Whats the smallest clearance? ie You can't do this by examining vertices. Typically you'd use GJK to crawl around the surface. But I seem to remember GJK is just for convex hulls - one of the many many reasons physics packages only deal with collections of convex hulls. (its an interesting subject - imagine a tumbling object through space with a protruding part and the incredibly complex path the tip of that protrusion traces.) Adam EDIT: I realized I claimed earlier that convex shapes would be simple.. I meant that with simple interval arithmetic you can find a separating plane etc. Nothing is ever simple..the devil is always in the details!
  • PLUG IN COPY ALONG PATH

    5
    0 Szavazatok
    5 Hozzászólások
    3k Megtekintések
    ToboboT
    Thanks Dave I was having some trouble with a component you made it all clear
  • Point_in_polygon_2d doesnt work

    2
    0 Szavazatok
    2 Hozzászólások
    334 Megtekintések
    Didier BurD
    Hi, The error message cannot be the one you're showing: ans=Geom.Point_in_polygon_2d point,points Point_in_polygon_2d is not the name of a method and "point_to_polygon_2D" is in the error message. "in" instead of "to", upcase...
  • Clear the ruby console window mem how to

    5
    0 Szavazatok
    5 Hozzászólások
    1k Megtekintések
    R
    Also, webDialog callback actions don't get changed if you have persistent instances that call the dialog.
  • Programming cartoon

    2
    0 Szavazatok
    2 Hozzászólások
    430 Megtekintések
    Didier BurD
    Yeah Was it like this today for you ?
  • Can we got SketchUp API Docs in offline ?

    7
    0 Szavazatok
    7 Hozzászólások
    593 Megtekintések
    R
    I know this does not answer the question about downloading the API, but it does address david's comment about updates. The Groups Documentation is updated by Todd and myself as we get time and feedback. AFAIK, it is now more accurate than the standard online API documents accessed via the Sketchup Help>Ruby Help link.
  • Target camera for sketchup for animation

    2
    0 Szavazatok
    2 Hozzászólások
    581 Megtekintések
    M
    Hi, I think what you after is already available. Its called Flightpath2. You have to pay (a small price) for it. Visit: http://www.smustard.com/script/FlightPath2 Regards Mr S
  • Ruby Challenge!

    26
    0 Szavazatok
    26 Hozzászólások
    3k Megtekintések
    romboutR
    yeah i already knew that one. But thanx anyway, did you already found different solution
  • Keycodes intelmac

    3
    0 Szavazatok
    3 Hozzászólások
    532 Megtekintések
    romboutR
    Thanx Jim... i had some other solutions but they give me different codes back. By know i found that thecodes are the same as on the powerpc-darwin OS. I think ineed to work on this part"elsif RUBY_PLATFORM == "powerpc-darwin" then" I think on my imac it passes this on cause i have intel duo core... So if you happen to know the code for this part
  • Add entity to a group

    10
    0 Szavazatok
    10 Hozzászólások
    743 Megtekintések
    J
    This is the documentation page I use - it's the most up-to-date: http://groups.google.com/group/SketchUp-Plugins-Dev/web/Ruby-classes.html Todd and Rick get all the credit for updating the docs - it's a thankless chore, no doubt. I wish there was a way to see what changes have been made to the documentation. I've asked that document updates be logged for us, but maybe I'm asking too much.
  • Shortcuts and keys in rubys collide

    9
    0 Szavazatok
    9 Hozzászólások
    671 Megtekintések
    R
    You could capture keystrokes in a modal webDialog - this will override any SU keyboard shortcuts - but beware irritating users who are used to using a shortcut for "select" that effectively cancels any active tool. Either query the shortcut list for the "select" shortcut and use it to cancel your modal webDialog, or create a really obvious "cancel" button or key.
  • Render dimensions

    4
    0 Szavazatok
    4 Hozzászólások
    503 Megtekintések
    M
    Dave, Thanks for the tip, I will try it! I would have never thought solution like this.
  • Developing a specific if statement ?

    2
    0 Szavazatok
    2 Hozzászólások
    249 Megtekintések
    tbdT
    x,y,z = $Vec1.to_a if (-y && x>0) ... do your code end also try not to use global variables (see this discussion)
  • Sketchup web exporter.

    2
    0 Szavazatok
    2 Hozzászólások
    391 Megtekintések
    P
    I'd welcome this as well. I've developed my own manual work-around to essentially create my own images and substitute them for the ones created by the Sketchup web-exporter. Once you generate one web export say for 36 images you can re-use the html code multiple times and simply replace the images with those that you create on your own. see my post here: http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=10855
  • How do Install SketchUp Ruby API ?

    3
    0 Szavazatok
    3 Hozzászólások
    424 Megtekintések
    H
    Thanks you for your suggestion moris , now I have found the right way
  • Simple Glazing Frame & Exterior Trim tool

    3
    0 Szavazatok
    3 Hozzászólások
    839 Megtekintések
    T
    @jim said: Here's one test.. > if( ($etthick != 0) and ($etwidth != 0) ) > # Both are not zero > # Your code here > end > Thanks: Jim for jumping to the rescue! I will re post this Ruby with your added code, since some members may not know how to cut and paste code snippets into Ruby files. WindowGlassFrame.rb

Advertisement