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: Remove and purge hidden components.

      (2) You are wasting time pushing objects into the selection set.
      This is not necessary in order to modify them.

      (3) Instances do not "own" any nested components. Definitions own nested objects.
      So you should be collecting a set of IKEA definitions, and then searching the definitions entities collection(s) (in that set,) for hidden objects.
      When a definition has a child object that is hidden, it will be hidden in ALL of the definition's instances.
      When you delete a hidden object from a definition, ALL of it's instances will have that child object deleted.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Remove and purge hidden components.

      (1) Why are you putting quotes around IKEA ? (The regular expressions are themselves specially treated double quoted strings.)

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Select instances in the selection

      There are some code examples here:

      Link Preview Image
      Selecting Specific Entity, Group or Component (By Name)

      Not sure if it is on the ruby end or if can be done in c. Is there a way to find a specific component in a model by its definition? Also this is from the ruby api. If [0] assumes the first entity, is there a way to get …

      favicon

      SketchUp Community (forums.sketchup.com)

      These examples use the == but you can use regular expressions:
      http://ruby-doc.org/core-2.0.0/Regexp.html

      begins with: =~ /\A#{name}/

      Or the specific string "Handle" at start of string followed by: an optional whitespace character, underscore or dash; followed by a literal pound sign (which I escape just in case);
      followed by an optional whitespace character; followed by one or more digit characters; just before the end of the string:
      =~ /\AHandle(\s|-|_)?\#\s?\d+\z/
      ... and to make it non-case insensitive we can add a "i" switch at the end outside the slashes:
      =~ /\AHandle(\s|-|_)?\#\s?\d+\z/i


      If you are using Ruby 2.0 or higher you can also use the String#start_with?() method:
      http://ruby-doc.org/core-2.0.0/String.html#method-i-start_with-3F

      inst.name.start_with?('Handle')
      ... or for case insensitive convert to a title:
      inst.name.capitalize.start_with?('Handle')

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Dynamic Component Redraw

      Scott Lininger left Trimble/SketchUp several years ago to start his own company. (He is unlikely to see or reply to your question. Ie, this topic thread is at least 7 years old!)

      There are more recent threads on making custom DC functions (but you should not publish any custom changes.)

      See this thread:
      http://sketchucation.com/forums/viewtopic.php?f=180&t=67235

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Enable SketchUp tools

      @TIG The url feature is seriously scrwed!

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Enable SketchUp tools
      model = Sketchup.active_model
      tool = model.select_tool(nil)
      

      https://ruby.sketchup.com/Sketchup/Model.html#select_tool-instance_method

      @unknownuser said:

      The select tool is activated if you pass nil to the select_tool method.


      See this thread as well:
      https://sketchucation.com/forums/viewtopic.php?t=34840


      For SketchUp versions 2016+ they added new methods for window selection that can be used when writing your own Ruby tools:

      https://ruby.sketchup.com/Sketchup/PickHelper.html#window_pick-instance_method

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Trying to set global axis from API

      @ktkoh said:

      So I am trying to align the Global Axes with a face to create a bounding box that matches the face plane. Then reset Global Axes to Default

      It occurs to me that you really want the maximum 2d extents of the face, and really it might best be done virtually rather than modifying the geometry of the model.

      Get the array of vertices in the face's outer loop.
      Iterate that array mapping the vertex positions to a new 2D array.
      (The first vertex should be put at coords 0,0. BTW, you can transform points if you have [or can get] the transformation of the original face. Ie, get the vector from the first vertex to the 2nd and use it to create a transformation for the face if you must.)
      Lastly, get the max X and Y value for the 2D box's height and width.

      Link Preview Image
      Module: Enumerable (Ruby 2.0.0)

      Module : Enumerable - Ruby 2.0.0

      favicon

      (ruby-doc.org)

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Trying to set global axis from API

      @ktkoh said:

      xaxis = Geom;;Vector3d.new(3, 5, 0)
      > yaxis = xaxis * Z_AXIS
      > Sketchup.active_model.axes.set([10,0,0], xaxis, yaxis, Z_AXIS)
      

      when I use this API example I get the error message:
      undefined method ‘axes’ for #Sketchup::Model:0x9815c70

      The Sketchup::Model#axes() method and the Sketchup::Axes object class are only available with SketchUp version 2016 and higher.

      @ktkoh said:

      So I am trying to align the Global Axes with a face to create a bounding box that matches the face plane. Then reset Global Axes to Default

      You can never actually change the global axes. The global origin and axes are always where they are. (They are referenced via global constants ORIGIN, X_AXIS, Y_AXIS, and Z_AXIS. **Do NOT attempt to reassign these constants!**You will only result in confusing other extensions and plugins.)

      The axes method and class changes the drawing axes, which is a temporary user axes that native tools honor, and plugins can honor IF they are written to specifically use the drawing axes. (Extension code will not use the custom drawing axes by default.)

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: HTMLDialog vs WebDialog?

      Basically I'm trying to prompt you to learn how to read Ruby error and backtrace messages.
      “filename:lineNo: inmethod”‘ or “filename:lineNo.”`

      http://ruby-doc.org/core-2.2.4/doc/syntax/exceptions_rdoc.html
      http://ruby-doc.org/core-2.2.4/Exception.html

      @medeek said:

      Okay 95% of that just went over my head, but I'll try and decipher into terms I can understand.

      Link Preview Image
      Data validation - Wikipedia

      favicon

      (en.wikipedia.org)

      An example in Ruby of testing if an object reference is pointing at an object of a certain class:
      if obj.is_a?(NilClass)
      ... or ...
      if obj.is_a?(Float)

      An example in Ruby of validating that an object reference call responds to a certain method call:
      if obj.respond_to?(:methname)
      ... and testing for the "asterisk" method specifically:
      if obj.respond_to?(:*)

      @medeek said:

      But why would this error only be raised for SketchUp running on MacOS and not Windows?

      I don't know (offhand) as I avoid Macs myself. (But OSX and MS Windows use different sets of keycodes.)

      Actually, looking at the backtraces (in your original error listing) the errors are kicked off by a LButtonDown keypress, but are occurring in the `` create_timber_geometry()`' method, lines 1064 and 1355.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: HTMLDialog vs WebDialog?

      @medeek said:

      The error codes posted above.

      ... are occurring (according to your error messages,) in " medeek_roof_truss.rbs", line 5726, in callback method onLButtonDown.

      In the first you are calling a *() method upon an object that is referencing the global singleton nil object. Since the NilClass does not have an "asterisk" method, a NoMethodError is raised.

      The second method is caused by your code expecting a Float object, but getting a String object instead.

      The answer is simple. Whenever an object reference could reference disparate types (classes) of obejcts, use a combination of type validation and Ruby rescue clauses with the onLButtonDown callback method.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Excluding scenes from animation

      @sdmitch said:

      I found this ( view#camera=) in the API but I have yet to get it to be recognized.

      See:
      (SketchUp Developer forum): Setter #view.camera= Testing with Second Transition Time Argument

      @sdmitch said:

      Perhaps it has been removed or never implemented.

      The API docs are a bit confusing.

      The view#camera= method is an overloaded method, which can be used two ways:

      1. with a single Sketchup::Camera object argument

      2. with a single Array argument of: [ Sketchup::Camera, Float ]
        (The Float being the transition time.)

      If you attempt to pass two arguments, of Sketchup::Camera and Float, the API ignores the second (time) argument and you get behavior #1. (Ie, a silent failure from what you'd expect.)

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Excluding scenes from animation

      @sdmitch said:

      I'm still trying to solve the transition problem.

      When you manually change scenes (and the model does not have specific transition and/or delay properties assigned to individual page objects,) then the model's global animation transition and delay settings are used.

      Global settings are via:
      Window > Model Info > Animation

      Global transition and delay is accessible via the model's options provider objects.

      model = Sketchup.active_model
      manager = model.options
      popts = Sketchup.active_model.options["PageOptions"]
      popts.each {|o| puts o }
      #=> ShowTransition
      #=> TransitionTime
      sopts = Sketchup.active_model.options["SlideshowOptions"]
      sopts.each {|o| puts o }
      #=> LoopSlideshow
      #=> SlideTime
      
      

      A per scene page settings interface is not yet implemented, but I think I myself and others have requested it as a PRO feature request. (I believe it should be a Pro only feature myself.)

      You can easily write a script to set per page transition and delay.

      I also think some of the better animation extensions have UI interface to set per scene transition and delay. (I think Smustard's does.)

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: HTMLDialog vs WebDialog?

      Let us know if any of the suggestions work.

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

      (No longer Maintained due to lack of donations.)


      Platform Issues / Differences / Specifics


      Platform Differences

      • Bugs / Issues

      • When do Tools.active_tool_id return 0 ?

      • GUI

      • UI.show_model_info() w/ no args

      • X-Mouse Window Focus for Mac OSX ??

      • Misc.

      • Help with Mac compatibility?

      • Ruby

      • [FAQ] Detect if plugin is running on the Mac vs PC ?

      • Ruby (versions)

      • Sketchup.send_action arguments: Mac vs PC

      • WebDialog

      • WebDialog - hide scrollbars

      • WebDialog (resizing windows)

      • WebDialogs - The Lost Manual — R1 2009NOV09

      • WebDialog set_file

      • WebDialog.set_html() Gotchas

      • Webdialogs and Javascript void

      • [FIXED!!!] Anyone seen this web dialog bug?

      • System / OS

      • [Code] Sketchup Safe Shutdown method

      • [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=24327:1a2mqsys]onKeyDown repeat parameter problem[/url:1a2mqsys]


      Mac / OSX Specific

      • Bugs / Issues

      • [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=35959:1a2mqsys]SU 8 Mac & strange content[/url:1a2mqsys] (memory leak?)

      • GUI

      • [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=33888:1a2mqsys]Mac Toolbars Editable?[/url:1a2mqsys]

      • [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=34002:1a2mqsys]My Apple Keyboard VK_KEYS[/url:1a2mqsys]

      • Misc.

      • Ruby

      • [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=34219:1a2mqsys]Ruby Version for Sketchup 8.0 M1 on Mac ??[/url:1a2mqsys]

      • WebDialog

      • [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=30127:1a2mqsys]JS loading problem under Mac OS X SU[/url:1a2mqsys]

      • [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=29751:1a2mqsys]PC v MAC webdialog populate[/url:1a2mqsys]

      • [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=26927:1a2mqsys]Sketchup use of WebKit[/url:1a2mqsys]

      • [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=32415:1a2mqsys]Webdialog position not preserved across session on MAC[/url:1a2mqsys]

      • [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=25865:1a2mqsys]WebDialogs are caching and not refreshing images[/url:1a2mqsys]

      • [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=39842:1a2mqsys]WebDialog.set_html fails under Safari 5.0.6[/url:1a2mqsys]

      • System / OS

      • [url=http://forums.sketchucation.com/viewtopic.php?f=15%26amp;t=29330:1a2mqsys]Auto-running a Mac '.command' File from Sketchup?[/url:1a2mqsys]

      • [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=30314:1a2mqsys]"Mac32API.so" ?[/url:1a2mqsys]


      PC / Win Specific

      • Bugs / Issues

      • Files

      • [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=43007:1a2mqsys][Code] PCFileTools[/url:1a2mqsys] - Support UTF8 (TIG)

      • GUI

      • [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=29970:1a2mqsys]Windows: Moving Floating Toolbars[/url:1a2mqsys]

      • Misc.

      • Ruby

      • [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=16574:1a2mqsys]Win32API vs DL lib[/url:1a2mqsys]

      • WebDialog

      • [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=27594:1a2mqsys]Web dialog browser version[/url:1a2mqsys]

      • System / OS

      • [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=36772:1a2mqsys]Determine OS bit version with ruby[/url:1a2mqsys]

      • [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=18488:1a2mqsys]Sketchup registry key ?[/url:1a2mqsys]


      (No longer Maintained due to lack of donations.)


      COMMUNITY CONTENT
      Moderators may edit post / add links at will.

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

      BY SUBJECT


      (No longer Maintained due to lack of donations.)


      Animation

      • [url=http:http://forums.sketchucation.com/viewtopic.php?t=25119][Code] Animation controller[/url] (Jim)

      Arcs & Curves

      • [url=http:http://forums.sketchucation.com/viewtopic.php?t=19270][Code][Plugin]ArcCurve-set_segments.rb & changearcsegments[/url] ([url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=28846&p=322175#Author_TIG]TIG[/url])

      Arrays

      • (Element References) [Info] [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=29975#p262832]This tripped me up (again) today[/url]
      • [url=http:http://www.ruby-doc.org/core-1.8.6/Array.html]Core Methods of Array class[/url] (offsite)
      • [url=http:http://www.ruby-doc.org/core-1.8.6/Enumerable.html]Methods Mixed in from module Enumerable[/url] (offsite)
      • [url=http:https://developers.google.com/sketchup/docs/ourdoc/array]Methods Added by the SketchUp API[/url] (offsite)

      Attributes & Dictionaries

      [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=30066][Info] Allowable Classes for "set_attribute"[/url] (Karen Walkerman)

      C/C++ Ruby extensions & SketchUp plugins

      • see: [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=28846#p323876]subpost (below)[/url]

      Camera

      • [url=http:http://forums.sketchucation.com/viewtopic.php?t=25917][Code] Camera settings[/url] (chrisglasier)* [url=http:http://forums.sketchucation.com/viewtopic.php?t=26904][Code] Rotate Camera around Target[/url] (Jim)

      Classes

      • [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=38968]Checking for a group?[/url]

      • Misc:

      • [url=http:http://sketchucation.com/forums/viewtopic.php?f=180&t=48066&p=431794#p431794]"Why use a module instead of a class ?"[/url] (Dan Rathbun)

      Communications

      • Serial / USB

      • [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=11693&p=259509]Read Serial port or USB interface[/url]* Socket

      • [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=31545]Interest in a Networking Sockets Workaround[/url]* [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=33759]Clients <--> Server Communication (Sockets?)[/url]* [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=36306&p=319776]Requiring Socket on Mac crashes SU[/url]

      Colors

      • [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=23837][Code] Ruby Extension for Sketchup color integers[/url]

      Component(s)

      • [url=http:http://forums.sketchucation.com/viewtopic.php?t=18006][Code] ComponentInstance-add_entities v1.9[/url] (TIG)* [url=http:http://forums.sketchucation.com/viewtopic.php?t=17962][Code] ComponentDefinition-delete[/url] (TIG)* [url=http:http://forums.sketchucation.com/viewtopic.php?t=18028][Code] ComponentDefinition-delete (another version!)[/url] (AlexMozg)* [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=38819]parent instance of a component[/url]
      • [url=http:http://sketchucation.com/forums/viewtopic.php?f=180&t=49571&p=445964#p445858]Collecting definitions that ARE parents of component instances[/url] (TIG)
      • [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=44193][Code] intersect_with?() test method[/url] (Dan Rathbun)

      Construction Lines & Points

      Debugging

      • [Info] [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=34052]How to debug?[/url]

      Dimension(s)

      • [url=http:http://forums.sketchucation.com/viewtopic.php?t=21315][Code] entities.add_linear_dimension[/url] (TIG)

      Edge(s)

      • [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=39016]Ruby How to Select All Connected[/url]

      Entity(ies)

      • [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=38968]Checking for a group?[/url]* [url=http:http://forums.sketchucation.com/viewtopic.php?t=18538][Code] entity.real_typename[/url] (Matt666)

      Execution & Error Trapping

      • [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=36167#p318387]Help with using begin, rescue, end[/url]* [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=34885][Code] Error raising scriptlets for testing[/url] (Dan Rathbun)* [url=http:http://forums.sketchucation.com/viewtopic.php?t=19372][Code] Method Model.start_operation for SketchUp 5-6[/url] (AlexMozg)* [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=25305]Optimization Tips[/url]

      Face(s)

      • [url=http:http://forums.sketchucation.com/viewtopic.php?t=3184][Code] orient_faces.rb[/url] (TIG)
      • [url=http:http://sketchucation.com/forums/viewtopic.php?f=180&t=41211][Code] is an entity in a surface[/url]

      File(s)

      • [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=36234#p319024]getting info from a text file[/url]* [url=http:http://forums.sketchucation.com/viewtopic.php?t=26185][Code] 3ds2obj.rb[/url] (Jim)* [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=29787][Code] reading a CSV file[/url] (Dan Rathbun)* [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=43007][Code] PCFileTools[/url] - Support UTF8 (TIG)

      Group(s)

      • [url=http:http://forums.sketchucation.com/viewtopic.php?t=19765][Code] Group.real_parent[/url] (thomthom)* [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=38968]Checking for a group?[/url]* [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=38925]Copy selection to new group?[/url]* [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=44193][Code] intersect_with?() test method[/url] (Dan Rathbun)
      • [url=http:http://sketchucation.com/forums/viewtopic.php?f=180&t=52014&view=unread#p470425][Info] Modifying geometry in freshly copied Groups (not unique)[/url] (Fredo6)

      Image(s)

      • [url=http:http://forums.sketchucation.com/viewtopic.php?t=21869][Code] Image: definition, transformation, transformation=[/url] (AlexMozg)* [url=http:http://forums.sketchucation.com/viewtopic.php?t=24876][Code] extract png thumbnail image from .skp file[/url] (Jim)

      Layer(s)

      • [Info] [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=36702]Layer0 questions[/url] & answers (Al Hart/TIG)* [url=http:http://forums.sketchucation.com/viewtopic.php?t=20086][Code] layer.delete()[/url] (TIG)* [url=http:http://forums.sketchucation.com/viewtopic.php?t=21090][Code] layer-color= v1.2[/url] (TIG)* [url=http:http://forums.sketchucation.com/viewtopic.php?t=20881][Code] layers.purge_unused[/url] (chrisglasier)

      Material(s)

      • [url=http:http://forums.sketchucation.com/viewtopic.php?t=20085][Code] material.delete[/url] (TIG)* [url=http:http://forums.sketchucation.com/viewtopic.php?t=20112][Code] material.name= v1.2[/url] (TIG)

      Math

      • [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=36722][Code] Parsing arithmetic formulas[/url] (Fredo6)

      Modules

      • [url=http:http://sketchucation.com/forums/viewtopic.php?f=180&t=48066&p=431794#p431794]"Why use a module instead of a class ?"[/url] (Dan Rathbun)
      • [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=46124&p=413623#p412101][Code] Private Mixin Module[/url] (Dan Rathbun)

      Observer(s)

      • [Info] [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=20676]State of Observers[/url] (ThomThom)* [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=30793]State of Observers Redux — 12 September 2010[/url] (ThomThom)

      • [url=http:http://www.thomthom.net/software/sketchup/observers/][link] State of Google SketchUp's Observers[/url]* [url=http:http://forums.sketchucation.com/viewtopic.php?t=21659][Code] MetaObserver[/url] (Jim)

      Pages & Scenes

      Platform (Mac/OSX vs PC/Windows)

      • [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=28846&p=322176#p322176]Issues / Differences / Specifics[/url] (goto next post)
      • [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=34631][Code] FAQ: Detect if plugin is running on the Mac vs PC ?[/url]

      Ruby

      • $LOAD_PATH

      • [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=29412&p=257058][Code] Ruby LOAD PATHs script (Win32)[/url] (Dan Rathbun / Jim Foltz)* Object References

      • Array : [Info] [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=29975#p262832]This tripped me up (again) today[/url]* [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=25305]Optimization Tips[/url]

      Selection

      • [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=38925]Copy selection to new group?[/url]

      SketchupExtension

      • [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=39094][Code] SketchupExtension and rbs rubies[/url]

      Strings

      • [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=36722][Code] Parsing arithmetic formulas[/url] (Fredo6)* [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=35969#p316774]JSON in Ruby[/url]* [url=http:http://forums.sketchucation.com/viewtopic.php?t=20657][Code] UnicodeEx - (0.2.0a) Sketchup + Character Encoding[/url] (thomthom)* [url=http:http://forums.sketchucation.com/viewtopic.php?t=20289][Code] file_found?(path) and to_ascii+to_unicode.rb[/url] (TIG)* [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=34975][Code] Split a long pathstring ~in half at the nearest '/'[/url] (various)

      Styles

      Surface(s)

      • [url=http:http://sketchucation.com/forums/viewtopic.php?f=180&t=41211][Code] is an entity in a surface[/url]

      Text & 3DText

      Texture(s)

      • [url=http:http://forums.sketchucation.com/viewtopic.php?t=23196][Code] texture_by_component.rb[/url] (honoluludesktop)* [url=http:http://forums.sketchucation.com/viewtopic.php?t=22719][Code] Real UV from UVHelper data[/url] (thomthom)

      Timer(s)

      • [url=http:http://forums.sketchucation.com/viewtopic.php?t=25178][Code] Timer class[/url] (MartinRinehart)

      Tool(s)

      • [url=http:http://forums.sketchucation.com/viewtopic.php?t=18124][Code] Tool ID Constants - Rev. 2[/url] (thomthom)

      Transform(s)

      • [url=http:http://forums.sketchucation.com/viewtopic.php?t=22639][Code] Transformation_Extensions[/url] (TIG)

      User Interface

      • Command(s)

      • Instructor Helpfiles

      • [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=35806#p315546][Code] Load Instructor v1.0.1[/url] (Niall Campbell)* Menu(s)

      • [url=http:http://sketchucation.com/forums/viewtopic.php?f=180&t=48350&p=433934#p433934]One Submenu for many plugins[/url] (Dan Rathbun)* Mouse

      • [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=38651]Mouse Capture (Win32 API)[/url]* Toolbar(s)

      • WebDialog

      • [url=http:http://forums.sketchucation.com/viewtopic.php?t=23343][code] reset webdialog and toolbars .bat file[/url] (Jim)* [info] [url=http:http://forums.sketchucation.com/viewtopic.php?f=180&t=38940]Web Dialog not firing a JavaScript function...[/url]


      (No longer Maintained due to lack of donations.)


      COMMUNITY CONTENT
      Moderators may edit post / add links at will.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: DLL callback to ruby

      You will need to do some studying:


      1. Read and bookmark this post:

      [Info] C/C++ Ruby extensions & SketchUp plugins

      1. You will need to download the Ruby C source, as your DLL code must:

      %(#404080)[include "ruby.h"]

      1. Read the old "Pick-Axe" book's chapter on writing a Ruby extension.

      Programming Ruby: Extending Ruby

      1. Take note of the Ruby C-side functions:
      • rb_eval_string( *string_to_eval* )* rb_funcall
        ... described in section "Evaluating Ruby Expressions in C"
      1. ❗ okay, a dedicated C side Ruby book is also now available:
      • http://media.pragprog.com/titles/ruby3/ext_ruby.pdf
      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: SketchUp Update Broke the Foundation Plugin

      Or single object extension via mixin module (as shown above.)

      unless bb.extend(BB_Volume).volume == 0.0
        # do code here
      end
      
      

      Or if only supporting Ruby 2.x+ SketchUp versions, you can use class refinements that are only active within your files.
      See: http://ruby-doc.org/core-2.0.0/doc/syntax/refinements_rdoc.html

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: HTMLDialog vs WebDialog?

      You missed the point John, he's doing neither. He is simply leaving the droplist and grabbing the window caption bar and moving the entire window. This is leaving the droplists behind (as if torn off) as shown in the screenshots above.

      My attempt to fix it would detect when the mouse leaves the body of the html document, and blur the <select> element hopefully making it close it's droplist.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: HTMLDialog vs WebDialog?

      @garry k said:

      Also I moved the form while the drop down list is open and now you can't tell which drop down I was in. The difference is IE closes the drop down when you click and drag the form - chrome does not.

      Let us try some tests to see if we can get Chrome to close the <select> droplists.

      
       <body onmouseout="document.blur();" onmouseover="document.focus();">
      
      

      I'm hoping this will cause the current active selection element to lose focus and have it's blur event fire.

      If this does not work, then perhaps keep track of the current object that has focus:

      
      <!DOCTYPE html>
      <html>
      
          <head>
              <script>
                  // Global variable;
                  activeObject = document.body;
                  previousObject = document.body;
                  
                  function setActive(obj) {
                      activeObject = obj;
                  }
      
                  function clearActive(obj) {
                      activeObject = document.body;
                      previousObject = obj;
                  }
      
                  function blurAll() {
                      if activeObject != document.body {
                          activeObject.blur();
                          if activeObject != document.body {
                              clearActive(activeObject);
                          }
                      }
                      document.blur();
                  }
      
                  function reFocus() {
                      document.focus();
                      if previousObject != document.body {
                          previousObject.focus(); // calls setActive(previousObject)
                          previousObject = document.body;
                      }
                  }
      
                  function CheckKey(e) {
                      var code = e.keyCode ? e.keyCode ; e.which;
                      if(code === 13) {
                        alert("You press Enter key.");
                      }            
                  }
      
                  function SubstanceChangeHandler(val) {
                    alert("New substance chosen; "+val);
                    txtTest.value= val;
                  }        
              </script>
          </head>
      
          <body onmouseout="blurAll();" onmouseover="reFocus();">
          
              <input name="txtTest"  type="text" id="txtTest" onkeyup="CheckKey(event)"/>
      
              <select onchange="SubstanceChangeHandler(this.value);"
                      onfocus="setActive(this);" onblur="clearActive(this);">
                <optgroup label="Alkaline Metals">
                  <option>Lithium (Li)</option>
                  <option>Sodium (Na)</option>
                  <option>Potassium (K)</option>
                </optgroup>
                <optgroup label="Halogens">
                  <option>Fluorine (F)</option>
                  <option>Chlorine (Cl)</option>
                  <option>Bromine (Br)</option>
                </optgroup>
              </select>
      
          </body>
      
      </html>
      

      If this scenario works, you can set the onfocus and onblur handlers for all <select> elements via an iteration loop after the page loads.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: HTMLDialog vs WebDialog?

      @garry k said:

      Also the Enter key doesn't trap while you are inside a drop down list.

      But when the user (in CEF) hits ENTER on an <select><option>, that changes the selection does it not ? And therefore it should fire the some event ?


      I just tested in normal Chrome and the ENTER key works fine.
      http://jsfiddle.net/wkpeq/73/

      <!DOCTYPE html>
      <html>
          <head>
              <script>
                  function CheckKey(e) {
                      var code = e.keyCode ? e.keyCode ; e.which;
                      if(code === 13) {
                        alert("You press Enter key.");
                      }            
                  }
      
                  function SubstanceChangeHandler(val) {
                    alert("New substance chosen; "+val);
                    txtTest.value= val;
                  }        
              </script>
          </head>
          <body>
              <input name="txtTest"  type="text" id="txtTest" onkeyup="CheckKey(event)"/>
      
              <select onchange="SubstanceChangeHandler(this.value);">
                <optgroup label="Alkaline Metals">
                  <option>Lithium (Li)</option>
                  <option>Sodium (Na)</option>
                  <option>Potassium (K)</option>
                </optgroup>
                <optgroup label="Halogens">
                  <option>Fluorine (F)</option>
                  <option>Chlorine (Cl)</option>
                  <option>Bromine (Br)</option>
                </optgroup>
              </select>  
          </body>
      
      </html>
      
      
      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 245
    • 246
    • 6 / 246