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

[Plugin] TIG_ReportConverter

Scheduled Pinned Locked Moved Plugins
27 Posts 9 Posters 10.1k Views
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.
  • T Offline
    TIG Moderator
    last edited by 4 Jan 2015, 17:39

    Here's a New Year gift... 😄
    http://sketchucation.com/pluginstore?pln=TIG_ReportConverter It converts the units of Length and Volume entries in a selected Generated Report CSV file into desired format.


    For help use File > TIG::ReportConverter > Help...


    1. Use File > Generate Report... to make a CSV Report file.
      Its units are always 'inches' irrespective of the Model's Units [ Shame on SketchUp ! ].

    2. Launch this tool from File > TIG::ReportConverter > Run...
      In the dialog choose the CSV Report file.
      In the next dialog choose the Units for the Report's Length and Volume,
      e.g. 'cm' and 'm' [initial default is 'm'], OK, then the report is converted to use those units.
      The new copy of the CSV file uses the same name, but with say '[cm+m]' appended.
      It is then opened.

    It can also be run from within code thus:
    TIG::ReportConverter.run(path_to_csv, len_units, vol_units, len_dp, vol_dp, open_boolean)
    the 'units' must be either 'm', 'cm', 'mm', 'inch' or 'feet' [dialog appears if unpassed/nil], the 'dp' sets length/volume decimal-places [uses defaults if unpassed/nil], set 'open' to false when in batch mode.


    From v1.3:
    The cells for VOLUME/X,Y,Z/LENX,LENY,LENZ are now converted 'by-header', rather than by column index.
    So an 'inch' report file that has been manually edited can still be converted, even when column order is changed.
    The default cell 'separator' of a comma [ ,] and for all cells below the first header-row surrounded with "" is used for the converted CSV, BUT the original input CSV can use any separator format - e.g. default "," or plain , or ; or a TAB [ \t] etc...
    It also now forces the CSV encoding into "UTF-8-without-BOM" [>=v2014], so if the CSV file has been edited and ill-advisedly saved as ANSI it will still be read in OK, although note that some obscure Unicode accented-characters might get replaced by '?' where they cannot be converted...

    TIG

    1 Reply Last reply Reply Quote 0
    • S Offline
      schnydix
      last edited by 4 Jan 2015, 18:38

      Thank you Tig Without your tools you all made for us
      I wish you good health and all the best!
      Happiness to you in 2015 !
      I Speak for all millions of free Tig Tools Downloads
      Thank you again for your hard free work
      Esense 3d

      1 Reply Last reply Reply Quote 0
      • R Offline
        RodWall
        last edited by 7 Jan 2015, 13:11

        Hi TIG,

        Unable to get it working....... SU2014. I create csv file. Run Converter, shows me the options I can change, but nothing after that..?

        Regards

        1 Reply Last reply Reply Quote 0
        • T Offline
          TIG Moderator
          last edited by 7 Jan 2015, 13:28

          Please run it with the Ruby Console open and post any errors...
          EDIT: I can make errors too.
          I will issue an update asap...
          EDIT2: The corrected v1.1 is now available in the PluginStore - I fixed a stupid 'dp' typo ! http://sketchucation.com/pluginstore?pln=TIG_ReportConverter This should now once again run OK...
          Sorry for my silly code typo 😳

          TIG

          1 Reply Last reply Reply Quote 0
          • I Offline
            IAho
            last edited by 11 Jan 2015, 12:15

            hi i have this same problem even if i have version 1.1.

            "Unable to get it working....... SU2014. I create csv file. Run Converter, shows me the options I can change, but nothing after that..?"

            it doesnt save the converted version anywhere.

            1 Reply Last reply Reply Quote 0
            • T Offline
              TIG Moderator
              last edited by 11 Jan 2015, 13:56

              @iaho said:

              hi i have this same problem even if i have version 1.1.
              "Unable to get it working....... SU2014. I create csv file. Run Converter, shows me the options I can change, but nothing after that..?"
              it doesnt save the converted version anywhere.
              Does the 'version' under Preferences > Extensions say 1.1 ?
              It should make a copy of the report with a suffix.
              So 'xxxx.csv' becomes 'xxxx[m+m].csv', the copy is made in the original report's location.
              Please run it with the Ruby Console open and pass on any error-messages...
              There was a typo in the earlier version which raised error messages... but v1.1 should now run error-free... 😕
              What units are you trying to use ?
              Do you use '.' or ',' as your decimal-separator etc...
              All of this will be of great help...
              🤓

              TIG

              1 Reply Last reply Reply Quote 0
              • I Offline
                IAho
                last edited by 11 Jan 2015, 17:44

                @unknownuser said:

                ...Extensions say 1.1 ?
                It should make a copy of the report with a suffix.
                So 'xxxx.csv' becomes 'xxxx[m+m].csv', the copy is made in the original report's location.
                Please run it with the Ruby Console open and pass on any error-messages...
                There was a typo in the earlier version which raised error messages... but v1.1 should now run error-free... 😕
                What units are you trying to use ?
                Do you use '.' or ',' as your decimal-separator etc...
                All of this will be of great help...
                🤓

                Error: #<NoMethodError: undefined method empty?' for nil:NilClass> C:/Users/KingOfRajaharju/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/TIG-ReportConverter/TIG-ReportConverter.rb:108:in block in run'
                C:/Users/KingOfRajaharju/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/TIG-ReportConverter/TIG-ReportConverter.rb:106:in each' C:/Users/KingOfRajaharju/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/TIG-ReportConverter/TIG-ReportConverter.rb:106:in each_with_index'
                C:/Users/KingOfRajaharju/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/TIG-ReportConverter/TIG-ReportConverter.rb:106:in run' C:/Users/KingOfRajaharju/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/TIG-ReportConverter/TIG-ReportConverter.rb:17:in block in module:ReportConverter'
                SketchUp:1:in `call'

                What units are you trying to use ? = [mm+m]
                decimal-separator = ","

                IAho

                1 Reply Last reply Reply Quote 0
                • T Offline
                  TIG Moderator
                  last edited by 11 Jan 2015, 20:26

                  Thanks... could you also copy and paste the first 3 rows of the original report CSV [opened in Notepad[++]]
                  I think I know the issue but, just to be sure...

                  I have a fix, but I await your info, which will help considerably...

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • I Offline
                    IAho
                    last edited by 12 Jan 2015, 05:52

                    The attached file size, I hope that it will help ..
                    Thank you for your wonderful work

                    IAho


                    Lenni1.csv

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      TIG Moderator
                      last edited by 12 Jan 2015, 13:05

                      @iaho said:

                      The attached file size, I hope that it will help ..
                      Thank you for your wonderful work

                      IAho
                      As I suspected your report CSV contains some almost empty lines.

                      Rakenne;
                      
                      
                      - pohjalevy, putkipalkki, peitelevy, konsoli, mitat
                      
                      
                      
                      

                      The entity-description has some line breaks, this in turn then gives me a series of lines to process that are not formatted as the others, where I find the length/volume values and adjust them to suit. I need to trap for those... Otherwise the unexpectedly split line and the rest of the line after it are not ordered logically like the usual ones...
                      Watch for an update...

                      TIG

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

                        Here's v1.2
                        http://sketchucation.com/pluginstore?pln=TIG_ReportConverter
                        It's updated to avoid the recently reported issue.
                        If the 'Description', or another cell's value, contained a 'newline' character [\n or \r\n] this confused the parsing of the CSV data - because the lines were read in as separate parts instead of one long entry.
                        Now it checks each line's 'column-count' against that of the header: if they don't match it then appends the next line[s], to recombine any lines split at the faux line-break - so now it's all set right again.
                        The 'newline' remains in the CSV affected cell, as before, but the correct values are now reformatted.

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • I Offline
                          IAho
                          last edited by 14 Jan 2015, 21:24

                          I wonder why ..
                          For some reason, Lenz, a measure of the update will fail. 🤓

                          IAho


                          IAho-Profiilit.csv


                          IAho-Profiilit[mm+m].csv

                          1 Reply Last reply Reply Quote 0
                          • T Offline
                            TIG Moderator
                            last edited by 15 Jan 2015, 11:59

                            These CSV files you have now provided are NOT using Comma-Separated-Variables ' ,' , but use a semi-colon ' ;'.
                            I suspect you have edited them prior to converting them ?
                            The previous ones you supplied were like the ones my SketchUp creates.
                            "A","B","C" etc
                            So my code can then split the file's text at each "," to get the column values it needs to convert; it then rejoins the parts back together using the same separator.
                            SketchUp uses "" around each cell value to ensure any ',' within text cells [like Description] are not confused as value-separators.
                            If you edit your CSV in Notepad++ and replace all ' ;' with ' ","' it will work again...

                            I'll look at adding extra code to find the actual file's 'separator' - defaulted to "," but finding if the first row contains other candidates, like , ; : TAB etc...

                            I also note that you seem to have moved the NAME column next to the VOLUME column ?
                            It usually comes to the right of LENZ.MATERIAL ? This throws off the parsing...
                            Have you manually moved columns ?

                            I also note that your latest CSV files are ANSI nor UTF-8 without BOM, so that adds a layer of failure too - I can re-encode the text in >=v2015...

                            Watch for updates...

                            TIG

                            1 Reply Last reply Reply Quote 0
                            • I Offline
                              IAho
                              last edited by 15 Jan 2015, 12:49

                              Attached to the original file
                              Iaho


                              IAho-Profiilt 2015-01-15.csv

                              1 Reply Last reply Reply Quote 0
                              • T Offline
                                TIG Moderator
                                last edited by 15 Jan 2015, 14:55

                                Your 'original' CSV still has the misplaced NAME column, throwing off LENZ.
                                Also there are either some missing ',' and/or extra doubled=up " characters.
                                e.g.
                                "TOTALS,""-"",""-"",""-"",""-"",""-"",""53.448389"",""-"",""-11.456557"",...
                                should be perhaps:
                                "TOTALS","-","-","-","-","-","53.448389","-","-11.456557",...

                                I can trap for 'out of order' columns, BUT messed-up 'separators' is never going to be resolvable !

                                Is this CSV direct;y out of SketchUp 'Generate Report', or have you edited it...
                                If it's 'raw', then SketchUp is really flaky !

                                I also see there are unusual characters in the earlier ANSI file that might trip up the parsing...
                                e,g, in the TOTALS at the end ...kesä.85...13.heinä [...Summer...Hay 😕 ??]
                                which does not occur in the original UTF-8 CSV ?

                                TIG

                                1 Reply Last reply Reply Quote 0
                                • T Offline
                                  TIG Moderator
                                  last edited by 17 Jan 2015, 14:22

                                  Here's v1.3 http://sketchucation.com/pluginstore?pln=TIG_ReportConverter
                                  It is more robust.
                                  The cells for VOLUME/X,Y,Z/LENX,LENY,LENZ are now converted 'by-header', rather than by column index.
                                  So an 'inch' report file that has been manually edited can still be converted, even when column order is changed.
                                  The default cell 'separator' of a comma [ ,] and for all cells below the first header-row surrounded with "" is used for the converted CSV, BUT the original input CSV can use any separator format - e.g. default "," or plain , or ; or a TAB [ \t] etc...
                                  It also now forces the CSV encoding into "UTF-8-without-BOM" [>=v2014], so if the CSV file has been edited and ill-advisedly saved as ANSI it will still be read in OK, although note that some obscure Unicode accented-characters might get replaced by '?' where they cannot be converted...

                                  TIG

                                  1 Reply Last reply Reply Quote 0
                                  • T Offline
                                    TIG Moderator
                                    last edited by 1 Feb 2015, 14:21

                                    Here's v1.4 http://sketchucation.com/pluginstore?pln=TIG_ReportConverter The encoding fix now only applies in SketchUp >= v2014 [previous typo allowed it to try on earlier versions too!], so this now allows the tool to be used with earlier versions again, but they might have issues with oddly encoded strings in edited descriptions etc...
                                    Also the robustness of the column spotting is improved.

                                    TIG

                                    1 Reply Last reply Reply Quote 0
                                    • B Offline
                                      bealj
                                      last edited by 17 Feb 2015, 20:37

                                      Hello,
                                      I have a question... It's very important!
                                      I have Sketchup 2013 pro (In spanish)
                                      I have download this plugins, because I need the report in meters no inches.
                                      But, when I generate that in excel, it continues to be in inches! I don't know what happens...
                                      Help me please...

                                      1 Reply Last reply Reply Quote 0
                                      • T Offline
                                        TIG Moderator
                                        last edited by 18 Feb 2015, 15:07

                                        @bealj said:

                                        Hello,
                                        I have a question... It's very important!
                                        I have Sketchup 2013 pro (In spanish)
                                        I have download this plugins, because I need the report in meters no inches.
                                        But, when I generate that in excel, it continues to be in inches! I don't know what happens...
                                        Help me please...
                                        Do you have the latest version [v1.4] ?
                                        Do you use a ',' as a decimal-separator - instead of '.' ?
                                        Although I have tested it in both formats and it works for me.
                                        The 'headings' which are converted are the columns X Y Z LENX LENY LENZ and VOLUME ?
                                        Are yours ?
                                        Can you send me the original report CSV [in inches] by Private Message, so I can look into it...

                                        TIG

                                        1 Reply Last reply Reply Quote 0
                                        • T Offline
                                          TIG Moderator
                                          last edited by 7 Mar 2015, 14:35

                                          Here's v1.5 http://sketchucation.com/pluginstore?pln=TIG_ReportConverter
                                          Have have finally tracked down the issue with failures in some locales...
                                          Turns out that although X/Y/Z and LENX etc are common headings in the Generated Report, other headings may be changed to suit a locale - so EN-US's 'ENTITY VOLUME' becomes 'ELEMENTVOLUMEN' in German etc.
                                          The headings are used to find the columns to adjust as the Volume is not consistently put in Column-G.
                                          This fix now looks for a match to /[Vv][Oo][Ll][Uu][Mm][Ee]/ in the column header [this applies to all Latin based alphabets], or a match to 'Volume' translated into various other locales - like RU,JA,KO,CH
                                          Hopefully this will now resolve the issues reported from other locales...

                                          TIG

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

                                          Advertisement