⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
  • Capturing $sterr output

    10
    0 評價
    10 貼文
    525 瀏覽
    danielbowringD
    @unknownuser said: In pas trials, I noticed that the SU error message (whether for syntax at load time or at run-time) are not handled by the console Ruby object, but send directly to the console at C level. @jim said: I can't get this to work now. I know it used to work, and had used it daily. Maybe the latest version of SketchUp changed somehow? @unknownuser said: It would nice if we could redirect all messages toward a known output stream. ... Maybe we should ask the SU team I'd assume then that we are unable to capture it, as irritating as that is. Thanks all
  • ComponentInstance name and Group name

    21
    0 評價
    21 貼文
    1k 瀏覽
    N
    Hi everyone ! I have found how to correct my code !! It's was just an error of algorithm. At first time I had this condition : chose.name[0] != 95 And I would like to have this : chose.name[0] != 95 || chose.definition.name[0] != 95 but it doesn't work ... The solution is : chose.name[0] != 95 && chose.definition.name[0] != 95 As I said, I'm beginning ! Thanks to all! especially TIG
  • Update a WebDialog

    8
    0 評價
    8 貼文
    638 瀏覽
    D
    Your first problem is very easy to solve, just make sure that your ruby script executes asynchronously. I use this function in a couple of my scripts instead of the outer-most loop: def asyncLoop(range, &proc) from = range.min to = range.max iteration = lambda do |index| last = (index > to) proc.call(index, last) if !last then UI.start_timer(0.02, false) { iteration.call(index.succ) } end end iteration.call(from) return nil end You can use it like this: asyncLoop(0...16) do |i, last| if (!last) then # Perform ith iteration else # Put code to be run after this operation here instead of outside the loop end # Code here will run immediately, so leave it empty
  • [QUESTION] Reading Text From TXT

    4
    0 評價
    4 貼文
    181 瀏覽
    J
    I'd just write: text = IO.read("path/to/file.txt")
  • UI.savepanel question

    9
    0 評價
    9 貼文
    464 瀏覽
    Dan RathbunD
    FYI .. file_new() will close the active model only on Windows (because it's not an MDI interface.) On Mac.. another document window is opened, and becomes active, but the old one with the old model is still open. This post belongs in the Ruby forum.
  • Absurd camera behaviour

    9
    0 評價
    9 貼文
    307 瀏覽
    Dan RathbunD
    Ok I played around a bit in the console.. and I agree with you. This is another example of poorly wrapped C++ objects that can cause Rubyist's nightmare. Each time we call Sketchup.active_model.active_view.camera we get a new Ruby object. Ex: Sketchup.active_model.active_view.camera == Sketchup.active_model.active_view.camera %(#008000)[>> false]
  • Rendering_options pause start_timer?

    4
    0 評價
    4 貼文
    245 瀏覽
    A
    Thanks for the replies and for the correction about @id. I changed both, but it doesn't solve the problem. It seems the timer starts correctly and counts until the end, only the action (code block) isn't executed until the user hovers empty space or give focus to other UI elements. @unknownuser said: I wouldn't set @model.rendering_options['ForegroundColor'] in the draw event. I agree (I didn't think about that), although I didn't notice it in Edit → Undo... I now chose to get along without text color.
  • Extend view.write_image?

    4
    0 評價
    4 貼文
    183 瀏覽
    Dan RathbunD
    @unknownuser said: (referring to Windows ALT+PrintScreen manual workaround.) ..., but I needed some to write a code to save and image from my plugin. You may on Windows only, use Win32OLE.so and the SendKeys() function.
  • Scale model converter.

    2
    0 評價
    2 貼文
    328 瀏覽
    TIGT
    You haven't really explained why you are doing this. Is it something like you model an aircraft full size and then want to have a dimensioned 1/12 scale model? If so then do this... Make sure you are in the model entities context [i.e. not editing a group etc] Draw a line 12" long [assuming you are using inches]. Use the Tapemeasure tool and click the two ends of the line. The VCB should show 12". Immediately type 1" + <enter>. You are asked if you want to scale the model. Answer 'Yes'. The line and the rest of the model are now 1/12 the size they were... Erase the unneeded line. To make other scalings from a full sized version simply draw the line an appropriate length, so for 1/48 use a 48" line scaling down to 1"... A tool listing all the possible scales will take as long to use as this simple method and of course it's probably not have the scale you wanted in the list anyway! To reverse the scaling... let's assume 1/12... draw a line 1" long, Tapemeasure pick its end and type 12" etc, and everything is scaled back to full-size again...
  • Should we cache the API docs?

    8
    0 評價
    8 貼文
    249 瀏覽
    thomthomT
    @unknownuser said: Hey guys, I really don't expect anything weird to happen with the docs. Google is obligated (and happy) to host our current web resources until such time as we have a replacement ready. (One with rejuvenated user comments. ) Good to hear! (Great new logo in your profile! )
  • File.dirname(__FILE__) returns nil?

    5
    0 評價
    5 貼文
    939 瀏覽
    W
    Weird, now the user says the problem is not occurring anymore without any explanation. Lovely! Sorry for wasting your time Dan,TiG. Thanks for the help!
  • Context Menu Question

    3
    0 評價
    3 貼文
    118 瀏覽
    K
    Thanks Dan that worked and was just what I needed. Keith
  • Looking for a report

    5
    0 評價
    5 貼文
    217 瀏覽
    genma saotomeG
    @dan rathbun said: Seems like you are trying to do things the hard way. Nope. I'm doing things "The Game Way". EXPORT the fewest polys, fewest textures, no textures on backfaces, no polys w/o textures. As minimal as possible... applying a texture to a component puts that texture on the backface -- I can't allow that. The code I showed, above, was what I use to identify and color untextured polys bright red (written by someone else). If they're big enough, I'll see them and either delete the poly or texture it correctly. 99 out of 100 times, I delete the poly. I need either a report OR a modification of the code I posted, whichever will get me a display/listing of all component/texture assignments. With the information in hand I can go right to the specific component definition and find the problem. W/O it's an ordeal.
  • Newbie question - execute jar file in ruby

    16
    0 評價
    16 貼文
    3k 瀏覽
    Dan RathbunD
    Hmmm... OK. Yes, actually it's Ruby 1.8.x itself that uses "green threads" instead of native threads. You might have more luck using a OLE interface to the java. See: [Plugin Library] Win32API and Win32OLE so files and: WIN32OLE rdoc
  • Load_from_url

    22
    0 評價
    22 貼文
    1k 瀏覽
    Dan RathbunD
    @tig said: There are new API methods with the latest v8M2 to extract files/subfolders [into Plugins] from zip/rbz files. However, if you already have ways of extracting them, then the moving to their new locations can be done with vanilla Ruby Dir and File commands... Or the extended library FileUtils FYI.. there is a Pure Ruby (beta) edition of the Zlib library that is cross-platfrom (no need to deal with compiled so/dll, Ruby version, compiler versions, etc. etc.) It is by Park Heesob (who is involved with Daniel Berger's win32-api project.)
  • 3d points of coplanar polygons - SketchUp Ruby API

    6
    0 評價
    6 貼文
    968 瀏覽
    V
    @sdmitch said: vhiguita, Are you still working on this problem or do you have a solution? I was interested in your problem and thought I would give it a try. Using the data from you post, I created a "html" file and created a plugin to read it and place the data. My html file contains the faces, lines and points but the lines and points are really the only data you need. I assummed the units were feet. It would help if I had an actual file to work with so post one if possible. Hi, I found the solution, there are many ways to get this, for example with PHP you could load all the html to a string, you could apply regular expressions to get the values (<div>,<span>, etc) from the tags review curl library.
  • Writing custom aditional data in .skp

    5
    0 評價
    5 貼文
    214 瀏覽
    AdamBA
    Just keep in mind that if you start attaching data to every Entity, you'll have massive file bloat.
  • Ruby Module Variables

    10
    0 評價
    10 貼文
    2k 瀏覽
    A
    @dan rathbun said: All of your modules and/or classes need to be within your "author" namespace. If you need one copy of some code, make it a module. If you need multiple copies of some code, make it a class, and use multiple instances of the code. Ok, good advice, thaks . Now I'm on my way to 'Keep on typing' the code.
  • Need some help with write_image

    7
    0 評價
    7 貼文
    413 瀏覽
    jeff hammondJ
    @tig said: I think you'll need to at least make a temporary file and use some as/terminal/shell stuff ... osascript -e "tell app \"Finder\" to set the clipboard to (POSIX file \"~Documents/mytemp.png\")" perhaps i think something like that could work.. i found a way to do it with straight applescript (still using a temp file location) which eliminates using Finder.. set the clipboard to (read ("path/to/the/image.png") as «class PNGf»)
  • View.draw_text invisible?

    6
    0 評價
    6 貼文
    579 瀏覽
    thomthomT
    @aerilius said: (I hope the API comments will be back at the site at some time.) Yea - I'd made notes about the draw_points bug in the old comments...

Advertisement