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

    Posts

    Recent Best Controversial
    • RE: The Naming of Groups (API issues)

      @jolran said:

      Hope this can help you (although it's related to modifying geometry in groups):

      http://sketchucation.com/forums/viewtopic.php?f=180&t=52014&view=unread#p470425

      Yes, that was very interesting. Thanks for the pointer (though it didn't make me feel any better about the situation): "It's worse than that — he's dead, Jim!" Sigh.

      -r

      posted in Developers' Forum
      RichMorinR
      RichMorin
    • RE: The Naming of Groups (API issues)

      I'm not sure how many developers read the SketchUp Discussions forum on a regular basis (I don't). So, here's a link to a topic I recently started there, called The Naming of Groups.

      The basic questions aren't confined to developers, which is why I posted there, but I'm sure that some folks here will want to discuss API-related issues, etc. So, feel free to respond to either this topic or the original one, as seems appropriate. I have quoted the original post below, for your convenience...

      -r

      @unknownuser said:

      The Naming of Groups is a difficult matter,
      It isn't just one of your holiday games;
      You may think at first I'm as mad as a hatter
      When I tell you, a group must have THREE DIFFERENT NAMES.

      -- adapted, with apologies, from The Naming Of Cats by T. S. Eliot;
      http://famouspoetsandpoems.com/poets/t__s__eliot/poems/15121

      I've never paid a lot of attention to Groups, but I've been looking into them recently, with the intent of using them as hierarchical levels (along with components) in Model Viewer. I've run into some naming issues that may have obvious (or even standardized) solutions, but if so, I haven't found them. So, I'm asking for some Wise Counsel (TM).

      In a hierarchy, it's critical to have unique names for the items at each level. So, for example, most OSes don't allow a directory to have more than one item with the same name (including extension, etc). This uniqueness allows the OS to maintain an unambiguous handle (eg, "full path name") for each directory or file in the tree.

      SketchUp's naming policies for components and groups are somewhat at odds with this need. It's quite possible, for example, to have 300 groups or components named "chair", all listed within a given level of the Outliner. Any given chair will have its own position. If the chair is a group, it may even have different attributes than other chairs.

      The Outliner has no problem with this. It simply lists all of the chairs, using the same name for each one. There is no way for the user to tell which is which, unless s/he takes the trouble of inventing a unique name for each one. The Outliner is also willing to allow multiple instances of a given component to have the same name. In this case, however, the essential attributes (eg, dimensions) must be identical.

      My presumption is that the Outliner uses each component or group's unique ID (ie, Entity.entityID) to keep track of the individuals, but this information is only accessible via the API; the UI doesn't appear to present it. In any case, I can't create unique paths out of non-unique names.

      I've thought of several ways to avoid or deal with this ambiguity. The simplest solution would be to qualify each otherwise ambiguous item name with the unique ID (eg, "chair #43583"). Alternatively, I could maintain a human-friendly sequence number (eg, "chair #1").

      However, before I do anything of this sort, I'd like to know if I'm simply missing something or if there is an existing Best Practice for handling this issue. Suggestions, anyone?

      -r

      posted in Developers' Forum
      RichMorinR
      RichMorin
    • The Naming of Groups (API issues)

      The Naming of Groups is a difficult matter,
      It isn't just one of your holiday games;
      You may think at first I'm as mad as a hatter
      When I tell you, a group must have THREE DIFFERENT NAMES.

      -- adapted, with apologies, from The Naming Of Cats by T. S. Eliot;
      http://famouspoetsandpoems.com/poets/t__s__eliot/poems/15121

      I've never paid a lot of attention to Groups, but I've been looking into them recently, with the intent of using them as hierarchical levels (along with components) in Model Viewer. I've run into some naming issues that may have obvious (or even standardized) solutions, but if so, I haven't found them. So, I'm asking for some Wise Counsel (TM).

      In a hierarchy, it's critical to have unique names for the items at each level. So, for example, most OSes don't allow a directory to have more than one item with the same name (including extension, etc). This uniqueness allows the OS to maintain an unambiguous handle (eg, "full path name") for each directory or file in the tree.

      SketchUp's naming policies for components and groups are somewhat at odds with this need. It's quite possible, for example, to have 300 groups or components named "chair", all listed within a given level of the Outliner. Any given chair will have its own position. If the chair is a group, it may even have different attributes than other chairs.

      The Outliner has no problem with this. It simply lists all of the chairs, using the same name for each one. There is no way for the user to tell which is which, unless s/he takes the trouble of inventing a unique name for each one. The Outliner is also willing to allow multiple instances of a given component to have the same name. In this case, however, the essential attributes (eg, dimensions) must be identical.

      My presumption is that the Outliner uses each component or group's unique ID (ie, Entity.entityID) to keep track of the individuals, but this information is only accessible via the API; the UI doesn't appear to present it. In any case, I can't create unique paths out of non-unique names.

      I've thought of several ways to avoid or deal with this ambiguity. The simplest solution would be to qualify each otherwise ambiguous item name with the unique ID (eg, "chair #43583"). Alternatively, I could maintain a human-friendly sequence number (eg, "chair #1").

      However, before I do anything of this sort, I'd like to know if I'm simply missing something or if there is an existing Best Practice for handling this issue. Suggestions, anyone?

      -r

      posted in Developers' Forum
      RichMorinR
      RichMorin
    • RE: Help needed in traversing the Model

      Thanks, all, that gives me quite a bit to chew on.

      -r

      posted in Developers' Forum
      RichMorinR
      RichMorin
    • RE: Help needed in traversing the Model

      @jolran said:

      I think it might be difficult for anyone to help you if you don't post some code.
      (having a little hard time following your post)

      Sounds like the instances failed being unique ?

      Problem is, this code is in the middle of a few thousand lines of framework code.
      However, I'll think about how I might extract a cut-down example.

      @jolran said:

      OT: what happened to your excellent post on your blog
      regarding dynamic component scripting explorations?
      I cannot find it anymore. It was most intresting.

      I don't recall writing a blog entry, but I have several pages in my wiki on the topic.
      Please take a look at http://wiki.cfcl.com/bin/view/SketchUp/Cookbook/DA

      -r

      posted in Developers' Forum
      RichMorinR
      RichMorin
    • Help needed in traversing the Model

      Executive Summary

      I need some help in traversing the Model, because I'm getting some
      results that I don't understand.

      Background

      My PF_Model class does a recursive treewalk through SketchUp's Model API,
      harvesting information on component definitions and instances, etc. The
      result is a data structure that I can index into to find components, etc.

      The shipping version of Product Connect pays no attention to the "visible?"
      status of either a component or the layer it resides in. This violates the
      Principle of Least Astonishment for modelers, who expect invisible portions
      of the current Model to be ignored pretty universally.

      So, I'm trying to add some code that will cause PF_Model to ignore anything
      within invisible component instances (whether hidden explicitly or residing
      on a hidden layer). However, in working on this, I got confusing results.

      Test Setup

      I have two Models, each of which contains three instances of a KraftMaid
      "Base Single Door" cabinet. In each Model:

      • One instance is visible.
      • One instance is explicitly hidden.
      • One instance is on an invisible layer.

      In one Model (KMc_s), three cabinet instances share the same definition.
      That is, I simply copied the cabinet and pasted it twice, then hid one
      copy and put the other on a hidden layer.

      In the other Model (KMc_u), each cabinet instance has a unique definition.
      That is, I did a Make Unique on each copied cabinet before hiding it, etc.

      Problem

      I'm seeing quite different behavior in the two Models and I'm not quite sure
      what is going on. The KMc_s (shared) Model gives me the following results:

      • It finds three entities of type ComponentInstance (ie, instances
        of the cabinet), only one of which is visible.

      • Looking in the cabinet component definition's entities (cd.entities)
        for objects of type ComponentInstance, it finds one visible instance
        of the drawer sub-component.

      The KMc_u (unique) Model, in contrast, gives me the following results:

      • It finds three top-level components (unique instances of the cabinet),
        only one of which is visible. In each one of the three, however, it
        finds three visible instances of the drawer.

      Analysis

      I suspect that there's a better way to traverse the model, if only because
      I shouldn't be finding three instances of the drawer sub-component in each
      unique instance of the cabinet. Suggestions?

      Failing that, I'd like to know why I'm seeing three visible instances of
      the drawer and (more to the point) how to tell them apart, etc.

      posted in Developers' Forum
      RichMorinR
      RichMorin
    • RE: Migrating plugins to SketchUp 2013

      @dan rathbun said:

      Sorry for MY confusion, Rich.

      No problem! Catching Dan Rathbun in an error is quite a triumph.

      More generally, I'm quite sure that my pages have both errors and omissions; I just don't know what they are. If you (or anyone else) can tell me about problems, I'd be most pleased.

      -r

      posted in Developers' Forum
      RichMorinR
      RichMorin
    • RE: Migrating plugins to SketchUp 2013

      @dan rathbun said:

      They NEVER WERE allowed in { ... } literals to separate a key from a value, BUT ARE required to separate key/value pairs from one another.

      Ruby 1.8.7 (on Mac OS X Snow Leopard) accepts commas as key/value separators:

      
      $ irb --simple-prompt
      >> {1,2,3,4}
      => {1=>2, 3=>4}
      >> RUBY_VERSION
      => "1.8.7"
      
      
      posted in Developers' Forum
      RichMorinR
      RichMorin
    • Migrating plugins to SketchUp 2013

      The SketchUp team says that upgrading the version of Ruby will be a strong priority for "SketchUp 2013". The current version of Ruby (outside of SketchUp) is 1.9.3, and 2.0.0 is scheduled for release in early 2013. However, moving to either of these versions would break large numbers of plugins.

      My hope is that SketchUp 2013 will contain Ruby 1.8.7, with a substantially complete copy of the Standard Library. Ruby 1.8.7 introduces a number of 1.9's features, but it is (mostly) backward compatible with 1.8.6. So, we'd have a year or so to try things out, develop and implement migration strategies, etc.

      In any case, plugin developers would be well advised to start learning about the changes in Ruby 1.9, thinking about how to create plugins that will work in either 1.8 and 1.9, etc. In support of this, I have created a couple of web pages that I hope will be useful. Comments and suggestions are earnestly solicited...

      http://wiki.cfcl.com/bin/view/SketchUp/Cookbook/RE_Migration - Ruby Migration

      http://wiki.cfcl.com/bin/view/SketchUp/Cookbook/RE_19_Changes - Ruby 1.9 Changes

      -r

      posted in Developers' Forum
      RichMorinR
      RichMorin
    • RE: ATAN2(y,x) for dynamic components

      Experimentation indicates that function arguments are passed to the Ruby method as an array of strings. So, it seems like the Ruby method should be performing coercion on the input values. (eg, a[0].to_f). Am I missing something?

      -r

      posted in SketchUp Feature Requests
      RichMorinR
      RichMorin
    • My current Wish List for SketchUp

      After returning from SketchUp 3D Basecamp 2012, I spent a few days creating a detailed summary of my current Wish List for SketchUp (http://wiki.cfcl.com/bin/view/SketchUp/WL_Summary).

      The major topics it covers are:

      • 3D Warehouse
      • Administration
      • Batch Mode Operation
      • Documentation, etc.
      • Resource Management
      • Ruby Support
      • WebDialog API

      Although the summary is neither authoritative nor comprehensive, I hope that it will be helpful to the SketchUp team and community. Please feel free to contact me (on or off list) with questions or comments.

      -r

      posted in Developers' Forum
      RichMorinR
      RichMorin
    • RE: Making changes visible

      I added this code

      
          active_view = Sketchup.active_model.active_view
          active_view.zoom_extents
          active_view.zoom(1.0)
      
      

      and the window now refreshes. However, the position and scaling are modified.
      Is there any way to just get the refresh or refresh to the old state?

      -r

      posted in Developers' Forum
      RichMorinR
      RichMorin
    • Making changes visible

      I have a plugin which adds a number of colored faces to the model. Sometimes, the faces do not appear unless the user plays with the view. I'd like a way for the plugin to make them appear.

      Details

      The incoming model has three layers (Layer0, outline, spaces), stacked as horizontal planes. The plugin adds a fourth layer (walls) above the first three. Normally, the model is viewed from the top, allowing the user to view the composition of the layers (eg, walls superimposed on spaces).

      Sometimes, when the plugin is finished, the walls do not appear. However, they can be made to appear by selecting a different view (eg, oblique) and then switching back to the top view. I've tried a few things (eg, View.refresh) without success. Suggestions, anyone?

      -r

      posted in Developers' Forum
      RichMorinR
      RichMorin
    • RE: Webdialogs: inputbox shows black background (sketchup webkit

      I grabbed a copy of Pacifist, but I can't find a copy of Safari 5.1.5 to install.

      For example, the page http://support.apple.com/kb/DL1070
      has a Download button that leads to http://www.apple.com/safari/download/.

      However, this page only supports downloading of Safari 5.1.7.

      Help?

      posted in SketchUp Bug Reporting
      RichMorinR
      RichMorin
    • RE: Wish List - Ruby interpreter and libraries

      The thread linked below looks relevant to any attempt to augment the Ruby Console (with or without Pry):

      http://forums.sketchucation.com/viewtopic.php?f=180&t=46064

      posted in Developers' Forum
      RichMorinR
      RichMorin
    • RE: Wish List - Ruby interpreter and libraries

      Pry (http://pry.github.com) is a high-powered replacement for irb. It is working its way toward being a REPL (Read-Eval-Print-Loop) for Ruby, but it is also seeing use as a debugger. For example, it's possible to use Pry as a replacement for the Ruby on Rails Console. So, I'd like to have a way to use Pry as a debugger and/or console in SketchUp.

      Unfortunately, I'm not sure exactly what this would require. Pry is known to work with Ruby 1.8.7, but might not work (unchanged) under 1.8.6. There is also the question of enabling some sort of inter-process communication between SketchUp and Pry. Nonetheless, I'm sure that it's possible and also confident that it would be a handy tool for SketchUp developers.

      posted in Developers' Forum
      RichMorinR
      RichMorin
    • RE: Wish List - WebDialog communication model

      @thomthom said:

      ... it's hard to make a GUI that works outside of SketchUp's webdialogs - for testing - as the user agent string only works for the most recent SketchUp version.

      I hacked up a Browser_Dialog class as a debugging aid:

      http://wiki.cfcl.com/bin/view/SketchUp/SketchApps/DF_BD

      It mocks up a subset of WebDialog methods and communicates with a browser. Event Machine proxies between temporary files (on the plugin side) and WebSockets (on the browser side). Works amazingly well, all things considered...

      posted in Developers' Forum
      RichMorinR
      RichMorin
    • RE: Wish List - WebDialog communication model

      @chrisglasier said:

      ... I do as much as possible in javascript ...

      Interesting. My approach (eg, in Igloo Studios' Product Connect suite) has been exactly the reverse: use the thinnest possible layer of JS calls (mostly jQuery) to package up event information and forward it to the plugin code. No doubt, this reflects my preference for coding Ruby...

      FWIW, I also did some template-driven JS and HTML generation in the plugin, using ERb, etc. But then, I feel more comfortable with code generation than with hand-editing large amounts of repetitive code.

      I'm impressed that you've been able to implement Ajax in the WebDialog environment. However, I suspect that it would have been a lot easier had SketchUp provided emulation of typical web protocols.

      Given that most plugin developers are not likely to be JS ninjas, being able to use existing libraries (as-is) still seems like a win...

      posted in Developers' Forum
      RichMorinR
      RichMorin
    • Wish List - WebDialog communication model

      Here's another topical breakout from my "SketchUp API Wish List" post:

      http://forums.sketchucation.com/viewtopic.php?f=180&t=44949

      SketchUp's WebDialogs provide an extremely flexible way to create user interfaces. They can also be used for other purposes (eg, providing access to network services).

      However, the way they communicate with plugins is both quirky and peculiar. This forces developers to create workarounds and limits their ability to use familiar design patterns and libraries.

      As an example of quirky behavior, execute_script() imposes a fairly small (and undocumented) limit on the size of the executed code string. So, although the call can be used to transfer data (eg, as JSON), any significant amount of data will require multiple calls.

      The communication model is also quite peculiar, by current web standards. For example, execute_script(), get_element_value(), and the "location=" hack look nothing like the usual ways of performing communication with a web server.

      As a result, common web programming practices (eg, Ajax, REST) are awkward to use. More to the point, many popular JavaScript libraries (eg, Angularjs, Backbone, Knockout) can't be used as-is.

      I am not arguing for the removal of the current communication model or anything else that would break existing plugins. However, it should be possible for SketchUp to emulate protocols such as WebSockets and/or XMLHttpRequest.

      This would allow literally dozens of JavaScript libraries to be used in WebDialogs. It would also open up possibilities for plugin code that uses common programming idioms (and even code) from Ruby application frameworks such as Rails or Sinatra.

      posted in Developers' Forum
      RichMorinR
      RichMorin
    • RE: Trying to find the 3DW modeler "travis"

      That's a cute hack; thanks!

      posted in Corner Bar
      RichMorinR
      RichMorin
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 1 / 6