• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Storing Bounding Points

Scheduled Pinned Locked Moved Developers' Forum
3 Posts 3 Posters 475 Views 3 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    medeek
    last edited by 24 Jun 2016, 06:06

    I'm working on making it possible to edit a truss assembly once it has been created. The only thing holding me back is a way of storing or retrieving the original bounding points of the assembly. This is not a problem provided the assembly is not moved after it was created however if it is re-positioned after it is created then I need to figure out a way of determining the bounding points at the new location. I was thinking of using the construction point feature but I'm unsure if one can reference them by name in a new session? Perhaps there is a better method of doing this.

    Nathaniel P. Wilkerson PE
    Medeek Engineering Inc
    design.medeek.com

    1 Reply Last reply Reply Quote 0
    • D Offline
      Dan Rathbun
      last edited by 25 Jun 2016, 01:40

      The SketchUp team had created an example Parametric superclass that helps in saving original construction parameters, into a attribute dictionary attached to the group or component.

      The main problem with it is that it is not distributed stand-alone, and the several "team" extensions that use it have divergent versions. Ie, I think the "3D Shapes " extension did some revisions and fixes to it, but other extensions like the "Window Maker " extension still have the original.

      You can see the code and copy the latest Parametric class from:
      https://github.com/SketchUp/sketchup-shapes
      (It is released under the MIT License.)

      So your options are (1) to copy the Parametric class into your own extension sub-module, use it as is, or subclass it and make whatever changes you need for your extension's use.

      Or (2), require your users to download the Trimble Team's "3D Shapes " extension, and then use it as a superclass via qualification. (Users do not actually have to have it switched "on", just have the "su_shapes/parametric.rb" file available.) This way you can leverage any future fixes to the Parametric class, .. but future changes could also break your plugin.

      Either:

      (a) ... use as is without modification:

      
      require "su_shapes/parametric.rb"
      module MedeekDesign
        module TrussMaker
          Parametric = Class;;new(CommunityExtensions;;Shapes;;Parametric)
        end
      end
      
      

      (b) ... make local modifications for your extension. Be sure to understand the use of the Ruby keyword super if the superclass' methods need to be called within your method overrides:

      
      require "su_shapes/parametric.rb"
      module MedeekDesign
        module TrussMaker
          class Parametric < CommunityExtensions;;Shapes;;Parametric
            # override methods here
          end
        end
      end
      
      

      I'm not here much anymore.

      1 Reply Last reply Reply Quote 0
      • G Offline
        Garry K
        last edited by 25 Jun 2016, 02:23

        I like to keep my data in a structure and I like to save structures to disk and / or store them as a complete record in a dictionary.

        So you can either parse the file / or parse the dictionary in the same exact way.

        Actually very simple and extremely future proof as they are key pairs. New versions that introduce new fields (elements) need only provide a reasonable default.

        I can provide you with examples if you want to PM me.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        1 / 1
        • First post
          1/3
          Last post
        Buy SketchPlus
        Buy SUbD
        Buy WrapR
        Buy eBook
        Buy Modelur
        Buy Vertex Tools
        Buy SketchCuisine
        Buy FormFonts

        Advertisement