[Plugin] ComponentReporter+.rb

[Plugin] ComponentReporter+.rb

Postby TIG » Wed Nov 21, 2007 3:47 am

I was asked to rehash my old script to make a bigger report. It now makes two csv's - one of the Component Definitions that have been used [def-name, number, description and guid] AND the other of the Instances that have been placed [def-name, inst-name, layer, material, area(of faces), ID and bounding-box's xyz]...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: ComponentReporter+.rb

Postby Howard leslie » Wed Nov 21, 2007 3:48 am

TIG,
Thanks once again for another of your fantastic scripts.
Mega useful
...
Regards
Howard L'
0

Howard leslie 
 

Re: ComponentReporter+.rb

Postby TIG » Wed Nov 21, 2007 3:48 am

Here's v1.1.

It now looks to see if there's a Selection containing at least one Component, if so then you are asked if you want to base the report on the Selection. If 'Yes' then the Instances report is limited to the Selection's Component Instances: if 'No' then a full report is made on all of the Model's Component Instances. In either case a report of all the Model's Components (Definitions) is made first.
0
TIG
User avatar
TIG 
Global Moderator
 

Re: ComponentReporter+.rb

Postby TIG » Wed Nov 21, 2007 3:49 am

Here's v1.2

It now offers the opportunity to 'Mine' down through nested-groups/components - either all or in a selection - and then report on all component instances it finds.
0
TIG
User avatar
TIG 
Global Moderator
 

Re: ComponentReporter+.rb

Postby TIG » Wed Nov 21, 2007 3:50 am

Here's v1.3
Much as v1.2 but...

The error message if the report was already made and left open in Excel so it can't be written to with a new report is now disabled pending a proper implementation.

If the script fails it is likely the cause is this - close the report and re-run.
0
TIG
User avatar
TIG 
Global Moderator
 

Re: ComponentReporter+.rb

Postby TIG » Wed Nov 21, 2007 3:50 am

Here's v1.4

Main Changes:
Report always located with Model.
Miner goes whole depth of nesting.
Commas in names etc trapped into ';'.
3rd report of 'parentage' added.
If any report is already open error now trapped.
0
TIG
User avatar
TIG 
Global Moderator
 

Re: ComponentReporter+.rb

Postby TIG » Wed Nov 21, 2007 3:51 am

Here's v1.5

Areas now report in current units, NOT always sq in.
Note: if you always work in say mm but want areas in say sq m then edit the script around lines ~155-165 - there are guidance notes there on how to fix it easily...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: ComponentReporter+.rb

Postby Didier Bur » Wed Nov 21, 2007 3:52 am

Little typo line 189 "intances" for "instances".
Nice script as always :D
0
Didier Bur (Bytes Farmer)
Ecole Nationale Supérieure d'Architecture de Nancy (F)
http://rld.crai.archi.fr/rubylibrarydepot/
User avatar
Didier Bur 
 

Re: ComponentReporter+.rb

Postby TIG » Wed Nov 21, 2007 3:52 am

Didier Bur wrote:Little typo line 189 "intances" for "instances".
Nice script as always :thup:

Didier

Thanks for those 'eagle-eyes' of yours.

Since the typo is only in the text in an error dialog that shouldn't appear much anyway I'll leave it until v1.6...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: ComponentReporter+.rb

Postby santiagom » Wed Nov 21, 2007 3:53 am

The old component reporter seemed to work on osx, the new one gives me this error. The model is saved.
0

santiagom 
 

Re: ComponentReporter+.rb

Postby TIG » Wed Nov 21, 2007 3:54 am

Here's v1.6.

It sorts out file/folder paths slightly differently, which might avoid the Mac crash. It also corrects the typo in a dialog reported by Didier...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: ComponentReporter+.rb

Postby santiagom » Wed Nov 21, 2007 3:55 am

Works ok now TIG

Thanks a lot
0

santiagom 
 

