sketchucation logo sketchucation
    • Login
    1. Home
    2. Dan Rathbun
    3. Posts
    ๐Ÿ›ฃ๏ธ Road Profile Builder | Generate roads, curbs and pavements easily Download
    Offline
    • Profile
    • Following 0
    • Followers 1
    • Topics 92
    • Posts 4,903
    • Groups 2

    Posts

    Recent Best Controversial
    • RE: [Plugin] Multiple Component Edit Warning

      PLUGIN UPDATE


      @paulofukuta said in [Plugin] Multiple Component Edit Warning:

      When I install the Edit Flag v2.4.0 plugin in SketchUp in Brazilian Portuguese, the tool name does not appear. How could I fix this bug?

      There were unicode character bugs in some of the language files resulting in silent failures for the menu command labels.

      I fixed all the bugs in the language files with version 2.4.2 (see below).


      @elijahpekaar said in [Plugin] Multiple Component Edit Warning:

      @ashscott Is there a possibility of getting an updated version for 2024 sketchup?

      I am the author of Ash's extension. (He hasn't been here in almost 2 years and not posted in the forum for almost 7 years.)

      Changes for SketchUp 2024 and Ruby 3:

      v 2.4.2 : 2024-04-27 by Dan Rathbun
      • Updates specific to SketchUp 2024+ and Ruby 3.2:
        - Changed File.exists? call to File.exist?

      • Re-focus the Sketchup window, so that the Edit Flag warning dialog no longer seizes the focus from the main modeling window.

      • Fixed the scrollbars showing in the edit warning dialog.

      • Added system font identifiers for both platforms to the "font-family" style for the dialog. The text should now show in the system font.

      • Localization:
        - Fixed unicode characters in files: es, fr, it, pt-BR, pt-PT
        - Added language hash files: cs, ko, ja, pl, sv, uk, zh-TW, zh-CN.
        - Localized the extension description and name for the Extension Manager.

      • The extension is now signed.


      • --> Get the latest version in the SketchUcation Plugin Store
      • --> Get v2.4.2 at the SketchUp Official forum
      posted in Plugins
      Dan RathbunD
      Dan Rathbun
    • RE: Ruby Sketchup Programmatic Union of Multiple items

      @Sklik-Rab said in Ruby Sketchup Programmatic Union of Multiple items:

      @Dan-Rathbun
      How to check if @union become nil?

      To check if the reference points at nil, you can use:
      @union.nil? which is inherited by Array from Object#nil?

      To check if the array is empty, you can use:
      @union.empty?

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: [Plugin] AMS Library 3.7.1b (29 May 2021)

      @rcatedra I myself do not use this library. So, I cannot say for sure.

      But the error given is that the module does not respond to a method named "key".

      If it did respond to this method in the past under older SketchUp versions, then the reason for SU2024 is that an error during loading prevented the module code from defining its methods.

      posted in Plugins
      Dan RathbunD
      Dan Rathbun
    • RE: NEW Forum Software Issues

      @TIG Good to know. (I did not see mention of the issue.)

      posted in Ideas Box & Board Issues
      Dan RathbunD
      Dan Rathbun
    • RE: NEW Forum Software Issues

      The migration to the new software has broken all the code snippets (both inline and code blocks.)

      Punctuation characters have been replaced with HTML Character entity codes.


      So, this new forum uses markdown instead of bbCode ?

      posted in Ideas Box & Board Issues
      Dan RathbunD
      Dan Rathbun
    • RE: [Plugin] AMS Library 3.7.1b (29 May 2021)

      FYI, SketchUp has migrated to using the Qt GUI framework libraries. So, in many cases it is no longer possible to use the Windows SDK system calls to tweak SketchUp interface objects.

      posted in Plugins
      Dan RathbunD
      Dan Rathbun
    • RE: Edit_transform not available in the C-API?

      The C API is mainly written to act upon files.
      There is only some limited things you can do with "live" models.
      Currently, the C API cannot be used to modify the active model.


      You can get the active edit path via: SUModelGetActivePath()
      ... and from it the transform via: SUInstancePathGetTransform()

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: [code] extract png thumbnail image from .skp file

      @jkoll66 said:

      I know this post is like a thousand years old, but I was using the "extract_png.rb" from "Jim". It doesn't seem to work in SU2023. I need this to compile a catalogue of all of my components. Is there an updated version out there somewhere? I really need this. Thanks in advance!

      If you are doing this from within SketchUp, try something like:

      
      # SketchUp 2015 or later.
      def export_thumbnails(source_path = nil, dest_path = nil)
        #
        unless source_path && File.directory?(source_path)
          models = Sketchup.active_model.path
          if models.empty?
            models = File.join(ENV['HOME'], 'Documents')
          end
          #
          source_path = UI.select_directory(
            title; "Select Model Directory",
            directory; models
          )
          return unless source_path
        end
        #
        unless dest_path && File.directory?(dest_path)
          images = Sketchup.active_model.path
          images = source_path if images.empty?
          #
          dest_path = UI.select_directory(
            title; "Select Image Output Directory",
            directory; images
          )
          return unless dest_path
        end
        #
        Dir.glob( '*.skp', base; source_path ) do |skp|
          source_file = File.join(source_path, skp)
          image_file  = skp.split('.')[0] << '.png'
          output_file = File.join( dest_path, image_file )
          Sketchup.save_thumbnail(source_file, output_file)
        end # Dir loop
        #
      end ###
      
      
      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: How to retrieve the structure of instance up to model?

      @areal3d said:

      hello,
      how can i get the whole path as in the pickhelper from a selected instance?

      You will either need to build an InstancePath as you drill down or get the Model.active_path and add the selected instance to it.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: How to retrieve the structure of instance up to model?

      @areal3d said:

      hello,
      ... now when I iterate thru entities of a certain instance and want to get the parent, i do not get the higher INSTANCE, but the DEFINITION LIST.

      Instances do not have Entities collections. Only definitions and the top-level model have an Entities collection.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Ruby and special characters

      @tig said:

      In the very first line of your Ruby RB file add this.

      # encoding; UTF-8
      

      This should ensure your own code is properly formatted.

      This magic comment does not ensure that the code file is saved as UTF-8 w/o BOM.
      This must be set in whatever code editor is being used.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Defining position of input box created via ruby

      @areal3d said:

      is there any way to controll the position of the ruby inputbox on the screen,
      just to put it a bit away from the center of the screen?

      Sorry, Stan. NO the UI.inputbox method always centers the dialog.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: [Plugin] Multiple Component Edit Warning

      @tig said:

      I'm not sure if the author Ash is still about... However, it's easy to fix the error - ...

      Note the two additions of .dup code, which copy the 'frozen-string' in the module's name and use that instead, as a frozen-string cannot now be directly changed in code, without this sidestepping...

      I just noticed this as I'm not over here at SCF much these days.

      It was I who wrote this extension for Ash, long before the frozen string madness.

      I did not realize that Module::nesting[i].name, ... actually Module#name returned a frozen string. Even the Ruby v2.7.2 documentation does not indicate this. (Doesn't indicate much of anything really.)

      But it does make sense that all the class and module identifier strings would be frozen (likely linked to symbols.) I went back to v2.2.4 in SU2017 and repeatedly called #name on a module object and got a different string object and id each time called. (Not very efficient.)
      The same test in latest version returns the same object, with the same id, each time called.

      I've not been running into it as I suppose I've not been using String append ( <<) much because of the gotchas like this.

      I'm more inclined these days to use interpolation like:
      LOAD_TAG = "#{Module.nesting[0].name}:#{File.basename(__FILE__)}"
      ... which itself creates a new string.

      BTW ... the second assignment to OPT_KEY does not need the .dup as .gsub makes the copy. (Verified in Ruby 2.7.7 with SketchUp 2023.)

      posted in Plugins
      Dan RathbunD
      Dan Rathbun
    • RE: [Plugin] VisTools v1.3.4

      @socolavn95 said:

      Any update or plugins similar to this. It seems that Isolate function does not work well with SU 2017~

      I was actually working on an update back in 2016, but never published it. I'm unsure if I ever finished the intended work on it.

      This was 5 years before the addition of the Tags/Layers folder feature.

      There is a newer version of this extension by another coder, but their edition did not properly namespace their code (with their own namespace module) so it will clash with mine if I publish my updates.

      @haymaker said:

      I would like to be able to do the same thing with the 'isolate' and 'hide tags' button, however the 'show all in context' does not restore the tag profile you had before isolating them. Am I missing something here? ... Is it possible to add a button to restore the previous tag setting? this would make an awesome plugin a game changer.

      As said above, I've not been into the code for this extension in ~7 years. I am currently working on another layer/tag control extension that will be commercial (for a small fee.) I might fold some of the old features from this extension into the new extension. (I dislike a bunch of little extensions with "nitty" features. I prefer to bundle these various "nitty" features together into a single "themed" extension.

      posted in Plugins
      Dan RathbunD
      Dan Rathbun
    • RE: Group from slice in Ruby

      I logged this as an API Feature Request back in JAN 2019 ...

      Link Preview Image
      Create Group from Slice (Section Plane) ยท Issue #189 ยท SketchUp/api-issue-tracker

      SketchUp Ruby API Feature Request Please expose the internal method from the section plane right-click context menu, to create "Create Group from Slice". (Repeatedly asked for in the forums over the years. Currently hacky platform depend...

      favicon

      GitHub (github.com)

      Also a request to export a slice from Ruby ...

      Link Preview Image
      Sketchup::SectionPlane#export_slice ยท Issue #406 ยท SketchUp/api-issue-tracker

      API Feature Request Please implement an API method to expose the native GUI feature via File > Export > Section Slice... And allow any section plane to be exported. (The GUI command seems to only become enabled when a top level section p...

      favicon

      GitHub (github.com)

      posted in SketchUp Feature Requests
      Dan RathbunD
      Dan Rathbun
    • RE: Get coordinates of nested components

      @fredo6 said:

      For instance, if you pick interactively the nested component, the PickHelper will give you the chain of grouponents.

      Expanding upon this use of the PickHelper class ...

      This is using the Sketchup::PickHelper#path_at() method. It returns the instance path from the active entities context (for the given index in the list of pick paths.)

      To get the full path, you will need to add the pick path to the model's active edit path (if it is not nil.)

      
      edit_path = model.active_path ? model.active_path ; []
      full_path = edit_path + pick_path
      
      

      Then, you can use a little known method in the InstancePath class to get the transformation ...

      
      ipath = Sketchup;;InstancePath.new(full_path)
      trans = ipath.transformation
      
      

      See: Sketchup::InstancePath#transformation

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: How to move a group

      @mr_creator said:

      Next I need to move everything to the origin of global coordinates.

      
      group1 = entities.add_group
      
      

      This line of code will create a new group at the origin of entities. If this is the top level model's entities, then this is the global origin. If it is some other component's or group's entities, then it is their local origin.

      @mr_creator said:

      group1.transformation.origin have zero coordinates, but group1 is not at zero.

      This confirms then that group1's origin is at the origin of the active edit context's origin.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Alarm for V-ray (SOLVED)

      Just a note that calling the == method with a true or false argument for a Boolean conditional expression is considered poor practice.

      Ie, ...
      if VRay::LiveScene.active.rendering? == false
      ... it is completely unnecessary to make a method call here as the Vray::LiveScene method calls return a Boolean result and the interpreters if evaluates the Boolean expression.

      So the interpreter must evaluate an extra expression that is either:
      false == false or true == false

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Best practices for creating an rbe

      If you are having issues with Trimble's signing portal, then the best place to ask is:

      • SketchUp forums: Developers > Extension Warehouse for Developers
        .. or the main developers forum:

      • SketchUp forums: Developers

      ThomThom And Julia monitor those forum categories and should be quick to answer (if the question and answer has not already been posted previously, which might often be the case.)

      Also see newer help pages:

      • Developing Extensions for Extension Warehouse

      • Extension Signing and Encryption

      • Extension Development Best Practices


      That said, the Ruby core Kernel#require method cannot load scrambled ( rbs) or encrypted ( rbe) files.

      You must use the API's Sketchup::require module method andyou need to omit the file extension ( .rb, .rbs or .rbe) when you call the SketchupExtension::new class constructor in your extension registrar script.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: [Plugin] SPGears

      UPDATED - NO NEW FEATURES

      Other authors were creating derivative extensions without differencing in a namespace wrapper of their own. This can cause clashing Ruby objects, ie classes. So ...

      The following version preserves MJ Grundman's edition within a namespace module of MJG's own. Some general cleanup, a fix for the inputbox and some error handling for the command. Also made sure that no undo operation is left open as that emits warnings now (if an exception occurs before the operation can be committed.)

      Packed up as a RBZ extension archive.

      Again, ... NO NEW FEATURES, but you can now switch it on and off via SketchUp's Extension Manager or the SketchUcation PluginStore interface.

      NOTE: Remember to delete (or move) the old "SPGears_mjg_v1.2.rb" file from your "Plugins" folder when running the update version.

      ` # v1.3 : 2021-10-26 by Dan Rathbun

      - Properly namespace wrapped and packaged as a RBZ extension archive.

      - General cleanup of indents, extra long lines and empty space lines.

      - Corrected inputbox validation loop in SPGear::dialog().

      * Was calling the same method recursively and not restoring the

      users previous inputs.

      * Was using bad index to validate Bevel Angle results which did

      not cause the inputbox to redisplay allowing error in later code

      when the angle was out of range.`

      .


      MJGrundman_SPGears_v1.3.rbz

      posted in Plugins
      Dan RathbunD
      Dan Rathbun
    • 1
    • 2
    • 3
    • 4
    • 5
    • 245
    • 246
    • 2 / 246