Sketchucation Tools 5.0.7 | Licensing improvements and bug fixes Learn More

Alkategóriák

  • No decscription available

    20 Témakörök
    462 Hozzászólások
    HornOxxH
    @pilou said: More appetizing in chocolate! Eggs are good as well - but only very fragile when falling down in SketchyPhysics
  • Using each_slice possible?

    10
    0 Szavazatok
    10 Hozzászólások
    1k Megtekintések
    Dan RathbunD
    You get a NoMethodError because Enumerable does not have that method defined in Ruby 1.8.x. This should do the same, except you pass the array in as the 1st argument: def slicer(ary,num) a2 = ary.dup len = num.to_i.abs until (s = a2.slice!(0,len)).empty? if block_given? yield(s) else puts(s.inspect) end end # until end # slicer() See another example that will collect the slices into an output array, IF a block is NOT given. (Sort of like the opposite to flatten().) If a block is given, it returns an array of the block's return values. Prints to $stdout only if $VERBOSE == true. Fixed absolute call. It is not a Math module function. It is a standard Ruby Numeric instance method.
  • Painting effect

    4
    0 Szavazatok
    4 Hozzászólások
    465 Megtekintések
    mitcorbM
    And now, I recall having looked at this thread. Sorry for any misinformation, and thanks to pbacot
  • Progress bar

    4
    0 Szavazatok
    4 Hozzászólások
    1k Megtekintések
    Chris FullmerC
    SketchUp does that just by writing text to the status bar. a series of | characters to show progress. You can mimic the same behavior, but you do have to re-write it yourself.
  • Multiple objects to groups

    8
    0 Szavazatok
    8 Hozzászólások
    697 Megtekintések
    W
    @chris fullmer said: That was the first script I wrote and published, for this EXACT purpose. You can find it here: http://www.smustard.com/script/Loose2Groups Thanks so much, works perfectly
  • JScript innerHTML not working in WebDialog !

    8
    0 Szavazatok
    8 Hozzászólások
    1k Megtekintések
    S
    @tt_su said: @onidarbe said: So Sketchup uses IE instead of Chrome, although I uninstalled IE? strange You cannot completely uninstall IE. You may have uninstalled the front-end, but the IE engine is embedded deep into the OS. Help files (chm files) are using the HTML engine, HTA files are also using it. And the embedded HTML IE webcontrol is more conservative in terms of compatibility, which is why you need to use META tags to force WebDialogs to use the very latest IE engine. And because so many things use the system HTML engine I recommend you keep IE up to date, even if you use a different browser. You can never remove it 100% anyway. The "uninstaller" is just a shim to please the public (and EU anti-trust). For Mac users, the equivalent statement is that SketchUp uses the WebKit Framework, not Safari. Just as on Windows, your choice of browser has no effect on what SketchUp's WebDIalogs do.
  • .gsub( /\n/, "\n\r" ) not working in WebDialog

    10
    0 Szavazatok
    10 Hozzászólások
    2k Megtekintések
    onidarbeO
    Thanks Dan! But in this case I want for those maybe using my stuff to make it readable in notepad to
  • List of all possible functions

    13
    0 Szavazatok
    13 Hozzászólások
    2k Megtekintések
    tt_suT
    @tig said: I know TT has done some 'shortcut fiddling' with some of his tools [VertexTools?], so pressing M is Move [Vertex] in that tool, rather than invoking the native Move, which already uses that shortcut, and will do so when TT's tool is exited... Perhaps TT can explain what he does to allow that... the files re encrypted... I never modified the shortcuts. What I did in Vertex Tools was that I wanted to activate Vertex Tool's Move tool when vertex mode was activated, and the native Move tool when it was not. So I created a method that did that - but the user still had to reassign it's short-cuts to my proxy-delegating command.
  • Applying new Material to a Selection is extremely slow

    6
    0 Szavazatok
    6 Hozzászólások
    653 Megtekintések
    dkendigD
    good catch
  • Best way to iterate all nested entities

    29
    0 Szavazatok
    29 Hozzászólások
    7k Megtekintések
    dkendigD
    yes, generally this tends to do the trick, but we found that it was a tad faster to have your own lookup table that keeps track of definition relevance. The only downside, is that you are at the mercy of the observer system in that case, but the observers these days seem fairly stable, so that isn't currently an issue.
  • Stairs Ruby?

    9
    0 Szavazatok
    9 Hozzászólások
    1k Megtekintések
    artmusicstudioA
    @martinrinehart said: Google didn't help me find the killer stairs Ruby I was looking for. Is there one? what about this? coming soon..... http://www.youtube.com/watch?v=PMWwlmsmNAs regards stan
  • Material.Texture not working as explained in the doc

    3
    0 Szavazatok
    3 Hozzászólások
    337 Megtekintések
    ppoublanP
    Thanks a lot for your answer. F.....g doc and su apis.
  • Open dialog box

    6
    0 Szavazatok
    6 Hozzászólások
    535 Megtekintések
    tt_suT
    To open it as you would via File > Open: <span class="syntaxdefault">skp_file </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> UI</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">openpanel</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'Choose model to import'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'*.skp'</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">open_file</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">skp_file</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span> To load it as a component and let the user position it: <span class="syntaxdefault">skp_file </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> UI</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">openpanel</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'Choose model to import'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'*.skp'</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">unless skp_file</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">nil</span><span class="syntaxkeyword">?<br /></span><span class="syntaxdefault">  model </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model<br />  definition </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">definitions</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">load</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">skp_file</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">  model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">place_component</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">definition</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">end</span> To load it as a component and insert at ORIGIN: <span class="syntaxdefault">skp_file </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> UI</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">openpanel</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'Choose model to import'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'*.skp'</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">unless skp_file</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">nil</span><span class="syntaxkeyword">?<br /></span><span class="syntaxdefault">  model </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model<br />  definition </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">definitions</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">load</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">skp_file</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">  tr </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Geom</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Transformation</span><span class="syntaxkeyword">.new<br /></span><span class="syntaxdefault">  model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_entities</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">add_instance</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">definition</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> tr</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">end</span>
  • Calculate the needed width of a WebDialog

    10
    0 Szavazatok
    10 Hozzászólások
    864 Megtekintések
    onidarbeO
    Thanks! I found the solution... [update 2013-01-23] def popup(msg="", timeOut=0, posX=20, posY=70) # 2013-01-23 onidarbe () gmail # Popup a message (including html-tags & \r) with a timout and auto-resize the window # A click on the popup-window will disable timeOut and has to be closed manually # To see how it's working, add border;1px solid black; in the <div style='...'> htmlCode = %{ <html onclick='clicked();' > <div id='div' style='float;left; white-space;nowrap;' > #{msg.gsub(/\r/,"<br>\n")} </div> <script type='text/javascript'> width=document.getElementById('div').offsetWidth; height=document.getElementById('div').offsetHeight; document.write("<input type='hidden' id='width' value='" + width + "'/>"); document.write("<input type='hidden' id='height' value='" + height + "'/>"); function clicked() { location = 'skp;clicked' }; document.body.scroll = "auto"; </script> </html> } win = UI;;WebDialog.new( "" ) # NOTE; Variables made up on multiple lines have only a \n at the end of each line! # "View source" with Windows Notepad needs to have \r\n win.set_html( htmlCode.gsub(/\r\n|\n\r|\n|\r/,"\r\n") ) # Although WebDialog without pref_key doesn't keep size or location, set_size does! # Thereby start with a smaller window instead of a larger previous version win.set_size( 130, 30 ) win.set_position( posX, posY ) win.show UI;;start_timer( 0, false ) { win.set_size( win.get_element_value("width").to_f+60, [800, win.get_element_value("height").to_f+80].min ) } if timeOut != 0 timerID = UI;;start_timer( timeOut, false ) { win.close } win.add_action_callback( "clicked" ) { UI.stop_timer( timerID ) } end end pluginPath = Sketchup.find_support_file( "Plugins" ) Dir.chdir( pluginPath ) rbFiles = Dir[ "*.rb" ] popup( "<B>All plugins;</B>\r#{pluginPath }\r\r#{rbFiles.join("\r")}", 2 )
  • Method -- Best Naming Techniques

    3
    0 Szavazatok
    3 Hozzászólások
    441 Megtekintések
    Dan RathbunD
    #2 is the Ruby way. (#1 is Javascript or VisualBasic) [#3 is noway!]
  • Rotate face in ruby

    3
    0 Szavazatok
    3 Hozzászólások
    560 Megtekintések
    I
    Thank you very much. This has really been helpful. It was OK the first time I tried This is the end result: [image: qGNs_moebius.jpg]
  • Dynamic Components reacting to Scene (aka Page) changes

    9
    0 Szavazatok
    9 Hozzászólások
    9k Megtekintések
    G
    Dan , thanks for your help. I will study it.
  • Model in model sharing methods

    7
    0 Szavazatok
    7 Hozzászólások
    492 Megtekintések
    Dan RathbunD
    try something like: file "MR/MIX/P.rb" module MR module P def p(msg="") puts "from MR;;P; '#{msg}'" end end # create a module function within module MR; extend(P) # creates a singleton method end other files: require("MR/MIX/P.rb") module MR module Test p "Called p inherited down from Kernel" include(MR;;P) # overrides the p() inherited from Object, as mixed in from Kernel MR;;p "Called MR;;p" p "Called p" # should call overridden p() def self.pedigree() puts "#{Module.nesting[0].name} ancestors; #{self.ancestors.inspect}" end end end
  • How to check showRubyPanel is ready to accept puts

    16
    0 Szavazatok
    16 Hozzászólások
    1k Megtekintések
    D
    @onidarbe said: Seems I need to use Win32API. most probably... for the Notepad++ side of things. I understand more what your doing now... I have a similar setup that uses 'Applescript' and 'Unix' to let me work in 'dev-mode', I struggled to get it to work for many versions. I'm very happy with it now, and it is possibly portable, if you want to have a look I'll PM you a copy... It now functions on a very simple premies. Let SU do the SU bits and only do what it can't with other tools... when you use Sketchup.plugins_disabled = true => 'only' the standard Sketchup.find_support_file("Plugins") are disabled. 'Ruby Console' can be opened from any other other loaded path. I have two different 'loader files' One is in "../Plugins/My_Folder/my_file", it has a cmd that toggles Sketchup.plugins_disabled = true : Sketchup.plugins_disabled = false Then, I use the "Tools" folder to hold a small ruby that basically... [sudo code] my_file = ( Sketchup.find_support_file("my_file.rb", "Tools") ).sub( "Tools", "Plugins") if Sketchup.plugins_disabled? && FileTest.readable?( my_file ) "Sketchup.send_action 'showRubyPanel;'" load(my_file) else ignore_me end john
  • Edge intersection

    5
    0 Szavazatok
    5 Hozzászólások
    450 Megtekintések
    Dan RathbunD
    Sketchup::Model#raytest()
  • Memory management in C++ Extension

    15
    0 Szavazatok
    15 Hozzászólások
    1k Megtekintések
    tt_suT
    rb_intern doesn't return VALUE, it returns ID. Adam, would the same issues for VALUE be valid for ID? I've used to make static const out of ID's I use a lot for easy access and avoid Ruby lookup up for every function call.

Advertisement