ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • To create script I need to add GEM to Sketchup's Ruby

    4
    0 Votes
    4 Posts
    449 Views
    TIGT
    Yes I have also looked at 'packaging' other Ruby methods with mine to give extended functions in distributed scripts [I gave up!]. The real complexity is that as soon as you look to import one new moved over method, then you'll almost certainly find that it includes 'requires' for several other files, these files in turn require other files and so on. You'll end up with a massive tangle of files/subfolders 'requiring' other files ad nauseam, and one mistype/misplaced line of code breaks everything - makings untangling it all very very hard...
  • Guidelines for adding a method to existing classes?

    12
    0 Votes
    12 Posts
    422 Views
    danielbowringD
    @tt_su said: Note that extending Entity instances would not be allowed by EW because the instances are global to everyone using the SketchUp environment. But for other types such as Point3d, Vector3d, String etc that would work. Here delegators can be useful. require 'delegate' module DanielB class SampleFace < DelegateClass(Sketchup;;Face) def inner_loops return loops.find_all { |l| l != outer_loop } end end def self.demo face = Sketchup.active_model.selection.find { |e| e.is_a?(Sketchup;;Face) } return if face.nil? face = SampleFace.new(face) puts face.inner_loops end end
  • One-shot toolbar buttons?

    11
    0 Votes
    11 Posts
    357 Views
    tt_suT
    Oh, right - yes I noticed that there's a bug under OSX. Sorry, I mostly use PC so I'd forgotten. I think there's an issue for it, but I'll check again and bump it.
  • Statistics on plugin users

    21
    0 Votes
    21 Posts
    818 Views
    jiminy-billy-bobJ
    @garry k said: This probably should be moved to another thread. Probably
  • Help! When an Object get touched by a Shadow (sun shade)

    4
    0 Votes
    4 Posts
    538 Views
    JuantxoJ
    You need to know if a panel is in shadow or not using this 2 vectors and using cosine law panel verctor-> v=Sketchup.active_model.selection[0].normal sun vector-> s=Sketchup.active_model.shadow_info["SunDirection"] But you need to know also if there is some object projecting shadow over the panel using raytest with sun vector and some points of the panel. You can modify this step and look for other methods if you need more accuracy...
  • Preserve integrity of curves when creating faces

    2
    0 Votes
    2 Posts
    216 Views
    D
    I think in the plugin code "weld" is what you need (google translator)
  • Maxwell export plugin for skecthup

    6
    0 Votes
    6 Posts
    4k Views
    brodieB
    This is probably a better solution since there are different versions of Maxwell and SU. You should be able to download the plugin including the exporter here... http://www.maxwellrender.com/index.php/try/sketchup -Brodie
  • Read_default webdialog position on OSX

    5
    0 Votes
    5 Posts
    292 Views
    D
    @jiminy-billy-bob said: it has to consider the window border. macs don't have window borders... available using vanilia.js from one of my webDialogs... outerHeight; 370 outerWidth; 422 pageXOffset; 0 pageYOffset; 0 parent; Window parseFloat; function parseFloat() { parseInt; function parseInt() { personalbar; BarProp constructor; BarPropConstructor visible; false __proto__; BarPropPrototype screen; Screen availHeight; 1174 availLeft; 0 availTop; 22 availWidth; 1920 colorDepth; 24 constructor; ScreenConstructor height; 1200 pixelDepth; 24 width; 1920 __proto__; ScreenPrototype screenLeft; 100 screenTop; 420 screenX; 100 screenY; 420 scrollX; 0 scrollY; 0 scr
  • Using each_slice possible?

    10
    0 Votes
    10 Posts
    986 Views
    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 Votes
    4 Posts
    315 Views
    mitcorbM
    And now, I recall having looked at this thread. Sorry for any misinformation, and thanks to pbacot
  • Progress bar

    4
    0 Votes
    4 Posts
    865 Views
    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 Votes
    8 Posts
    420 Views
    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 Votes
    8 Posts
    874 Views
    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/, &quot;\n\r&quot; ) not working in WebDialog

    10
    0 Votes
    10 Posts
    1k Views
    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 Votes
    13 Posts
    975 Views
    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 Votes
    6 Posts
    368 Views
    dkendigD
    good catch
  • Best way to iterate all nested entities

    29
    0 Votes
    29 Posts
    6k Views
    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 Votes
    9 Posts
    797 Views
    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 Votes
    3 Posts
    187 Views
    ppoublanP
    Thanks a lot for your answer. F.....g doc and su apis.
  • Open dialog box

    6
    0 Votes
    6 Posts
    314 Views
    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>

Advertisement