ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • RubyAPI - UI timers

    15
    0 Votes
    15 Posts
    11k Views
    Dan RathbunD
    @aerilius said: I've done similar experiments and found evidence that Threads do (partially) work. And ... in PC SketchUp prior to v8, it distro'd with Ruby v1.8.0 in which the Thread class was very unstable. But threads have gotten more stable in Ruby versions above v1.8.6, even more so in the v1.8.7 branch. Keep in mind that all the Mac Sketchup editions still disto with Ruby v1.8.5 (initial release.) Usually .. coders wish to use threads in order to prevent SketchUp from blocking. As ThomThom said.. threads in the Ruby 1.8.x trunk are green threads (still within SketchUp's process.) Read the description of Green Threads at wikipedia. DITTO what TIG said.
  • Multiple dialog scope issue on the PC

    24
    0 Votes
    24 Posts
    374 Views
    Dan RathbunD
    @honkinberry said: The javascript:void(0) is the recommended practice, indicating that the onclick handler is to take precedence. I disagreed 3 years ago when we discussed this issue, and still do. Read my detailed explanation in this old thread: Webdialogs and Javascript void Any more discussion on this offtopic, can be done in that thread, if you wish.
  • [Code] User::ToolbarSet collection

    4
    0 Votes
    4 Posts
    270 Views
    Dan RathbunD
    UPDATED code in 1st post to v2.0.1, in refresh() method's next statement to avoid a vicious loop. (We use Hash#has_key?(key) rather than Hash#[key]!=nil, because our v2.0.0 update makes the [] method call the refresh method, so we must be very careful from within the refresh method that any [] method call does not cause a unwanted or unneeded, call to refresh.)
  • Md5 hash or similar in SU Ruby?

    10
    0 Votes
    10 Posts
    2k Views
    Dan RathbunD
    Personally I have just used a Ruby %x call using the fciv.exe command line checksum utility that I believe came with the Windows Support Tools. fciv stands for File Checksum Integrity Verifier: Microsoft Download: File Checksum Integrity Verifier
  • Load Toolbars

    7
    0 Votes
    7 Posts
    232 Views
    Dan RathbunD
    @burkhard said: Found a workaround. It needs to be refresh, ... So, if a Toolbar is not loaded, it works after refresh the hash. The Toolbar WAS loaded, but UI::Toolbar references are NOT automatically added into the custom User::ToolbarSet hash. SO.. I created the UI::Toolbar.refresh() method to find any new toolbars (created after the hash was populated,) and add them. I WILL NOT modify the API's UI::Toolbar class constructor method, in a public script, because I feel it is a violation of the API Terms of Use. BUT perhaps we can modify the User::ToolbarSet hash's [] method's error Proc, so that it refreshes the hash automatically. See: http://sketchucation.com/forums/viewtopic.php?f=180&t=51432&p=466742#p466742
  • Test array generation...

    3
    0 Votes
    3 Posts
    129 Views
    D
    TT added commenting to the original code block to try and explain things better, I can't get the formatting to hold... but this is better. john
  • [Info] WebDialogs - The Lost Manual on GitHub

    5
    0 Votes
    5 Posts
    203 Views
    thomthomT
    @mptak said: I think this will inspire me to finally make the leap fully into github! Excellent! I'd really like to see the SketchUp community making more use of tools such as GitHub and BitBucket etc.
  • Organising namespaces and loading scripts on demand

    7
    0 Votes
    7 Posts
    260 Views
    thomthomT
    <span class="syntaxdefault"><br />filter </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> File</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">dirname</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">File</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">dirname</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">__FILE__</span><span class="syntaxkeyword">),</span><span class="syntaxdefault"> </span><span class="syntaxstring">'*.rbs'</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">for filename in Dir</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">glob</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">filter</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">  eval</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"Sketchup;;require('#{filename }', TOPLEVEL_BINDING, '#{filename}', 1 )"</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">end<br /></span> ?
  • Ruby script of bezier curves need edit

    5
    0 Votes
    5 Posts
    2k Views
    piratebrianP
    I'll post some cut tests shortly, but here is the lovely curve: [image: RnQR_bezier160.JPG]
  • Question about Normal vector

    9
    0 Votes
    9 Posts
    818 Views
    Dan RathbunD
    this: normal_vector = normal_vector + face.normal will not work as expected, if you set normal_vector to reference the integer object 0, because the integer +() method will get called, and it is not likely that it would know how to handle an argument that references a Geom::Vector3d object. Smarter to create either a unit vector object to start with, or a zero length vector: normal_vector = Geom::Vector3d.new(0,0,0) THEN, when you call the +() method using: normal_vector = normal_vector + face.normal the special vector addition API method will get called. In other words your statement is evaluated as if it were written: normal_vector.=( normal_vector.+( face.normal ) ) This is one of the important things about Ruby... = and + (etc,) are not really operators, they are instance method names.
  • Cleaning up after intersect_with

    9
    0 Votes
    9 Posts
    301 Views
    sdmitchS
    This seems to work with or without using intersect_with model = Sketchup.active_model entities = model.entities entities.clear! #Create a group to collect all entities for base cube basegroup=entities.add_group basegroupentities=basegroup.entities base_trans=basegroup.transformation p1 = Geom;;Point3d.new(0, 0, 0) p2 = Geom;;Point3d.new(9, 0, 0) p3 = Geom;;Point3d.new(9, 4, 0) p4 = Geom;;Point3d.new(0, 4, 0) points = [p1,p2,p3,p4] base = basegroupentities.add_face points base.reverse! if base.normal.z < 0 base.pushpull 1 cutgroup = entities.add_group() cut_trans = cutgroup.transformation cutgroup.entities.add_3d_text('Bob', TextAlignCenter, "Arial", true, false, 3.0, 0.0, 0.0, true, 1) transform = Geom;;Transformation.new(Geom;;Point3d.new(0.5,0.5,0)) cutgroup.transform! transform #intersections = cutgroup.entities.intersect_with true, cut_trans, basegroup.entities, base_trans , true, basegroup basegroup.explode dmp=cutgroup.explode;#erase the top and bottom of the letters dmp.each{|f| f.erase! if f.is_a?(Sketchup;;Face) && f.normal.z.abs>0.5} #add faces to 'holes' in the letters dmp.each{|e| e.find_faces if e.is_a?(Sketchup;;Edge) && e.faces.length==1} model.active_view.zoom_extents
  • Get_element_value issue (on Mac)

    14
    0 Votes
    14 Posts
    2k Views
    thomthomT
    Surely an instance variable will work just as well? Avoiding the risk to collision of global variables - especially with a common variable name such as args.
  • [WIP]SCF Plugin Repo/Auto Installer

    26
    0 Votes
    26 Posts
    779 Views
    mitcorbM
    This is an excellent concept, Rich. Video well done and narrated.
  • Need testers for my Ruby Code Editor

    19
    0 Votes
    19 Posts
    533 Views
    alexschreyerA
    @trogluddite said: ...when it comes to testing and de-bugging, this is the bee's knees. Thanks for your comments! Glad to hear you like the editor. I'll look into your suggestions but - as you said - the display just naturally becomes slower with 100's of lines of code simply because it renders everything in JavaScript. Not sure if #3 is already implemented in CodeMirror somehow... have to look. Cheers, Alex
  • Sketchup send action for paste..

    6
    0 Votes
    6 Posts
    516 Views
    TIGT
    BUT since there is no ability to change the active-context through the API then paste-in-place is pointless... If you Cut or Copy then Paste with send_action it's sine because the original selected object and the newly copied/cut then-pasted one are in the same context, and the user gets the copy on their cursor to place manually. But let's assume there were a seemingly usable Paste_In_Place send_action available through the API, how would it be of any use ? Say you are in the the model and want to Cut an object, open a Group and then do a Paste_In_Place on the object inside the Group. In the API you can Cut it. BUT you are now stuck as you can't open the Groups context. Paste_In_Paste will simple place the object back where it was, in the current context !!! There IS a way to replicate all of this 'in code'... BUT your Ruby_Cut and Ruby_Paste_In_Place into another 'container' custom code needs to make a group of the selected objects, then find that group's definition and then use container.entities.add_instance(defn, trans) on the other container's entities context, applying the container's transformation onto it [with a .inverse ? I write this 'off-the-cuff'], so that it's kept 'in_place'. Once that is done you explode that newly added group inside the container, then finally you erase the original group so the selection appears to have been cut and pasted_in_place into the other container... If you mimic a Ruby_Copy and Ruby_Paste_In_Place it's similar... except on completion you also explode the original group rather than erasing it, and in that way the selection appears to have been copied and pasted_in_place into the other container...
  • WebDialog on Mac (call to Google SU engineers)

    25
    0 Votes
    25 Posts
    8k Views
    jolranJ
    Ahh, missed this addition to this rather old topic. Interesting reading. Might be relative to Didier's recent topic. http://sketchucation.com/forums/viewtopic.php?f=180&t=51350 I wonder if I could get some clarification about this: For ex, let say you have a dozen buttons that each is hooked up to it's own callback to Ruby with "window.location.href" for the callback. Even if the Ruby script is permitted to "finish" it's doing before pushing the next buttons, will there be a sync problem ? I'm having a hard time understanding how this issue behave since I don't have a Mac for testing it out myself. It seams like Arielius has a clever solution, but what if for ex one has a slider performing realtime transformation or such ?
  • Import CSV to extract values

    7
    0 Votes
    7 Posts
    2k Views
    K
    @tig said: Ken... I've given you an example in the 'parallel thread' that you started. Yep, got that TIG. Thanks..and sorry for repeating the post.
  • Compile PPC comaptible C Extension on OSX10.8?

    5
    0 Votes
    5 Posts
    159 Views
    thomthomT
    Don't have the specs at hand - but I think it's one of the late 2009 Intel Mac Minis.
  • [concept] plugin launcher

    39
    0 Votes
    39 Posts
    5k Views
    A
    If your were interested in LaunchUp, don't miss that it is no an official plugin: → LaunchUp – A Quick Launcher for SketchUp
  • SketchUp Ruby API Suggestions

    5
    0 Votes
    5 Posts
    149 Views
    A
    Great! Especially since so many issues are scattered over the forums (or burried miles deep under newer bug reports). I sometimes feel by reporting bugs we create the most awesomest bug collection, but the goal shouldn't stay purely contemplative, shouldn't it also be about realizing solutions? This way we can collaborately work on it and "prototype" API fixes and suggest extensions. Also there are so many subtle small issues/infos/experiences that would best be placed directly in the code or at the corresponding method in the API documentation (which we can't edit) – or in this github project.

Advertisement