Re: ComponentReporter+.rb

Postby ClausGS » Sat Jun 20, 2009 9:46 am

santiagom wrote:Works ok now TIG

Thanks a lot


Hi TIG

I have start using the component reporter with some of my projects..
I use it to drag out the size of each component... so that parts is ok..

I like to add some more information to each component so i have tried to add some text in the "NAME" input fild on the "Entity info" window, but that do not show up in the report... can that be fixed???

hope you are still working on this great RB...!!!
0

ClausGS 
 

Re: ComponentReporter+.rb

Postby Buildermax » Sun Jul 19, 2009 7:34 pm

TIG wrote:Here's v1.6.

It sorts out file/folder paths slightly differently, which might avoid the Mac crash. It also corrects the typo in a dialog reported by Didier...


Hi, TIG
I use this reporter a lot, to quantify timber and steel etc. It’s a great tool but I was wondering if numbers or texts(unit, mm) can be fully separated into different spreadsheet cells, So that I can easily get into the numbers? Also, the approximation mark “~”, Can you make that not get exported as well?

Best regards
Max
0
Just love SU

Buildermax 
 

Re: ComponentReporter+.rb

Postby TIG » Sun Jul 19, 2009 10:29 pm

Buildermax wrote:
TIG wrote:Here's v1.6.

It sorts out file/folder paths slightly differently, which might avoid the Mac crash. It also corrects the typo in a dialog reported by Didier...


Hi, TIG
I use this reporter a lot, to quantify timber and steel etc. It’s a great tool but I was wondering if numbers or texts(unit, mm) can be fully separated into different spreadsheet cells, So that I can easily get into the numbers? Also, the approximation mark “~”, Can you make that not get exported as well?

Best regards
Max

It's not something I can do soon... To avoid the units in the numbers you could try changing your unit settings in the Model Info to avoid having 123mm > 123 ? To get rid of the ~ ?

Here's how to do it yourself... You can strip selected text out of a file using a stream-editor technique, here's an example of code that you'd type/paste into the Ruby Console...
[I've just called the file/path 'Temp' and 'Report.csv' for simplicity - yours will be different - you can copy the path/name from the file's properties... BUT note you need to double up any \ to \\ [or make every \ a /] - a single \ is a special-code character in Ruby string-land and it WILL fail to work as expected ! !]
Code: Select all
file1="C:\\Temp\\Report.csv"; file2=File.new("C:\\Temp\\ReportFIXED.csv","w")
IO.readlines(file1).each{|line|file2.puts(line.gsub("mm,", ",").gsub("~", ""))}; file2.close

You should now have the contents of file1 copied into file2 BUT with the 'mm' or '~' missed out...
Note - if it were say '~ 123 mm' just change the gsub details to (" mm,",",") and/or ('~ ',"")...
The reason I choose ("mm,",",") is that I only want to change 'mm' at the end of a field and the separator is a comma

Alternatively, if you are a bit frightened of experimenting with coding then you can simply edit the .csv file using 'open-with' NotePad.exe [it's simply a text file with lines of Comma Separated Variables [CSV] that's readable in Excel etc] and then do a 'Find+Replace' on 'mm,' >>> ',' [Replace all] and '~' >>> '' [Replace all] etc and save it...


Let me know how you get on...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] ComponentReporter+.rb

Postby Buildermax » Mon Jul 20, 2009 4:04 am

Hi, TIG

Thanks for your time and advice but I am not very confident to deal with programming stuff. I prefer to edit the data in excel like the way you suggest, while waiting for the next version. I hope it could be more interactive and controllable.

By the way, to delete tilde ~ (along with some other symbols) by Find and Replace function of MS Excel, a ~ must be added in the selection field first, making it ~~, ~*, and etc.

Regards
0
Just love SU

Buildermax 
 

Re: [Plugin] ComponentReporter+.rb

Postby TIG » Mon Jul 20, 2009 12:04 pm

