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

Problem with script

Scheduled Pinned Locked Moved Developers' Forum
9 Posts 3 Posters 400 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.
  • P Offline
    peweuk
    last edited by 3 Jan 2010, 12:36

    Since the introduction of Dynamic components I have been trying to find a script for doing reports for them.

    I came across this and thought I would try it to see what it does

    http://code.google.com/apis/sketchup/docs/tutorial_attrreporting.html

    I am no script writer, and find when I copy and paste the text and save it as an .rb, I get this error message when I start SU (V7)

    @unknownuser said:

    Error Loading File attrreporter.rb
    C:/Program Files/Google/Google SketchUp 7/Plugins/attrreporter.rb:163: syntax error

    Clean up any point rounding weirdness for purposes of display andfilename.split('.').last

                                                                                       ^
    

    C:/Program Files/Google/Google SketchUp 7/Plugins/attrreporter.rb:199: syntax error

    the value of the attribute, or nil if it can't determine that

                                                       ^
    

    C:/Program Files/Google/Google SketchUp 7/Plugins/attrreporter.rb:538: syntax error

    Can any of you script gurus explain the problem and what I need to do to correct it πŸ˜•

    Thanks

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 3 Jan 2010, 16:12

      I don't have this code but there's at least one error in it just before line 163 in the
      def clean_for_xml(value)...
      section, the line
      value = value.gsub(/\'/,''')
      would work as
      value = value.gsub(/\'/,"'")
      Try editing that line with the "'" and see what happens...
      [That's why the html formatted text suddenly goes green after that until it gets another ' in the line ...can****'****t determine that...]

      TIG

      1 Reply Last reply Reply Quote 0
      • P Offline
        peweuk
        last edited by 3 Jan 2010, 20:56

        Thank you very much TIG. Much appreciated.

        I corrected the line as you suggested and the script now loads and works.

        The script produces a report (.csv or .html) which includes all the attributes of all the groups and sub-groups of all the components in the model, with dimensions in imperial measurements.

        What I need is a list of only the groups (and/or sub groups) with a specific attribute (say I had an attribute called 'ReportThis' with a value 'Yes' or 'No'), and to only list some of the other attributes (eg Height, Length, Depth, Cost, Description etc), and the dimensions showing in cm or mm.

        I could extract this information from a full report in .csv using Excel and formulas, but wondered if you, or anyone else could explain how I may add this to the script to do it with a ruby.

        Thanks in advance for any forthcoming assistance.

        1 Reply Last reply Reply Quote 0
        • T Offline
          thomthom
          last edited by 4 Jan 2010, 09:30

          Moved this topic to the Developer section of the forum.

          Thomas Thomassen β€” SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • P Offline
            peweuk
            last edited by 4 Jan 2010, 09:50

            Thanks Thomthom.

            1 Reply Last reply Reply Quote 0
            • T Offline
              thomthom
              last edited by 4 Jan 2010, 09:57

              @peweuk said:

              What I need is a list of only the groups (and/or sub groups) with a specific attribute (say I had an attribute called 'ReportThis' with a value 'Yes' or 'No'), and to only list some of the other attributes (eg Height, Length, Depth, Cost, Description etc), and the dimensions showing in cm or mm.

              This report, does it need to know the group's nesting relationship to each other?

              Thomas Thomassen β€” SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              1 Reply Last reply Reply Quote 0
              • P Offline
                peweuk
                last edited by 4 Jan 2010, 12:14

                I think the answer is - yes.

                What it is for is cabinets.

                Sometimes I make them, and sometimes I buy in.

                I have created some dynamic components for the carcasses. These consist of the various panels which make up the carcasses. Those I buy in could have a Reportthis attribute of 'Yes' for the parent (ie the whole carcass)and 'NO' for the sub-component panels which make it up.

                Those I make could have the Reportthis attribute of the Parent as 'NO' and all the sub-components set to 'Yes'.

                I hope this makes sense πŸ˜‰

                1 Reply Last reply Reply Quote 0
                • T Offline
                  thomthom
                  last edited by 4 Jan 2010, 12:21

                  But can't this already be done in SU with the Generate Report function?

                  Thomas Thomassen β€” SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • P Offline
                    peweuk
                    last edited by 4 Jan 2010, 12:35

                    @unknownuser said:

                    But can't this already be done in SU with the Generate Report function?

                    The problem with the inbuilt report generator is the same as the script referred to above.

                    It is not very flexible, even if you take the option to report on selected components ony, it still includes all the attributes of all the components, and it reports in imperial measurements even if the model is in metric.

                    What I would prefer is a report which is more selective such as the example I detailed above.

                    The problem I am having is finding someone who could modify the above script. 😒

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

                    Advertisement