• Login
sketchucation logo sketchucation
  • Login
๐Ÿค‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Output - Selected Attributes of Dynamic Components to CSV

Scheduled Pinned Locked Moved Developers' Forum
8 Posts 4 Posters 851 Views 4 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.
  • P Offline
    peweuk
    last edited by 16 Dec 2008, 15:38

    I know it is early days yet regarding availability of Dynamic components, and I know there are some Ruby Scripts already available for generating reports of component attributes but.....

    With the ability to easily add attributes to DC, particularly custom attributes, it would be nice if there was a way to do a CSV report where the output was specified by the user. For example a script which would display all available attributes of 'selected components' by attribute name, with a tick box for each. If the box is ticked and the report run, a csv file is produced for all the components selected, showing all the attributes ticked by the user. If a component does not have all the attributes which were ticked, the csv column for that attribute is left empty, if it has none of the attributes ticked, the component is ignored for the purposes of the report.

    I don't think such a script exists - if it does I'd be pleased to hear about it.
    I don't even know (not being a coder) if it is even possible and if it is, how complex it would be to write it, but if there are any script writers interested in undertaking a project like this, again -I'd be pleased to hear.

    1 Reply Last reply Reply Quote 0
    • S Offline
      scottlininger
      last edited by 16 Dec 2008, 16:47

      @peweuk said:

      I don't even know (not being a coder) if it is even possible and if it is, how complex it would be to write it, but if there are any script writers interested in undertaking a project like this, again -I'd be pleased to hear.

      This is quite doable. The Dynamic Components attributes are stored like any other SketchUp attributes, so both existing reporting tools and future ones are able to view (and modify) DC attributes.

      If there are any coders out there who'd like to contribute some time toward building a custom DC reporting tool, I'd be happy to lend technical guidance. It's really just a matter of writing a recursive script that looks at each entity in the drawing or selection and dumping out the attributes of interest.

      Cheers,

      • Scott Lininger
        SketchUp Software Engineer
        Have you visited the Ruby API Docs?
      1 Reply Last reply Reply Quote 0
      • P Offline
        peweuk
        last edited by 16 Dec 2008, 17:03

        Thanks for the input Scott.

        I guessed it would be relatively straightforward for a coder - but did not want to be presumptious.

        Let's hope someone my be interested and have some time to do something ๐Ÿ˜‰

        1 Reply Last reply Reply Quote 0
        • P Offline
          peweuk
          last edited by 30 Dec 2008, 17:16

          ๐Ÿ˜ž

          Does anyone know where I might contact someone who may be interested in doing this โ“

          1 Reply Last reply Reply Quote 0
          • R Offline
            remus
            last edited by 30 Dec 2008, 17:20

            Todd burch and jim would probably be good people to start your enquiries with. If theyre too busy or cant help for whatever reason its probably worth putting out a plea in the ruby forums, as well, as theyre is usually quite a few keen coding types that hang around there.

            http://remusrendering.wordpress.com/

            1 Reply Last reply Reply Quote 0
            • J Offline
              Jim
              last edited by 1 Jan 2009, 15:14

              @unknownuser said:

              If there are any coders out there who'd like to contribute some time toward building a custom DC reporting tool, I'd be happy to lend technical guidance

              Scott, that is a generous offer and difficult to pass on!

              The first part - retrieving the attributes is straightforward, as is the final stage of compiling and writing the file.

              I think the more challenging aspect is coming up with a strategy for creating the WebDialog, filling it with the checkbox form, and then passing the selected options back to Ruby in a cross-platform way.

              If we assume we have a Ruby Array of unique attributes collected from the Components, how best to get the Array into a WebDialog so users can select them for reporting?

              This is something I've been thinking about but haven't investigated - Can the DC Javascripy/Ruby library be used by user-created scripts? Are there possibly some JSON functions in there that we can use for passing strings between Ruby/Javascript?

              Hi

              1 Reply Last reply Reply Quote 0
              • S Offline
                scottlininger
                last edited by 23 Jan 2009, 16:45

                @jim said:

                This is something I've been thinking about but haven't investigated - Can the DC Javascripy/Ruby library be used by user-created scripts? Are there possibly some JSON functions in there that we can use for passing strings between Ruby/Javascript?

                Jim,

                Yes. That's exactly what the Dynamic Components do. You can create a JSON string inside ruby, and then use WebDialog.execute_script to push that data up into javascript and do something with it.

                In this thread we just posted an example script (ruby only, no web dialogs) that might be helpful.

                Cheers,

                • Scott Lininger
                  SketchUp Software Engineer
                  Have you visited the Ruby API Docs?
                1 Reply Last reply Reply Quote 0
                • J Offline
                  Jim
                  last edited by 25 Jan 2009, 14:56

                  Thanks Scott,

                  I just want to make sure.. I was asking if there were routines in the Ruby/Javascript files used by DC's that I could use in my scripts, or are they unavailable outside the DC world?

                  Hi

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

                  Advertisement