Buildermax wrote:Hi, TIG

Thanks for your time and advice but I am not very confident to deal with programming stuff. I prefer to edit the data in excel like the way you suggest, while waiting for the next version. I hope it could be more interactive and controllable.

By the way, to delete tilde ~ (along with some other symbols) by Find and Replace function of MS Excel, a ~ must be added in the selection field first, making it ~~, ~*, and etc.

Regards

I wasn't suggesting you used Find+Replace in Excel itself. If you double-click the file icon it will open in Excel, BUT if you open the file using the right-click context-menu 'Open with...', and select NotePad.exe and use the easier Find+Replace there, then save, the file is changed and when you open it in Excel they'll be no 'mm' or '~'. A 'csv' file is NOT a special Excel format, it's written in simple text with commas separated variables ("CSV"), it can most easily be edited with a text editor... However, Excel IS the default program to open csv files when you double-click since they are a special way of getting data out of one application into Excel without the hassle of binary encoding the fields (.tsv is similar = 'tab-separated-variables') !!! I thought you might be a bit wary of coding ! :D However, why not try it on a copy of the file... you'll be proud you did it :P - stand up and be a man ! ;)
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] ComponentReporter+.rb

Postby Walter S. Arnold » Fri Feb 26, 2010 1:01 am

Bump of an old thread, but I want give thanks for this plugin; it really came in handy today.
0

Walter S. Arnold 
 

Re: [Plugin] ComponentReporter+.rb

Postby clayc54 » Mon May 24, 2010 9:26 am

Hi

im using component reporter and im getting some strange behaviour.

i open a new file, drag in a component. do a report. it shows the component. i then add another component with nested components within. do another report. all good.

when i delete the first component and then do a report, all reports show the deletion except the component+report.csv. its appearing to have a memory.

has anyone else experienced this?
0

clayc54 
 

Re: [Plugin] ComponentReporter+.rb

Postby TIG » Mon May 24, 2010 9:39 am

There is a newer '..++' version that might avoid this ?
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] ComponentReporter+.rb

Postby clayc54 » Mon May 24, 2010 12:20 pm

thanks for the reply.

is the ++ version you are talking about v1.6?

i think that is the version i am using.

i just downloaded it from one of your forum posts.
0

clayc54 
 

Re: [Plugin] ComponentReporter+.rb

Postby TIG » Mon May 24, 2010 1:10 pm

No the '++' version is only at v1.1 here it is...
ComponentReporter++.rb

but v1.6 is the latest in the '+' version...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] ComponentReporter+.rb

Postby clayc54 » Mon May 24, 2010 10:18 pm

thanks for your help

i tried the ++ version and it does the same thing.

if i put components in the drawing and then run a report it shows those components in all the CSVs. i then delete all the components in the drawing and add different components. save the file. when i now run the report, component+report.csv adds the new components to the deleted ones, it doesnt delete the components that arent in the drawing anymore. however both parentage and instances CSVs show the correct components.

can anyone else test this scenario on their systems so i can be sure its not something quirky to my system?

also wondering, what is the difference between + and ++ for componentreporter.

just wanted to say that, other than that small hickup, this is an amazing plugin for me as im trying to draw garden designs for community groups. i have all my irrigation components tracked by this plugin. cheers
0

clayc54 
 

Re: [Plugin] ComponentReporter+.rb

Postby pyroluna » Fri Oct 21, 2011 3:03 pm

Hey TIG

thanks for the great plugin

however I discoverd a little bug
if I have an ö in the folder name, the plugin tells me that the file I want to write to is in use.
This is true for the + version and the ++ version

Pyro
0
User avatar
pyroluna 
 

Re: [Plugin] ComponentReporter+.rb

Postby TIG » Fri Oct 21, 2011 6:46 pm

