ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • Determine if edge would split face

    6
    0 Votes
    6 Posts
    1k Views
    G
    Thanks guys - this gives me some good direction. I like Sam's strategy where he makes use of the raytest.
  • Moving a Line or Edge

    3
    0 Votes
    3 Posts
    618 Views
    TIGT
    As Sam says, transformations only apply to containers like component-instances, groups and images. A Point3d does not have a transformation, BUT you can use point.transform!(transformation) it relocate it. Basic entity objects - like vertices, edges and faces - have to be transformed using: objects_parent_entities.transform_entities(a_transformation, [array_of_objects]) this works with any kind of transformation; or for a vector based 'translation': objects_parent_entities.transform_by_vectors([array_of_objects], [array_of_vectors]) note that each object in the first array must have a matching vector in the second array... Also if you are using the these to move say vertices, don't also include some edges or faces which use those vertices - otherwise the vector transformation will be done twice, with unexpected consequences...
  • SketchUp RUBY API Wishlist [way of coding wishes, please]

    107
    0 Votes
    107 Posts
    40k Views
    R
    Hello, I am new to google sketchup with ruby script. I have install google sketchup on my linux machine ubuntu 12.04. now able to start with ruby script. i already have ruby script. SO anyone can help to how can i run this script with google sketchup. Thanks
  • UI.inputbox

    4
    0 Votes
    4 Posts
    629 Views
    M
    I have "chained" 2 UI.inputbox. First inputbox opens another based on the input from the first box. The first box closes once the second is shown.
  • Sketchup.send_action arguments: Mac vs PC

    10
    0 Votes
    10 Posts
    3k Views
    B
    This is an old thread, but I'm adding a tip here that may be of help to other developers who may discover this info... In an effort to create a toolbar button to show the "Entity Info" palette (there's a built-in button for Model Info, but oddly not for Entity Info), I couldn't find a method or action that worked on the Mac. There is a fixnum constant value for the PC, but these don't seem to work on the Mac, even after years of SketchUp evolution on the Mac. Then I stumbled on the get_shortcuts method... Using the "Shortcuts" pane within the "Preferences" window, you can add a shortcut to the command for which you need the string constant, then using: Sketchup.get_shortcuts.sort ...you can discover the string that can successfully be used with the Sketchup.send_action method. For example, I added the F2 key to "Window/Entity Info", and got the following output: Sketchup.get_shortcuts.sort ["A\tselectSelectionTool:", "B\tselectPaintTool:", "C\tselectCircleTool:", "E\tselectEraseTool:", "F\tviewZoomExtents:", "F2\tentityProperties:", "G\tmakeGroup:", "H\tselectDollyTool:", "K\ttoggleDisplayBackEdges:", "L\tselectLineTool:", "O\tselectOrbitTool:", "P\tselectPushPullTool:", "R\tselectRotateTool:", "S\tselectScaleTool:", "T\tselectMeasureTool:", "V\tselectMoveTool:", "Z\tselectZoomTool:", "`\ttoggleHideRestOfModel:", "~\ttoggleHideSimilarComponents:", "⇧G\t/Edit/Context Menu Flyout/Explode"] In there, you'll see "F2\tentityProperties:", so the string constant is "entityProperties:". Voila, a method to discover undocumented action strings.
  • SU7: Sketchup#set_status_text() broken on Mac

    4
    0 Votes
    4 Posts
    824 Views
    SkalpS
    @adamb said: Anyone got any good ideas as to how to get around this bug in SU7? Basically, if you have a Ruby that is working hard and wants to show progress by updating the status text in the lower left, in SU7 on Mac its broken (bug logged SU-0282). Now I guess it will get fixed sometime, but in the meantime I'm trying to find a way of encouraging the window to refresh. A quick demo of what the bug is, is to run the following at the Ruby console: 5.times {Sketchup.set_status_text rand(); sleep 0.5} On PC, it updates the status text, on Mac it only shows the last one when the loop is completed. Any ideas gratefully received! Adam Adam, We have found a solution for this problem. If you put the actions inside a UI.timer, the set_status_text can be updated between the timers. Kind regards, Guy
  • Pickray

    2
    0 Votes
    2 Posts
    771 Views
    thomthomT
    Maybe due to precision issue? Not sure, but you don't have to convert between screenpoints like that: mod = Sketchup.active_model view = mod.active_view ents = mod.entities ents.clear! edges = ents.add_edges([0, 0, 0] , [100, 100, 100]) edge = edges[0] pt1 = edge.start.position pt2 = view.camera.eye Geom.intersect_line_line(edge.line, [pt1, pt2])
  • Localization

    2
    0 Votes
    2 Posts
    636 Views
    D
    I have recently been switching any of mine over to lang_handler... the main reason is concern over the new 'security' measures and where they will go next... I have a plugin that does most the hard work for you, but you still need to do some work... I'll PM it if you want... john
  • Changing Command Icons of the Toolbar

    19
    0 Votes
    19 Posts
    3k Views
    M
    Thanks Anton, I was thinking, that I'm doing something wrong, but it seems that this behaviour is not changed yet.
  • Transform face to a known plane

    15
    0 Votes
    15 Posts
    2k Views
    C
    @fredo6 said: > tr_axe_inv = Geom;;Transformation.axes(face.vertices[0].position, *(face.normal.axes)).inverse > Neat! Just saved fifteen lines of code in a script...
  • Webdialog losing focus in V16?

    7
    0 Votes
    7 Posts
    776 Views
    K
    I think I have a fix for the textbox input losing focus. Just a few lines in the html/Javascript. In the body: <body onblur= go_focus();> And in the Javascript part: function go_focus(){ document.getElementById("textbox").focus(); } Doing a self.focus() or window.focus() doesn't seem to work. Edit: applying the same code to some more complex plugins doesn't seem to work...
  • Module-class

    7
    0 Votes
    7 Posts
    679 Views
    M
    Mario, This might help (I reformatted your code a bit), see the last couple of lines -- # require 'sketchup.rb'   # why?  not needed for this code module McF3D   class McF3DTools      def initialize       @mod = Sketchup.active_model  # Open model       @ent = @mod.entities          # All entities in model       @sel = @mod.selection         # Current selection     end     def perceOuv       unless @sel[0].is_a?(Sketchup;;ComponentInstance) &&           @sel[0].definition.behavior.cuts_opening?         UI.messagebox "Sélectionnez un composant F3D !"       end       end    end # class McF3DTools end # module McF3D obj = McF3D;;McF3DTools.new() obj.perceOuv()   The topic of modules & classes in programming is very complex. Conversely, what most people writing a SketchUp extension need to do is a very small subset of that topic. HTH, Greg SUMD SketchUp Misc Docs
  • Enable Web Inspector in WebDialog on Mac

    9
    0 Votes
    9 Posts
    2k Views
    TommyKT
    @driven said: Tommy, just set it as a global preference and it works for SU and Safari... defaults write NSGlobalDomain WebKitDeveloperExtras -bool true paste into Terminal or wrap in %x() from Ruby Console... john YES! IT WORKS! SO SIMPLE! THANK YOU!
  • SQLite in SketchUp Ruby

    17
    0 Votes
    17 Posts
    4k Views
    D
    you can set the format for the output, so for a webDialog you can use... html = %x(/usr/bin/sqlite3 -html /private/tmp/sp500-data.sqlite "SELECT * FROM companies;") or there's -csv -list -line -column...
  • Creating a Solid with a set of points

    6
    0 Votes
    6 Posts
    623 Views
    medeekM
    Wow, I need to come here more often. I'm going to look into the "intersect_with" method further and see if this might not be the key to overcoming this hurdle.
  • Profile Builder API?

    6
    0 Votes
    6 Posts
    947 Views
    TommyKT
    Whaat, It would be amazing to have an API. Could you also perhaps include a callback system when a profile member or assembly is created/edited, so that other plugins could do their magic? On the information side of things, it could be things like updating a "price" attribute, which is based on the volume of the profile output, for instance. For such a callback, the useful variables would be: the geometry representing the path of a PM the group for the outputted member the face of the profile / components that make up the assembly.
  • Hidden Face Removal

    2
    0 Votes
    2 Posts
    467 Views
    bomastudioB
    [image: QIru_2DVectorVIEW.png] I'm on the road, I can draw the view and project exactly what I can see on the XY plane. But the problem is how to implement one the "hidden face removal" algorithms.....like the "painter algorithm", or the "Z-buffer" and so on.... In the MAKE version of SU I can't use the boolean operators so I'm in stall.....any ideas? EDIT: In this procedure I'm using the back-face culling algorithm in order to improve performaces.
  • [New scripter] Will need help on my project (now and then)

    21
    0 Votes
    21 Posts
    2k Views
    Dan RathbunD
    @ruts said: In my calculations ... I want to use the base ruby class Matrix which is made for such operations. I found out that it's not just adding require 'matrix' to your code. Because SketchUp was not distributed with the Ruby Standard Library until version 2014. @ruts said: I did copy the matrix.rb and e2mmap.rb (which is required by matrix.rb) from the ruby2.2.2 folder ... This will not work, as you need to use the library compiled and distributed with the Ruby version that SketchUp uses. The constants RUBY_VERSION and RUBY_PATCHLEVEL typed at the console tell you what SketchUp embedded Ruby is. @ruts said: ... I believe this is the right way to require 'matrix'. Nope (when the standard library is properly installed,) just a simple require 'matrix' will do (because it will load it's own dependencies as it is evaluated.) @ruts said: I think I already have a solution for my problem. NO you don't, because you "don't have time to read the book," all this basic Ruby 101 knowledge is escaping you. So just go to my GitHub repo and get the Standard Ruby 1.8.6-p287 Library packaged for SketchUp 2013 and earlier on Windows ONLY. https://github.com/DanRathbun/sketchup-ruby186-stdlib-extension/releases/tag/2 With SketchUp closed: (1) Put the RBZ archive someplace where you can navigate easily to it. (2) Delete any manually copied library files (such as those you mentioned copying above.) (3) Then start SketchUp 8 and use the manual "Install Extension ..." button from Window > Preferences > Extensions (3a) Navigate to where you saved the RBZ archive, and select it, click OK. (4) Open the console and test that the paths are correctly set in $LOAD_PATH (aka $:) by typing: puts $: and ENTER You should see a listing similar to: puts $:%(green)[C:/Program Files (x86)/SketchUp/SketchUp 8/Plugins C:/Program Files (x86)/SketchUp/SketchUp 8/Tools C:/Program Files (x86)/SketchUp/SketchUp 8/Plugins/Ruby186/lib/ruby/1.8 C:/Program Files (x86)/SketchUp/SketchUp 8/Plugins/Ruby186/lib/ruby/1.8/i386-mswin32 C:/Program Files (x86)/SketchUp/SketchUp 8/Plugins/Ruby186/lib/ruby/site_ruby/1.8 C:/Program Files (x86)/SketchUp/SketchUp 8/Plugins/Ruby186/lib/ruby/site_ruby/1.8/i386-msvcrt]nil The actual program files path might also look like: %(green)[C:/Program Files (x86)/Google/Google SketchUp 8/...] (5) Then further test the loading of "matrix.rb" via: require "matrix" You should see true returned.
  • Plugin load residue, ruby

    5
    0 Votes
    5 Posts
    722 Views
    M
    Thanks for the information, the problem is solved. A hidden bakup copy of the .tb file had been created in the Plugin folder. Sketchup kept trying to open that file. After making all the files visible in windows, and deleting the file, the problem was solved. With kindest regards.
  • Surface area of a component/group made up of groups

    2
    0 Votes
    2 Posts
    523 Views
    JQLJ
    Fredo has a plugin for area labelling under his Fredo tools. It works rather well and probably the functionallity can be adapted to your needs. Sketchup also has the ability to report material areas, so if your outer shell is all made from certain materials you can add up your areas.

Advertisement