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!
    ⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
    Offline
    • Profile
    • Following 0
    • Followers 1
    • Topics 92
    • Posts 4,904
    • Groups 2

    Posts

    Recent Best Controversial
    • RE: Toogle Dialogs via Ruby?

      @thomthom said:

      Ok - that's toggle.

      aka (Menu) Windows > Show / Hide Dialogs

      @thomthom said:

      ... And is there any way to know if they are hidden or not?

      You CAN get whether the USER has each one set to be shown or hidden thru the registry.
      Ex:
      Sketchup.read_default('SnappyComponents','show',0)==1 ? true : false
      and also whether it's RolledUp or not
      Sketchup.read_default('SnappyComponents','Minimized',0)==1 ? true : false

      EDIT: Nevermind read_default (doesn't work) use the standard Ruby Registry module. Seems Sketchup.read_default cannot handle (or does not return by design,) DWord values in the Registry.
      EDIT2: Fixed: the 'show' attributes are all downcase.

      IF attribute 'Show' is 0, the dialog is hidden no matter what the (global) "Show/Hide Dialogs" toggle setting is.
      IF the dialog is 'rolled-up', AND shown (on screen) it's 'Minimized' attribute is 1 AND 'show' is 1.
      When you close the 'Minimized' dialog, it's attributes are 'Minimized'=1 and 'show'=0.
      When a closed 'Minimized' dialog is re-shown (Same session, or new session,) the 'Minimized' attribute is changed to 0 because Sketchup auto-unrolls it, and the 'show' attribute = 1.

      But I cannot find a way to know (cross-platform) whether the (Show/Hide Dialogs) Menu item is checked or not. Of course we can do it using Win32API call. When the dialogs are globally Hidden their 'Show' registry attributes remain unchanged, and the Show/Hide toggle is reset (all dialogs are shown per registry settings,) when you reopen Sketchup.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Idea: show console on script error

      ThomThom tells me UI.start_timer will not wait at all, if I set the time to anything less than 1 second.

      So change the code above to 1.0 instead of 0.5

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Thumbnail Checkbox / Model.name / Model.tags

      @dan rathbun said:

      It would be better (or more natural) if the 'Redefine Thumbnail(s) on Save' checkbox, was located on the 'General' page, in the 'Saving' section, of the 'Preferences' Dialog (ie: it would/should be a global setting for all models.)
      I understand as it is now, redefine Thumbnail on Save is a per-model setting.

      (1) I would like to override this globally (and perhaps temporarily,) withoutchanging the setting within the model.

      (2) I WISH for a global setting that defines a Scene (Page) name, and if the model has a page so named, the built-in Save command would use THAT scene AND it's camera location, to create the thumbnail that is stored with the model, INSTEAD of the current view.

      (3) This might be combined with a user setting at the model level, for a thumbnail scene (page).

      Currently I have to write my own command to do this... but if I forget and click the normal Save button (or Use File > Save on the Menu,) the thumbnail will get overridden by the current page, which will be 'Working' or some other Scene page.

      posted in SketchUp Feature Requests
      Dan RathbunD
      Dan Rathbun
    • RE: API Docs Comments

      @martinrinehart said:

      I just posted a comment re the correct args to WebDialog.new(). Do others get it?

      I can see it. I posted a follow up (You forgot the 9th arg; and I also noted the identifier differences for two args, the 1st and 3rd, when using a Hash.) I also noted the Hash key error, Symbol vs String.

      @unknownuser said:

      New notes should be posted directly to the api site. That way folks visiting the docs can see them immediately and can vote on the most helpful ones.

      Anyway.. I've posted 3 times, and I now have a 'feel' for how this feature works. I HATE IT!

      • FIELD size limit (with no warning)* NO formatting (bold, italic, uline, font color & size, etc.)* NO code blocks* Reverse posting Order* NO post Subject (Subject is poster's Name)* NO Search feature such as we have here at SCF.* NO edit, if we mis-spell or leave out a parenthesis.* NO automatic quoting* NO bulleted or numbered lists.* NO inserting images to make a point or show a bug
        Why would we possibly wish to leave behind all these features we enjoy now at SCF, and switch to a 'plain-Jane' textbox slapped at the bottom of a webpage?
        Google you can do better! Google you HAVE done better!

      Voting, is meaningless! It's just a subjective emotional responce with no technical usefulness. (But if your a bleeding-heart Liberal, I'm sure it makes you feel all warm and cozy.) 🀒

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: New API doc - typos and questions

      @thomthom said:

      How about - when the issues from this thread has been addressed we lock and unstick it?

      (I can move some posts around later on.)

      I can move my suggestions over to the 'API WishList' thread. It seemed easier to voice them at the time I noticed the errors (I always added them after stating the errors in a different color.)

      But I can understand how all the extra 'noise' makes using the thread as a checklist difficult for the GSUPT (Google Sketchup Product Team.)

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: New API doc - typos and questions

      @unknownuser said:

      As soon as we close out the issues in this thread, I will remove it from the forums.

      Don't you dare! This thread was started by ThomThom.

      (1) It is more than just Errors to fix in the API docs.

      • It has ideas about making the API Docs themselves better.* It has some sample code postings.* It has some Example code (incl. one posted by you yourself Scott regarding Materials Observer,) that would be lost if the entire thread was to be deleted.* It has some suggestions for new API features (new methods, etc.) [that need to be moved to some other thread first; I think there's a hard to find API WishList somewhere.]* It has some Questions posed (some of which have never been answered,) whose answers are not really content that actually will go into the API Programmer's Reference, but are of interest.
        (2) The Error postings are(to"we the customers",) a record of date and time, that an error or omission was logged.

      • As it was supposed to work, you were given Moderator rights, on the promise that you would MARK the Error posts, when they were fixed (bold Green with date.)* This would then give "we" the idea of the responce time the GSUPT in attending to these errors. Any customer, in any business sector should expect no less. Any Company or Business should expect to be judged on the basis of their past performance. (Unless of course, if your Toyota.) πŸ˜’* I can see only a couple, of 'fixed marks' in the whole thread. YES, we understand your busy, etc., but Jim and others had offered to do the 'marking' for you. You, however, insisted that it would be easier for you to mark them yourself.* I feel the record should stand, and I don't care who marks them; but those fixed should be marked as such.
        (3)I understand wanting to start fresh for the next API Revision, BUT...

      • If there was a Revision / Issue number on the API documents page(s) we would be able to correlate the Error threads HERE (on SCF,) with the doc pages over on code.google.com

      • THEN whenever you push an update, we can retire a thread here and start a new one for the next Revision.
        (4) In order to help make this work better in the future:

      • We need to stop being lazy, and post ONLYErrors to the API Error threads.* Post API Suggestions to the API WishList (me guilty!) 😳 * Post API Docs Discussions to the API Comments thread Remus just started.* We need to discuss the issue of whether a feature or method behavior is or is not an error, in a separate thread (it's own or the Discussion thread,) and then only when the issue is identified as a error, post a 'action item' in the current API Error thread.* The current API Error thread's title needs to be marked [current].* Retired API Error threads should be re-labeled [closed].* (Each API Error thread start post should have a standardized list similar to the 6 bullet items above, along with the current API Docs Revision / Issue number at the top.)

      @ThomThom: So, of course this means this whole post should be moved to the Discussion thread. (Everything from ThomThom's "whoa!" post on down.)

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: API Docs Comments

      @remus said:

      The ability to add comments at the bottom of each class page has been added:
      Note it is only per class and not per method.

      I noticed that yesterday for the first time (and thot perhaps it had always been there, and noone has ever noticed, or bothered to post.)

      (1) I think it's nearly useless way down at the bottom (ie: not many people will notice.) Per Class/Module comments are OK, but if (since they are a major SECTION headed "User Notes") there aught to be a link at the top of the page along with "Introduction" and "Methods".

      (2) There is no username input field. This raises the question whether the feature is really a PUBLIC comment feature (where others can also read your posts.) OR whether it's a PRIVATE per user Note feature (where I make reminder notes for only my own private use.) The title "User Notes" would suggest the latter rather than the former.

      (3) I'd prefer and encourage (in addition to Class/Module comments,) collapsable per method comments (MSDN has always had these,) WITH collapsable Topic sub branches: [Corrections, Bugs(by SU ver), Exceptions, SampleCode, Tips&Tricks, Misc, WishList*]

      • Method Level:( Desired Changes to the method ) / Class or Module Level:( Suggestions for new methods, constants, attributes, etc.)
        When a reader is interested in a specific method, why make them go way down to the bottom of the page, and pick through (what may be in the future,) a multitude of non-sorted comments. The Sketchup module page, with it's high number of methods, is likely to get 'very busy' with comments.

      (4) While we're on the subject of collapsable API page features: ALL major SECTIONs should be collapsable (ie: "Introduction", "Methods", "Class/Module Comments" ..etc..)

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: By value or by reference?

      @thomthom said:

      @unknownuser said:

      see also The Ruby programming language By David Flanagan, Yukihiro Matsumoto

      Interesting link. I think I need to read further into that book.

      No Kidding! Yukihiro Matsumoto is "Matz" the inventor of Ruby! πŸ€“

      I didn't know Google Books had this. πŸ‘

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: By value or by reference?

      @thomthom said:

      Well, if .to_a is faster ...

      .to_a is 1 less char to type than .clone πŸ˜†

      .. and itwillcreate a new Array object, and since the GSUT extended the Array class with .x, .y, .z etc, it's same same...

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: By value or by reference?

      @thomthom said:

      So using p2 = p1.clone is the proper way to get a copy of a point then?

      Only way if you keep it a Point3d. If you convert to Array, then you have the real 'proper' .dupand .clonethat are inherited correctly from Object.

      The Geom::Point3ddid inherit .dupbut it does not work, it returns nil.
      And Google overrode the standard .clone, and the new one does not pass on taintedness and frozen state correctly.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: By value or by reference?

      @thomthom said:

      Why do[es] ... Point3d [differ?]

      def m4(p); p.x = 99; end

      ` > n = Geom::Point3d.new(1,2,3)
      Point3d(1, 2, 3)

      m4(n)
      99
      n
      Point3d(99, 2, 3)`
      And now it does change...

      Apples and Oranges.

      In this case, your calling a 'method operator' ie: Geom::Point3d.x= that happens to have a '=' character in the method name. It's not the same as the Ruby hard-coded = operator.

      Your getting confused because the interpreter allows you to insert a space into the method call.

      Also.. Geom::Point3d.x= is more similar to String.<<, in that the method doesn't replace an entire object, it only modifies part of the object.
      Specifically, Geom::Point3d.x= is an attribute setter method, involving Numerics, so no temporary Integer, and p is still pointing at the same object n is, so naturally, yes the common object gets modified.

      Since Geom::Point3d has no dup method, you'll have to use clone to create a copy.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: By value or by reference?

      @thomthom said:

      Ok, but what about this one?
      ` > x = 'foo'
      foo

      def m3(a); a = 'bar'; end
      nil
      m3(x)
      bar
      x
      foo`

      ..the above, is the same as:
      @thomthom said:

      ` def m3(a); a += 'bar'; end

      x = 'foo'
      foo
      m3(x)
      foobar
      x
      foo`
      .. with respect to that:

      (1) the reference a, is at method start, pointing at the same string object 'foo' that the reference x is pointing at; ..and

      (2) then the expression on the right of the '=', in both cases, results in the creation of a new string object by Ruby.
      ..(a) In case 1, Ruby calls String.new('bar') (we'll call it: newbarstr.)
      ..(b) In case 2, Ruby first expands a += 'bar', into a = a + 'bar', then (as in case 1,) evaluates the right-hand expression, transparently passing literal string args to String.new, keeping track of the anonymous pointers to the new string objects. In this example there is only one (we'll call it newbarstr.) Then, it calls a.+(newbarstr) which is the string concatenation method, that returns yet another new string object created by Ruby (we'll call it foobarstr, but remember Ruby uses temporary numerical identifiers.) So at this point the right-hand expression is now done and set to temp string object foobarstr.

      (3) NOW.. both cases make a REFERENCE assignment, which assigns the reference a to point at the new String objects created from their evaluations.

      (4) Lacking any specific return expression, the method returns the last result, which is the value of the object that a was made to point at, which is NOT the object 'foo'.

      (5) Since the method call was made "stand-alone" and it's result not referenced, when the method exits, a will disposed of by Garbage Collection, along with any temporary objects Ruby used within the method.

      (6) .. all that's left, is reference x pointing at poor 'lil string object 'foo'.

      += vs. <<
      Looking back at (2)(b) above, and realizing all the work that is going on, and string objects being created, just to glue two substrings together.. we should all want to use << (the String append method,) instead.
      The main reason is, that it only creates one temporary string, IF the argument is a literal; otherwise NO temporary string, IF the argument is a reference to an existing string object.
      String.<< instead directly modifies the receiver string object by appending the string argument object onto it.

      Bottom line: Free Your Ruby Mind !! πŸ’­
      Throw away the word 'variable' and think 'reference'.
      $reference, global_reference, local_reference, instance_reference, @reference, class_reference, @@reference, module_reference ... reference, Reference, REFERENCE !

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: New API doc - typos and questions

      API - Release Notes webpage error
      http://code.google.com/apis/sketchup/docs/releases.html

      The H2 Heading "What's new in SketchUp 7" is not displayed as a H2 heading.

      The error is caused by a missing '>' (greaterthan character) on the end of the preceeding <P> element closing tag, which is now: '</P'
      ie, snippit from current HTML source (line 378):

      ` %(#804000)[<p class="post">Β </p

      <h2>What's new in SketchUp 7</h2>]`

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: New API doc - typos and questions

      UI::WebDialog.write_image
      http://code.google.com/apis/sketchup/docs/ourdoc/webdialog.html#write_image

      @unknownuser said:

      The write_image method is used to grab a portion of the screen and save the image to the given file path.
      Arguments: **> %(#000000)[*image_path*]%(#E0E0E0)[______]%(#000000)[The destination path of the saved image. *top_left_x*]%(#E0E0E0)[______]%(#000000)[The x coordinate of the upper left] %(#E0E0E0)[__________________]%(#000000)[corner of the region to grab. *top_left_y*]%(#E0E0E0)[______]%(#000000)[The]%(#EF4000)[**x**]%(#000000)[coordinate of the upper left] %(#E0E0E0)[__________________]%(#000000)[corner of the region to grab. *bottom_right_x*]%(#E0E0E0)[__]%(#000000)[The x coordinate of the lower right] %(#E0E0E0)[__________________]%(#000000)[corner of the region to grab. *bottom_right_y*]%(#E0E0E0)[__]%(#000000)[The]%(#EF4000)[**x**]%(#000000)[coordinate of the lower right corner] %(#E0E0E0)[__________________]%(#000000)[of the region to grab.] **
      %(#EF4000)[(1) The y coordinate arguments should read 'y' and not 'x'.

      (2) The coordinates are relative (in the curent implementation,) to the origin of the webdialog's client area, not the screen origin.

      (3) The top_left_x and top_left_y arguments APPEAR to work (and also default to 0,0 of the client area.)
      BUG: The bottom_right_x and bottom_right_y arguments SEEM to always get set to top_left_x**+clientareawidth and top_right_y+**clientareaheight. Changing (specifying) these 4th and 5th arguments SEEMS to have no effect (at least on PC.)

      (4) So.. although omitted from the API, only the 1st argument is necessary. Simply specifying a file (of the imagetype desired,) produces an image of the WebDialog client area, by default.]

      FUTURE:

      (a) It is more intuitive, if the 4th and 5th arguments are just widthand heightoffsets from the top_x and top_y (respectively.)

      (b) I would like a 6th argument origin which would need to default to 'client', with the optional setting 'screen' so we can grab an image of the entire WebDialog (including frame and captionbar, etc.)

      • The top_x and top_y arguments should then default to the WebDialog's topleft xy screen position.* The 4th and 5th arguments should be width and height offsets, from the 2nd and 3rd arguments; and should default to the WebDialogs entire window width and height.* Coders should be able to increase the grabarea to perhaps include portions of other windows on the screen (which may be other dialogs or part of the Sketchup viewport. This may be for tutorial use or to show a result in SU, given a setting in a webdialog (such as when reporting a bug to a plugin developer.)
        (c) Because WebDialogs, are movable, and often resizable, it would be good to have WebDialog instance methods to get the current screen position, current total size, current client size as two-element arrays, which can be used to pass arguments into write_image or any other method.

      UPDATE: Just noticed that there are two undocumented methods that can satisfy the need for current total webdialog size. [url=http://forums.sketchucation.com/viewtopic.php?f=180&t=17047&p=230668#p230668:8pzn7g4t]See my next post...[/url:8pzn7g4t]
      _

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: New API doc - typos and questions

      UI::WebDialog
      http://code.google.com/apis/sketchup/docs/ourdoc/webdialog.html

      The following methods need to be documented:

      %(#BF0000)[last_height
      last_height=
      last_width
      last_width=]

      We are also still wishing to know what the extra Mac parameter for WebDialog.new is for, ie:
      :mac_only_use_nswindow = boolean
      What's the difference? ... and what's the default?

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Sketchup registry key ?

      @jim said:

      Does there exist some sort of .zip installer?

      As I recall, WinZip could create self-extracing archives (.exe extension,) with a 'suggested destination folder'. When run, a confirm dialog popus up, allowing the user to override with a browse button, or simply edit the destination path in the edit control box.
      Still in use today, but I believe is a pay WinZip Pro version that only will do this.

      Cabinet files (.CAB) are free and native to Windows, I believe at least the extract exe is installed on all Win32 machines; the cab maker (filename slips my mind,) is in the SupportTools package. BTW, MSIs use cab by default I believe.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Sketchup registry key ?

      @jim said:

      What is a MSI, how it it different/better than what is made by Inno for example?

      An 'MSI' is a nickname used for Microsoft Installer packages, the acronym for THE Microsoft Installer (aka the Windows Installer,) and also the file extension of the MS Installer database that is created with the MSI. These databases you will have seen with numbered filenames, are placed in the %SystemRoot%\Installer (hidden) folder.
      The MSI can also create .MSP files, which are Windows Installer Patch files.

      Different: I downloaded the MSI SDK a few years ago, and started to learn it, but after a half hour, I gave up. It is extrememly complex (or perhaps it's Microsoft's way of confusing documentation and terminology.) It does not have package wizards like Inno. You have to use setup style scripts, and multiple tools (it's a multistep process.)

      I looked at some of the install package applications out there such as the Wise Installer and InstallShield, but the price was in outerspace! (like thousands of dollars.)

      I intend, if I have a complex package, to use Inno.
      I downloaded a SketchupInstaller.iss template for Inno, that looks so simple, I just am itchin' to try it out.

      Yes, the Nullsoft NSIS is an alternative.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Timer &lt; 1.0 seconds ?

      @thomthom said:

      I'm just trying to run a piece of code 0.5 seconds later without blocking other code. (plus - I want to be able to cancel the timer under certain conditions before it triggers.)

      Same, Same, for me.

      It's kinda butt-backwards to what timeout.rb(from the standard library) does.

      The timeout block method begins execution immediately, concurrent with it's timer. If the block terminates before the timeout period (it's timer runs out,) then the method returns true. If the timeout is reached before the block code finishes, a TimeoutError exception is raised.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: By value or by reference?

      @thomthom said:

      a += 'bar'

      Just a quick note about += for String objects.

      (We also discussed this in another thread.) %(#4040BF)[EDIT ( πŸ˜• got confused for a min; removed previous statement.)]
      My advice is, for less confusion, use the proper String append operator: (It's the same work for typing!)
      a << 'bar'

      ADD: IMHO, the interpreter should raise a SyntaxError when it sees += for Strings. I wonder if a Warning is output?
      UPDATE: No, I tested += with $VERBOSE set to true, and no warning is output.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: By value or by reference?

      @thomthom said:

      Why do these two things differ: I pass a string to a method and modify the string:
      def m3(a); a += 'bar'; end
      (from the Ruby 'Pick-Axe' book):
      str + aString -> aNewString
      + Concatenation---Returns a new String containing aString concatenated to str.

      @thomthom said:

      ` > x = 'foo'
      foo

      m3(x)
      foobar
      x
      foo`
      ...and the string outside the method is not changed.

      Because 'foobar' is the new string object that was transparently constructed with String.new by Ruby.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • 1 / 1