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!
    🚨 Skimp | 25% Off until March 30 Buy Now
    Offline
    • Profile
    • Following 0
    • Followers 1
    • Topics 92
    • Posts 4,904
    • Groups 2

    Posts

    Recent Best Controversial
    • RE: Aligning face normal to an edge

      You will need to create the face within the entities context of a group or component, as only they can be transformed.

      EDIT: Actually Whaat might have a better idea, here:
      http://forums.sketchup.com/t/i-want-to-align-face-normal-to-an-edge/35033/2

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Straight Skeleton Algorithm

      @garry k said:

      I'm not sure what you mean by straight skeleton algorithm.

      Link Preview Image
      Straight skeleton - Wikipedia

      favicon

      (en.wikipedia.org)

      It obvious that there are several by different people.

      @garry k said:

      First of all an algorithm and code are two different things.

      And he asked for one implemented in Ruby code.

      My answer is to find one that works, then find an implementation in a programming language easily translated to Ruby. (Such as Python, JavaScript, C, C++.)

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Followme with the SketchUp API

      So, it was failing because you were setting edge1, edge2, edge3 and edge4, to reference only the first segment of their respective arccurve, ...

      ... which caused the edge array topbaredges to have a set of 4 disconnected edge paths.

      There are two easy ways around this.

      First assume you had set each arc edge array to a reference like arc1edges, arc2edges, etc., from the add_arc() method call.

      (Scenario A) - You create a literal nested array for your followme() method call, but flatten it using the Array class' flatten() method.

      Ie, your literal edge array topbaredges would be defined like:

      topbaredges = [
        line1b, arc2edges, line2, arc3edges,
        line3,  arc4edges, line4, arc1edges, line1a
      ].flatten
      

      This should result in a 1 level array of all edge objects. (It is always good to test collections just in case. For example: if topbaredges.any? {|o| !o.is_a?(Sketchup::Edge) } will return true if there is a non-edge object in the collection.)


      (Scenario B) - You use Ruby's built-in "splat" operator. It's the * character. It can convert an array to a parameter list, or a parameter list to an array.

      Example:
      ` ary1 = [2,3,4]
      ary2 = [6,7,8]
      ary3 = [10,11,12]

      ary = [ 1, *ary1, 5, *ary2, 9, *ary3, 13, 14 ]`
      sets [ruby:1bj806zx]ary[/ruby:1bj806zx] to:
      [ruby:1bj806zx][1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14][/ruby:1bj806zx]

      So, [ruby:1bj806zx]*ary1[/ruby:1bj806zx] expands the array into the parameter list [ruby:1bj806zx]2, 3, 4[/ruby:1bj806zx], etc. (You'll often see this syntax used for method definitions to collect arguments into a method-local array. So, not only can you use it in literal expressions, but also in method call parameter lists.)

      So, you could use this syntax (instead of the [ruby:1bj806zx]Array#flatten()[/ruby:1bj806zx] method.)
      Ie, your literal edge array topbaredges would be defined like:

      topbaredges = [
        line1b, *arc2edges, line2, *arc3edges,
        line3,  *arc4edges, line4, *arc1edges, line1a
      ]
      

      🤓

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: How to display sketchup file on website like my.sketchup.com

      @Gábor: I think they meant DAE format.

      Other companies have asked for this recently. It would likely be a commercial server-side product, if they decide to do it.
      (I would bet that it's terms of use would prohibit it's use on any competitive warehouse-like website.)

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: How to display sketchup file on website like my.sketchup.com

      There is no API yet for my.sketchup.com.

      BUT, it's display pipeline is now also used for the 3D Warehouse WebGL viewer.
      IF the model is hosted on the 3D Warehouse, then you can embed the model using this viewer on another website. (It uses an HTML inline frame element.)

      Here is an example of this model, Alvar Aalto stacking table by davidheim:
      https://3dwarehouse.sketchup.com/model.html?id=u33ee83a9-f9a6-4a14-8950-c487ded2ea4a

      
      <iframe 
          src="https://3dwarehouse.sketchup.com/embed.html?mid=u33ee83a9-f9a6-4a14-8950-c487ded2ea4a&width=580&height=326"
          frameborder="0" scrolling="no" marginheight="0"
          marginwidth="0" width="580" height="326" allowfullscreen>
      </iframe>
      
      

      Which looks like this:
      (Click the image to go into interactive WebGL mode.)

      [3dwh:2sihoic4]u33ee83a9-f9a6-4a14-8950-c487ded2ea4a[/3dwh:2sihoic4]

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: SKUI — A GUI Framework for SketchUp

      @thomthom said:

      @dan rathbun said:

      I would think this may need some tweaking to work with the new UI::HtmlDialog class.

      For SKUI I don't see any obvious benefit of HtmlDialog at the moment. Big part of SKUI was taking care of cross platform issues, which is already handled.

      Cross platform issues may not be a motivator, sure, but some people do not know CSS, JS nor HTML well, and may have only just learned Ruby, so it would nice for them to specify their controls in Ruby-like objects and let the framework build the actual HtmlDialog.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: SKUI — A GUI Framework for SketchUp

      @unknownuser said:

      (https://github.com/thomthom/SKUI/blob/master/README.md)":2v9dncx5]This project is at it's early stages. Many changes will happen. Please do not make use of it as of yet. It's available here in order to be able to discuss the project.

      I would think this may need some tweaking to work with the new UI::HtmlDialog class.

      I see Jan Brewer opened an issue on this line:
      https://github.com/thomthom/SKUI/issues/105

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Adding layers to extension

      @medeek said:

      Are there any more gotchas I should be aware of with layers?

      Yes, SketchUp layers are not really layers at all. They do not "own" geometric collections of entities (like they do in most CAD applications.) In SketchUp, layers are display behavior property sheets, that can be shared with multiple entities.

      So in SketchUp, each object descended from Sketchup::Drawingelement has a layer property that can be assigned to point at one of these property sheets (that were misnamed "layers" by the developers.)

      So, in reality you assign a SketchUp object to "use" a layer, not put an object upon a layer.

      @paul russam said:

      ... could you please precede your layers with your/your plugin name this way they will remain unique, ... If you did the same with any component and material names your plugin(s) creates it would be very helpful too.

      This also applies to Attribute Dictionary names. They should be prefixed with the name of your author name and extension name in some way, so there will not be any clashing of dictionary names. (For example, we all cannot have dictionaries named "Properties".) Something like "Medeek_TrussMaker_TrussProperties" or whatever.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Extension Signing

      Well, then do not put them into the package until after signing ?

      Or save your logs in a version independent folder like:
      "%APPDATA%/Medeek/SketchUp/TrussPlugin"

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: How to list all Sketchup.send_action?

      I can get some command ID numbers from menu items and buttons etc. by using a resource inspector utility. Currently I am using one named "Inspect Object" that comes with Microsoft Windows SDK, that can inspect GUI objects in realtime of all running applications.

      P.S. - command ID integers only work on the Windows platform.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: How to list all Sketchup.send_action?

      !

      We have long had a snippet list of the actions strings in this forum:

      [Code] Sketchup.send_action() : Arguments to

      Be sure to read down the thread for updates, omissions, new actions found, old ones retired etc.


      @thomthom, I'll file an issue to update the official docs using this thread as a reference.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: [Code] Skew Transformation from axes

      So what is the solution here?

      Is it some extra text in the API docs explaining how best to test for face coplanarity ?

      Or would it be a new API method for the Sketchup::Face class:
      face.coplanar_with?(other_face)
      or a module method?:
      Geom::faces_coplanar?(face1,face2)

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Extension Signing

      Questions about the operation (correct or incorrect) of the Extension Warehouse are best asked in the official forum:
      http://forums.sketchup.com/c/extension-warehouse

      Those responsible are more likely to see the post there.

      That said, The "agree to terms" checkbox issue seems to have come last month, but I thought it was fixed.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Extension Signing

      You do not create nor edit the "extension_info.txt" file.
      It is generated by the EW. When you get the signed RBZ package back, the file should have been inserted.

      .. and it goes in the extension sub-folder not in the root folder of the RBZ archive (which is actually the "Plugins" root folder.)

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: [Code] Skew Transformation from axes

      @thomthom said:

      @fredo6 said:

      ...and there is the magic formula by thomthom to check if two faces are coplanar (actually have parallel planes)
      face1.normal % face2.normal > 0.9999999991

      hm... It was never reliable.

      I was hoping you'd answer the questions I posed (above) in this post:
      http://sketchucation.com/forums/viewtopic.php?f=180%26amp;t=65068%26amp;view=unread#p597160

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Kernel.system asynchronous on OSX?

      I usually use a timer in this scenario, to check when the file exists, then cancel the timer and call the post processing method.

      @tid = UI;;start_timer(0.5,true) {
        if File.exist?(@filepath)
          UI;;stop_timer(@tid)
          post_process(@filepath)
        end
      }
      

      EDIT(Add): Also, I would usually have a counter variable that gets incremented each timer loop, and a max number of trys, if the file never becomes "ready" then I also exit the timer and somehow display a warning or message that things did not work.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Clean Dynamic Components

      Don't use the selection. Use an array. Then use one of the Array class' iteration methods.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Clean Dynamic Components

      See this thread in the official "Ruby API" forums:

      Selecting Specific Entity, Group or Component (By Name)

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: Size of input point?

      You might try using a Sketchup::PickHelper class interface instead, and the new (SU2016+) window_pick() method.

      Otherwise there is no way to change the pick aperture size, and Sketchup::InputPoint would use a "OnEdge" inference anyway.

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • RE: What what what? This makes no sense!

      @thomthom, is this still a bug, or has it been fixed ?

      posted in Developers' Forum
      Dan RathbunD
      Dan Rathbun
    • 1
    • 2
    • 10
    • 11
    • 12
    • 13
    • 14
    • 245
    • 246
    • 12 / 246