sketchucation logo sketchucation
    • Login
    1. Home
    2. hsmyers
    3. Topics
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 7
    • Posts 26
    • Groups 1

    Topics

    • hsmyersH

      Pairing face problem

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      9
      0 Votes
      9 Posts
      752 Views
      hsmyersH
      @sdmitch said: What defines a good or bad pairing? No overlap when moved center to center. Where 'center' is center of paired face.
    • hsmyersH

      Problems with PickHelper

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      14
      0 Votes
      14 Posts
      1k Views
      thomthomT
      No worries - we all learn. Thanks for posting back your solution.
    • hsmyersH

      Closest face problem

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      5
      0 Votes
      5 Posts
      592 Views
      hsmyersH
      @sdmitch said: @hsmyers said: how about closest pair of points? Since you are only dealing with two objects, it shouldn't matter which is sel[0] or sel[1] To find the closest corners of two objects mod = Sketchup.active_model > . > . > . > UI.messagebox "Obj0 Cor#{m} to Obj1 Cor#{n} is #{Sketchup.format_length(md)}" > Thank you for the snippet! You are correct excepting that the tool in question will move one of the two objects such that the opposing face centers are touching plus or minus an offset. Sorry for the grossly incomplete spec My plan (very fluid and quite murky ) is take the first selection as the moving object and the second as the fixed object. I've some notion about non-parallel faces requiring ( optionally ) an rotational adjustment. However it's my goal to keep things as simple as possible. My usage is to stack components together to assemble the model much like one would in actuality. Hex nuts, lock washer on threaded rod etc. Additionally, there is the self-educational aspect of solving the which selection is on first This tool already has four options and looks to acquire one or more in the future. So it seems prudent to solve this now to make ready for the unforeseen. 'Sides any excuse to cut code!!
    • hsmyersH

      Save and restore cursor?

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      3
      0 Votes
      3 Posts
      506 Views
      hsmyersH
      @thomthom said: model.tools.push_tool(tool) model.tools.pop_tool http://www.sketchup.com/intl/en/developer/docs/ourdoc/tools#push_tool My thanks...and off to read the fine manual (err...what manual?) again
    • hsmyersH

      Towards a complete extension: Good Practices

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      5
      0 Votes
      5 Posts
      539 Views
      hsmyersH
      @dan rathbun said: Then you'll need to follow: http://extensions.sketchup.com/en/developer_center/ew_developer#rbz I've read through same and I plan to do so again more thoroughly again after I get this next layer of magic nailed down. I think I now understand the two file format well enough to give it a spin in a bit but am momentarily busy prepping prototype parts for shapeways. Its been tool, prototype, tool, proto in a kind of recursive spiral! Need one for the other and round about we go...
    • hsmyersH

      Object or No: Good Practices

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      4
      0 Votes
      4 Posts
      538 Views
      G
      I've been coding all the way back to my assembler days (pre 1980). Various flavors of (Basic, Cobol, C, C++, Pascal, C#, Java), many database scripting languages such as (dBase, MSAcces, Paradox), other scripting languages such as javascript, jquery, PHP, Ruby, CSS, SQL. AWK, TCL ... I usually go with the flow. Borland built a very good library called the VCL (Visual Components Library), which makes use of an absolutely excellent object oriented set of classes. Easy to follow and very consistent stylisticly. This library is used by Delphi (object oriented pascal) and by C++ Builder. Microsoft built a terrible interface called MFC (Microsoft Foundation Classes). So when I had to use Microsoft for various early mobile devices I skipped it and used the Win API. With Sketchup I use a mix of both Classes (for tools) and simple reusable methods for helper functions. Even though I prefer using pointers with C, C++ etc. it just isn't possible with ruby (although under the hood most everything is passed as a reference). Having said all that - Ruby is quite good - although there are a few too many ways to do anything. This just means it is often a bit slower reading other code as the programmer often chooses a different way to do things. So I'm a bit more formal and like to use terse syntax where possible. ! instead of not, || instead of or, immediate if = ? :, parenthesis for all methods, lots of white space etc. For me it is all about readability so I can come back and speed read code I wrote months or years ago. But I do like some of Ruby's ways. "#{var}" the use of if after an assignment etc.
    • hsmyersH

      Module depth: Good Practices

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      5
      0 Votes
      5 Posts
      680 Views
      G
      I use a modified template that Dan Rathburn created. I also use his file naming convention for the loader etc. You could strip this down. But I like to place my plugins in a shared folder so I can test a single plugin on 6 versions of Sketchup SU7 through SU2016 require('extensions.rb') module YourCompany # Proprietary TopLevel Namespace; No Trespassing! module ThisPlugin # Namespace for THIS plugin # Create an entry in the Extension list that loads script called; # "gkware_doormaker_loader.rb" APP_VERSION = '1.0.1' @plugin = SketchupExtension.new('Company Plugin Description', File.join('PluginName', 'Company_PluginName_loader')) @plugin.creator = 'Your Name' @plugin.copyright = '(c)2013-2016 by YourCompany' @plugin.version = APP_VERSION @plugin.description = 'Plugin does something - optional url to your website' unless @plugin.class.method_defined?(;path) # # Define a singleton method for @plugin to access the @path attribute. # (... because the API did not do it in extensions.rb !!) # def @plugin.path() instance_variable_get(;@path) end end # unless # Create local path and filename constants; PATH = @plugin.path() LOADER_SUFFIX = '_loader' LOADER = File.basename(PATH) tmp = LOADER.split('_') RBSFILE = tmp[0] + '_' + tmp[1] + '.rbs' # RELDIR is relative to Plugins dir, OR the dir from # the $LOAD_PATH array that require used to find it. RELDIR = File.dirname(PATH) ROOT = $LOAD_PATH.find(false) do |abspath| Kernel.test(?d, File.join(abspath, RELDIR)) end if ROOT ABSDIR = File.join(ROOT, RELDIR) else # assume the target dir is directly below, the dir that THIS file is in. ABSDIR = File.join(File.dirname(__FILE__), RELDIR) end # Register this extension with the Sketchup;;ExtensionManager Sketchup.register_extension(@plugin, true) end # module YourCompany;;ThisPlugin end # module YourCompany
    • 1 / 1