🏢 PlaceMaker | 25% off for February including new Google Earth data imports! Learn more
  • HELP setting up a SU code editor

    97
    0 Votes
    97 Posts
    6k Views
    C
    I did a search on the aptana site for "sketchup" and didn't find anything. Are there any installation instructions on how to pair up aptana and sketchup? @thomthom said: That's an interesting article. @unknownuser said: You can download Aptana Studio and RadRails, but the installation process is long and complicated. Besides, if you just want a Ruby editor, downloading a 30-day evaluation version of the gigantic Aptana Studio isn't worth it. Complicated installation process? And the thing is free. http://www.aptana.org/ Anyway - are you able to set breakpoints etc in SU plugin scripts and run them from Eclipse?
  • One-liners

    22
    0 Votes
    22 Posts
    418 Views
    N
    I've actually gone and changed my first post so that semi colons are allowed, and have modified your magic formula so the 3 steps are all in one line. I wanted no semicolons to avoid people going crazy with them (you could essentially write a whole program with them in one line of text). How about 3 semi colons maximum?
  • Copy tool --> no preview

    14
    0 Votes
    14 Posts
    205 Views
    N
    @dan rathbun said: @thomthom said: Instead of a timer, wouldn't DefinitionObserver.onComponentInstanceAdded be better..? https://developers.google.com/sketchup/docs/ourdoc/definitionobserver#onComponentInstanceAdded He is a month-old newbie.. I didn't want to go into observers with him yet. right ! thanks not "month-old", I'm "week-old" newbie !
  • Stumped

    2
    0 Votes
    2 Posts
    142 Views
    TIGT
    I moved your post to a more appropriate place. There are several good threads here - e.g. http://forums.sketchucation.com/viewtopic.php?f=180&t=10142 Also 'Automatic Sketchup' is a good general primer. http://www.autosketchup.com/ On your particular subject... You have already go something like mytext=Sketchup.active_model.active_entities.add_3d_text(xxxxxxxxxxxxxx) where ' xxxxxxxxxxxxxx' represents the various arguments that you need to pass to the method... This then adds the 3d-text as 'raw geometry' into the current context [usually the model's entities]. If you look at the API section on 'entities' https://developers.google.com/sketchup/docs/ourdoc/entities there are lots of ways to add things to ANY 'entities' collection... So to add a group to the model.entities use group=Sketchup.active_model.entities.add_group() Now you have a group in the model and can add things to that group's entities, instead of the model, thus... group.entities.add_3d_text(xxxxxxxxxxxxxx) Now the 3d-text's geometry is inside 'group'... You can add more things into it, or change its name, material, layer etc as you now have a reference to it ' group'... You can even add groups inside such new groups etc, as you desire...
  • Mystery

    4
    0 Votes
    4 Posts
    129 Views
    M
    @tig said: Are all of your methods wrapped inside a module and/or class ? I'd be surprised that Fredo has a raw 'deactivate' method I suspect you do ! It might be an observer trapping your error into his own error reporting, assuming it's his tool's error... The standard Tool deactivate method is def deactivate(**view**) ...Try adding that inside a Tool class... ??? https://developers.google.com/sketchup/docs/ourdoc/tool#deactivate YES! That did it! Yes it was all within a class. Just adding "(view)" solved the problem. I didn't change anything else. The deactivate method was within the class and still is. Yes indeed I strongly suspected that Fredo had nothing to do with this. Thanks TIG and Dan.
  • Looking for a Developer

    4
    0 Votes
    4 Posts
    120 Views
    J
    @dan rathbun said: Are you the JL2004 who posted this ?? https://groups.google.com/forum/?fromgroups#!topic/sketchupruby/2Tdb5bYyyd8 No that is not me. I am looking through the Ruby Guide as well as teaching myself Ruby. Just feel its taking a long time and its something I would like to get out sooner than later.
  • Define possible (manifold) groups in a model

    2
    0 Votes
    2 Posts
    87 Views
    TIGT
    Perhaps start from a different angle... A manifold solid group has the following properties... It contains only faces and their edges. AND these edges can only have two faces - no fewer, no more. So this is start - you can eliminate all other faces/edges ? The number of permutations will always expand exponentially... What is it you are trying to do, exactly ?
  • Menus & Tools

    11
    0 Votes
    11 Posts
    296 Views
    N
    @dan rathbun said: @niccah said: Just a small question: Why you are writing " Sketchup.require"? Are there any differences to the "normal" require? FYI: The "normal" require (and load,) comes from module Kernel. Sketchup.require and Sketchup.load can call the internal decryption for rbs files, but the Kernel ones cannot. Okay, this sounds logic! Thanks for the information!
  • Plugin for Gaussian bells

    5
    0 Votes
    5 Posts
    184 Views
    D
    thank you very much for the help, great links
  • Explode group, retrive all entities and recreate group

    14
    0 Votes
    14 Posts
    1k Views
    N
    @dan rathbun said: Does your boss ever use the [image: file.php?id=87554] Model Info > Statistics panel ?? [attachment=1:1ebrpxvl]<!-- ia1 -->ModelInfo_Statistics.png<!-- ia1 -->[/attachment:1ebrpxvl] Yes he knows this tool, but it don't give you the texture (in m²) and of the components neither groups thanks to all everybody !!! I think I found the solution. When I need to found each entities in a group I use that : if g.is_a?(Sketchup;;Group) g.entities.each do |element| if element.definition.name[0] != 0 && element.name == "" element.name = "#{element.definition.name}" end # end if end #|element| With that, I can change the name of component inside a group The first code of TIG gave me an idea, I combine my code with a piece of code from him and it worked ! (it was only a sample of code used to test for me) Now I have to copy that piece of code in the big one ! Before : [image: 33890297.png] After launching the plugin : [image: 18942418.png]
  • Capturing $sterr output

    10
    0 Votes
    10 Posts
    377 Views
    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 Votes
    21 Posts
    719 Views
    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 Votes
    8 Posts
    536 Views
    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 Votes
    4 Posts
    155 Views
    J
    I'd just write: text = IO.read("path/to/file.txt")
  • UI.savepanel question

    9
    0 Votes
    9 Posts
    365 Views
    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 Votes
    9 Posts
    176 Views
    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 Votes
    4 Posts
    187 Views
    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 Votes
    4 Posts
    143 Views
    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 Votes
    2 Posts
    308 Views
    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 Votes
    8 Posts
    153 Views
    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! )

Advertisement