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

    Topics

    • A

      SU2015 gives NoMethodError for Length class #abs method

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      6
      0 Votes
      6 Posts
      432 Views
      tt_suT
      @archidave said: but in SU 2015; > 2.m.abs gives the NoMethodError This is pretty bad (it has broken my plugin for SU 2015) and means I now need to go hunting through the code for all occurrences of <Length>.abs replacing them with <Length>.to_f.abs and building-in extra validation where the class is not intrinsically known, just in case there could be a Length instead of a Float. The Length class used to be a subclass of Float. However this isn't really possible in Ruby, but from the Ruby C API this was hacked together a way to do so. When we added 64bit support in SU2015 this broke because the data structures where different. So we had to re-implement Length by forwarding the methods to Float. Initially this used the Ruby Standard Library, but due to another bug in Ruby where the StdLib would not always load if there was unicode characters in the user's username the StdLib would fail and the Length class would not properly initialize. There was also a bug in SU at some point where the StdLib would fail to load if the user started SketchUp by double clicking an SKP file. We later corrected the new Length implementation to not use StdLib so it would not fail if the StdLib failed to load. And we also fixed the bug regarding starting SU via SKP files. But those fixes should be in SU2015M2 - so I don't understand why you'd experience such problems. I am not able to reproduce your error. Can you try without any extensions enabled - just so we can eliminate that possibility?
    • A

      Organising namespaces and loading scripts on demand

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      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> ?
    • A

      Webdialogs: Debugging Javascript on Mac

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      4
      0 Votes
      4 Posts
      74 Views
      thomthomT
      The forum search isn't that good. I have more luck using Google to search it.
    • A

      Multiple attribute dictionaries created

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      6
      0 Votes
      6 Posts
      613 Views
      Dan RathbunD
      @archidave said: ... Since I was thinking along these lines, I was expecting the attribute dictionaries to behave in a similar way to creating instance variables; ... Nothing is stopping you from doing so. You can create a custom class (within your plugin namespace module,) for a Wall, that has instance variables, that are loaded from an entity's attribute dictionary. If you just save the values as an array, into a single attribute, you can use Ruby's iterator loops or methods, to load the values into instance variables. So the names of instance variables, are defined by a literal array inside your class, an the initialize method iterates this array, matching it's indexes, with the indexed values in the dictionary array. module ACME module BIMinator DictName = 'ACME_BIMinator' class Wall Atts = [;area,;thickness,;paint] attr_accessor( *Atts ) # expand array Atts to parameter list def initialize(entity) @prop = entity.get_attribute(ACME;;BIMinator;;DictName, 'properties') Atts.each_with_index {|att,i| method("#{att.to_s}=").call(@prop[i]) } end end # class end # BIMinator end SO.. the actual attribute names are defined in ONE place, your custom class.
    • 1 / 1