This isn't an error - it's a known limitation of the version of Ruby used by Sketchup.
File paths or file-names containing special characters - like accented letters - cause many 'File' operations to fail.
So you should avoid them because otherwise they will cause file-writing errors or tests for files existing etc to fail.
The reporters' trap for a fail, but assume that the fail is because the file is open, as that's the common cause... :?
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] ComponentReporter+.rb

Postby pyroluna » Tue Oct 25, 2011 9:21 am

ah okay, my bad. Didn't know that. I'll take more care naming my folders in the future :)
0
User avatar
pyroluna 
 

Re: [Plugin] ComponentReporter+.rb

Postby MustangSK » Sun Oct 07, 2012 5:47 am

First post so apologies if I'm in the wrong spot or otherwise. I'm working with the free version of Sketchup for some woodworking projects. I've created components and would like to print out a list and quantities of these. I've downloaded ComponentReporter ++ for this and have run into an error -- I keep getting the "file already open" error. I've checked the folder names, no odd characters. Any guidance would be appreciated. Thanks.
0

MustangSK 
 

Re: [Plugin] ComponentReporter+.rb

Postby TIG » Sun Oct 07, 2012 10:49 am

MustangSK wrote:First post so apologies if I'm in the wrong spot or otherwise. I'm working with the free version of Sketchup for some woodworking projects. I've created components and would like to print out a list and quantities of these. I've downloaded ComponentReporter ++ for this and have run into an error -- I keep getting the "file already open" error. I've checked the folder names, no odd characters. Any guidance would be appreciated. Thanks.
The code tries to make [or 'open'] the CSV file in the same folder as the original SKP, so that it can write the data. If it fails to do this you get the message telling you... The most common reason for the failure is that you have the CSV file already open in Excel. This locks it and prevents anything else writing data to the file - hence the message. Closing the 'open' CSV and then retrying to use it should allow the operation to complete. Another possibility is that the SKP name and/or folder-path contain some non-standard characters [like a 'é' or 'ç'] - the version of Ruby shipped with SketchUp can't cope with these in file/folder paths in its 'File' methods...
Another possibility is that the folder containing the SKP has limited security settings and the system is preventing you from writing the new CSV into it ?? Check/change its settings to 'FULL' in its icon's Properties > Security > Edit dialog...
Also what is the exact SKP file's name/path and the file/folder-path reported in the error message?
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] ComponentReporter+.rb

Postby MustangSK » Sun Oct 07, 2012 3:46 pm

I'm running on Mac OSX (just switched from Windows, so I'm struggling with that). This if the first time I've used the plugin -- no csv files open in Excel. The path on the dialog window is:/component test-Component+Report.csv
Thought this might be due to running the free version? I'll check the security setting in the window (need to figure that out first on the Mac). I appreciate the quick reply and help.
0

MustangSK 
 

Re: [Plugin] ComponentReporter+.rb

Postby TIG » Sun Oct 07, 2012 10:31 pm

Have you saved the model before trying to do this ?
It should use the model's path as the folder for the CSV file...
":/component test-Component+Report.csv"
Doesn't seem right to me ???
I doubt you have unfettered access-rights to the root-directory ?
If you open this SKP and copy+paste + <enter> this into the Ruby Console what do you get ?
m=Sketchup.active_model;p m.title;p File.dirname(m.path);
It should be
"component test"
then a full path to the folder that contains the SKP ?
This should also used for the CSV file's folder-path...
Do you have full-rights to that folder?

Can you also put these two lines into the Ruby Console separately and post the paths...
Sketchup.find_support_file('plugins')
and then
Sketchup.find_support_file('ocean_extension.rb', 'plugins')

Also this to check where Sketchup is actually installed...
Sketchup.find_support_file('.')
and then this
Dir.pwd

:?
0
TIG
User avatar
TIG 
Global Moderator
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Plugins

Who is online

Users browsing this forum: arqbarbaraguimaraes, seasdes and 5 guests

Visit our sponsors: