sketchucation logo sketchucation
    • Login
    1. Home
    2. Dan Rathbun
    3. Posts
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    Check out Febhouse | New extensions for Shadow Analysis in SketchUp Download
    Dan RathbunD Offline
    • Profile
    • Following 0
    • Followers 1
    • Topics 92
    • Posts 4,904
    • Groups 2

    Posts

    Recent Best Controversial
    • RE: [Plugin] VisTools

      @josephkim626 said:

      what, I didn't know you speak korean Dan.

      I don't. I used Google Translator and Bing Translator. I have no idea if my translations are cussing a ppl, or not.

      @josephkim626 said:

      I don't mind helping out the language review, but I want to avoid installing another version of SketchUp in Korean.

      You can load the files in a code editor.
      I use Notepad++ on Windows.
      The files must be saved in UTF-8 encoding.

      The Vistools loader ruby in the "Plugins" folder has the descriptions in it, and the korean setting is this:
      @@plugin.description = %q{VisTools:(비전 도구) 몇 가지 유용한 엔터티를 추가 하 고 표시 도구에 Sketchup 에서 레이어: 숨기기, 표시, 동결 및 해 동}

      In the plugins' folder is a " VisTools_ko.rb" file with the other UI strings which looks like:

      # encoding; UTF-8
      #
      #  THIS FILE MUST BE SAVED IN ENCODING;  "UTF-8 WITHOUT BOM"
      #
      module IntrepidBear  # <--<< Dana Woodman's proprietary toplevel namespace
      
        module VisTools    # <--<< THIS plugin's nested namespace
      
          #{# MODULE VARIABLE LANGUAGE HASHES
          #
            # --====  KOREAN  ====-- #
      
            @@menutext = Hash[
              ;plugin_name,      "비전 도구",
              #
              ;hide_layers,      "레이어 숨기기",
              ;isolate_layers,   "분리 레이어",
              ;hide_entities,    "엔티티 숨기기",
              ;isolate_entities, "엔터티를 분리",
              ;freeze_entities,  "고정 그룹 및 구성 요소",
              ;unfreeze_all,     "고정 취소 모두",
              ;show_all,         "모두 표시",
              #
              ;debug_mode,       "디버그 모드"
            ]
      
            @@tooltips = Hash[
              ;hide_layers,      "선택한 레이어 숨기기",
              ;isolate_layers,   "선택 된 도면층 분리",
              ;hide_entities,    "선택한 엔티티 숨기기",
              ;isolate_entities, "선택 된 엔터티가 분리",
              ;freeze_entities,  "그룹 및 구성 요소 동결",
              ;unfreeze_all,     "모두 고정 취소",
              ;show_all,         "모든 레이어 및 엔터티 보기"
            ]
          #
          #}#
      
        end # module VisTools
      
      end # module IntrepidBear
      
      posted in Plugins
      Dan RathbunD
      Dan Rathbun
    • RE: Texture from url?

      When a image is loaded as a web page resource, it is present in the "Temporary Internet files" folder. But some security settings might prevent the copying of a file from there to a trusted local folder.

      Anyway:
      require "FileUtils"

      then try the copy method.

      See: http://ruby-doc.org/stdlib-2.0.0/libdoc/fileutils/rdoc/index.html

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Savepanel - file formats?

      FYI: Back in Jan, Jim brought up this limitation in the OEM forum, and Thomas responded that neither panels functions are coded correctly (Jim filed a bug,) and cannot take both a filename and a typelist.
      http://forums.sketchup.com/t/openpanel-and-savepanel/5489

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Savepanel - file formats?

      @tig said:

      The final argument for UI.savepanel is NOT a file_type list [that's UI.openpanel's, it's the default file_name.

      This is NOT true. (EDIT: Well, it's not and it is. Ie, it should be possible according to Microsoft, but isn't because it has never been implemented correctly for the SketchUp API. See rest of discussion.)

      UI.openpanel and UI.savepanel do the exact same thing, except the window caption and action button text is either, "Open" or "Save".
      (With the added feature that if a existing file is chosen in the save dialog, a confirmation to overwrite the file will popup. Choosing "No" returns to the save dialog. A pathstring is not returned until "Yes" is chosen in the confirmation popup.)

      Yes, the API documentation for UI.savepanel is way past need to correction. It has been pointed out to the API team multiple times.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Savepanel - file formats?

      The last thing I want to add to the discussion, is that the filetype filtering is always supposed to work to filter the list of files displayed in the dialog's file listing. (That goes for both save and open.)

      The save dialog is often used to select an existing file to overwrite with confirmation. (This is why list filtering by filetype is valid.)
      My personal rule of thumb is also to always add a "ALL files (.)" filter.

      EDIT: The user could (whenever they wish) override the chosen filetype by manually adding a file extension.
      (WAS: The user should always override the chosen filetype by manually adding a file extension.)

      If no extension is typed, the chosen file type filter is supposed to be added to the filename. (Which the SketchUp API does NOT currently do.)

      But the SketchUp API does not follow standard WinAPI conventions (I think because it was written originally by Mac guys.)

      So, the pathstring, the filetype filter and the filename should all be separate parameters for maximum power (flexibility.) Having an either/or filename or filetype parameter takes away flexibility.

      So yes, until it is fixed (if ever,) ... using it (3rd param) as a filename might be best for the Save.

      This means boma would need to test the result for a "." and an extension, and if not, call a simple UI.inputbox to prompt for image type.

      
      ftype = UI.inputbox(["choose..."],["PNG"],["JPG|PNG|BMP"],"Image Type").first
      
      
      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Savepanel - file formats?

      Oh, I forgot to add that you can use Notepad++ to see how they really should act properly.

      Make a junk text file, and play with the SaveAs dialog.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Savepanel - file formats?

      The main point I am making, is that under the hood, they both call the same Windows API common dialog function.

      @tig said:

      But what's the use of giving a default set of file_types with UI.savepanel - they are ignored ...

      No they are not,.. not entirely.

      They all appear in the filetype dropdown list. AND whichever is selected, serves to filter the directory listing for the current path location. So it partially works.

      @tig said:

      and NO default name appears at all.

      Didn't say it worked perfectly. In fact I consider it bugged.

      @tig said:

      Passing a 'filter' doesn't work anyway, as then entering " xxx" - with no file_type - it accepts it as being valid.

      Yep,.. the user can override any filename or filetype suggestion, by picking a current file, or by manually typing anything into the filename box.

      @tig said:

      At least if you pass a file_name, them it'll be displayed, and you are more likely to change the name and retain the file_type...p/quote]
      This is more of a "best practices" argument.

      @tig said:

      I just retested it [v2016] and if you give the default file_name as ".png" that is is displayed, but it is also accepted when NOT prefixed with a name [plain silly], ...

      Agree, there should be better testing.

      @tig said:

      ... you cannot offer multiple file_type choices [unlike UI.openpanel] - as the "|" is not a valid character in a file_name, ...
      So as I see it, you should pass a valid file_name and the user chooses one [you test their result for compliance]...

      Your making an argument of your preferred "best practice". It might apply if the scenario is such that YOU know the filetype would be say SKP.

      But in the example we are speaking of, boma gave a scenario where he wants the user to type a filename, and choose one of the image filetypes given in the filter. Then expected the chosen extension to be appended to the filename. (I would also.)

      But it is bugged.

      @tig said:

      @Dan
      Perhaps I am missing something ?
      How would you use a file_type filter in UI.savepanel AND pass a default file_name ?

      Well, as the methods are currently written, you do not. When savepanel gets fixed, You do one or the other, but not both.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: [New scripter] Will need help on my project (now and then)

      @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.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Plugin load residue, ruby

      I see two (2) issues.

      Ruby uses $name for global variables. Having dollar sign in the filename may confuse the Ruby interpreter.
      If you must use the dollar sign character within a string, escape it like this:
      "somewhere in here \$ there is a dollar sign".

      Second, Ruby tries to expand the tilde character (~) in strings, into the user's home directory path. (ie: ENV["HOME"]) This may be causing the "can't find user" error message.
      If you must use the tilde character within a string, escape it like this:
      "somewhere in here \~ there is a tilde".

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: [Code] wrapping operations

      @francis mc shane said:

      Dan,
      thanks for this. It works. I don't know why though!

      Link Preview Image
      File: exceptions.rdoc [Ruby 2.0.0]

      favicon

      (ruby-doc.org)

      Ya should probably read the docs on page
      http://ruby-doc.org/core-2.0.0/index.html
      from "doc/syntax.rdoc" on down. There is only 11.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Backgrounds in images in 3D warehouse

      @al hart said:

      I "fixed" it be downloading the 3D Warehouse models, turning off the ground plane, setting the background color to white, and then re-uploading them.

      Well, you never said they were YOUR models.

      Of course you are responsible, if you left the ground plane turned on. LOL

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Backgrounds in images in 3D warehouse

      Probably you'll get a faster answer from one of the Trimble Team if you post at:
      http://forums.sketchup.com/c/3d-warehouse

      Those responsible monitor that forum.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Compute Rotation and Scale from Transform Object

      @ruts said:

      @dan rathbun said:

      You realize that this topic thread is like 4 and 1/2 years old ?

      Yes, I have seen it. ... Nothing wrong with that, right?

      I was referring to your asking questions of original posters, who might not remember, or might not even have been active here for some time.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Area class messing up .volume

      ThomThom has an experimental script that defines Area and Volume classes.

      It is on his GitHub site.
      https://github.com/thomthom/SketchUp-Units-and-Locale-Helper

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Compute Rotation and Scale from Transform Object

      You realize that this topic thread is like 4 and 1/2 years old ?

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: [Code] Sketchup.send_action() : Arguments to

      @dan rathbun said:

      Has anyone found a cross-platform string to send the model to Layout ?

      On the PC only this works:
      Sketchup::send_action( 23051 )

      John confirmed that Sketchup::send_action("sendToLayOut:") works on Mac.

      So that gives us a cross-platform method

      <span class="syntaxdefault">def send_active_model_to_layout</span><span class="syntaxkeyword">()<br /></span><span class="syntaxdefault">  return nil unless Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">is_pro</span><span class="syntaxkeyword">?<br /></span><span class="syntaxdefault">  if </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">respond_to</span><span class="syntaxkeyword">?(;</span><span class="syntaxdefault">platform</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">&&<br /></span><span class="syntaxdefault">  Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">platform </span><span class="syntaxkeyword">==</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">;</span><span class="syntaxdefault">platform_win </span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">||<br /></span><span class="syntaxdefault">  RUBY_PLATFORM </span><span class="syntaxkeyword">!~</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">/(</span><span class="syntaxdefault">darwin</span><span class="syntaxkeyword">)/</span><span class="syntaxdefault">i<br />    Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">send_action</span><span class="syntaxkeyword">(</span><span class="syntaxdefault"> 23051 </span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">  else<br />    Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">send_action</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"sendToLayOut;"</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">  end<br />end<br /></span>
      

      EDIT: inserted Pro only bailout statement to return nil if not SketchUp Pro.

      💭

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: [Code] Sketchup.send_action() : Arguments to

      Has anyone found a cross-platform string to send the model to Layout ?

      On the PC only this works:
      Sketchup::send_action( 23051 )

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: SU2013 on tablet : right click ?

      Who is manufacturer of the MPW82CL ?

      Why not the latest SketchUp 2015. It has Ruby 2.0, and many bug fixes. ?

      There are issues with SketchUp 8 and SketchUp 2013, regarding connecting to 3D Warehouse and Extension Warehouse.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Outliner selection not in Order

      You do not need sorted = [], as grep makes a new array, then sort makes another new array.

      Save yourself some grief. Use puts or pp output to the console, rather than UI.messagebox, for testing. ( UI.messagebox can fail silently if the C WinAPI functions do not like the string passed to them.)

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Error: Reference to deleted entities

      @dubai_skyscraper said:

      The initialization in line 930 + 931 looks like this:

      def_screw_thread = def_list.add ("Screw thread") ent_screw_thread = def_screw_thread.entities

      I really thought that looked like a space, between the .add and the ("Screw thread"),...

      It could be a "vacuum" character though. 😆

      P.S.

      are brackets, { } are braces, ( ) are parenthesis.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • 1
    • 2
    • 14
    • 15
    • 16
    • 17
    • 18
    • 245
    • 246
    • 16 / 246