[Plugin] ComponentReporter++ v1.2
-
@quarch said:
Unfortunately I am having errors in counts for nested components...
example...
3 component 1 in model
1 component 2 inside component 1...
Report returns 3 counts of 1 and 1 count of 2 in stead of 3 counts of 1 and 3 counts of 2
Counts in instances report are correct.
There ARE 3 instances of compo1.
There IS 1 instance of compo2.
You might 'see' 3 of compo2, but these are actually three representations on the same object.
The different reporting formats are a way of covering various bases...If you want it to somehow report things differently, then rework the code as you wish...
It is 'open source' after all... -
TIG,
This is similar to a problem I am having. I want to call up the running length of walls at base (where Y axis would be zero, and which would exclude door openings)or ceiling (which would give total lengths for molding etc). Is it possible to convert the above reporting script into a DCfunction in much the same way as you had created the DCvolume function? You may need specific functions that would take only the sum of lengths of the edges of the outer or inner faces of the wall at the base(ie excluding doors) and at the ceiling (which would include door openings).
-
It wouldn't be so easy...
BUT you can write any custom function you like to add to a DC...
So let's say you want the perimeter of all faces that have a normal==Z_AXIS.reverse [facing down - i,e, the bottom of a ceiling slab] inside a DC you do something like:
require('sketchup') require('dynamiccomponents.rb') if defined?($dc_observers) # Open Dynamic Component Functions (V1) class, only if DC extension is active class DCFunctionsV1 protected # return the perimeter (in inches) of face.normal==Z_AXIS.reverse if not DCFunctionsV1.method_defined?(;perimeter) def perimeter(a) # Usage as DC function; =perimeter() se = @source_entity if se.is_a?(Sketchup;;Group) allfaces = se.entities.grep(Sketchup;;Face) else #component-instance allfaces = se.definition.entities.grep(Sketchup;;Face) end faces=[] allfaces.each{|face| faces << face if face.normal==Z_AXIS.reverse } tr = se.transformation xs = tr.xscale #*** ys = tr.yscale #*** peri = 0.0 faces.each{|face| tlen = 0.0 face.outer_loop.edges.each{|e| elen = e.length # this is an unscaled length slen = elen*(1) #*** adjust for any X/Y scaling in (1) if needed ? tlen += slen } peri += tlen } return peri end end end#class end#if
This takes no notice of any scaling applied to the DC object, reporting the original perimeter...
-
Thanks a million, it worked like a charm.
-
I only need The only modification I would like this plugin would measure diagonal objects properly, instead of bounding box ... and to work with groups also...
Please take a look to another request made by me:
http://sketchucation.com/forums/viewtopic.php?f=323&t=54080&p=490233#p490163
-
@tig said:
Here's a version that might do what you want or be adapted easily...[attachment=0:28vg1yda]<!-- ia0 -->TIG-exportDCs2csv.rb<!-- ia0 -->/attachment:28vg1yda TIG 2011
Script:
TIG-exportDCs2csv.rb
Type:
TIG.exportDCs2csv
in the Ruby Console to run it.
Exports all DCs is the model with a Name,LenX,LenY,LenZ,Layer[s]...
'CSV' file - in the model's folder and named after the model thus:
ModelName.skp >>> ModelNameDCs.csv
If a new model is unsaved the current directory receives the new file.
All Layers used in the DC are listed by name and visible ones marked
thus >>LayerName<<
Edit sep="," if something other than separating comma is desired e.g. ';'
Make sep="\t" if a TSV file is desired and change ext="csv" to ext="tsv".
It uses the current Model Units.
Version:
1.0 20111104 First issue.
TIG
I was unable to generate the report. My model is in decimal> millimeters.
The dynamic component is in cm. Can you tell me what the problem is.(This returns ruby console)
TIG.exportDCs2csv
Error: #<ArgumentError: C:/Program Files (x86)/SketchUp/SketchUp 2013/Plugins/TIG-exportDCs2csv.rb:48:into_l': Cannot convert "23.425196850393703" to Length> C:/Program Files (x86)/SketchUp/SketchUp 2013/Plugins/TIG-exportDCs2csv.rb:48 C:/Program Files (x86)/SketchUp/SketchUp 2013/Plugins/TIG-exportDCs2csv.rb:48:in
exportDCs2csv'
C:/Program Files (x86)/SketchUp/SketchUp 2013/Plugins/TIG-exportDCs2csv.rb:45:ineach' C:/Program Files (x86)/SketchUp/SketchUp 2013/Plugins/TIG-exportDCs2csv.rb:45:in
exportDCs2csv'
(eval):48thanks
-
Do you have ',' set as your decimal-separator, instead of '.' ?
This might cause issues ?? -
@tig said:
Do you have ',' set as your decimal-separator, instead of '.' ?
This might cause issues ??TIG
I did 2 tests
-
drawing from scratch, I think the componet, add option LenX leny, lenz, the report is generated normally.
-
If this same component attributes modify a component value (eg 10 cm to 20 cm lenz), then display the error of failing to convert ...
thanks
pd. I have a component I created and I'm doubling, changing their values to create furniture.
This report would be a solution to export cuts grain orientation panel -
-
@tig said:
Do you have ',' set as your decimal-separator, instead of '.' ?
This might cause issues ??TIG
With separator "," error occurs.
With separator "." export the file, but does not make mmAs coidgo would have to call from the menu?
It would be so?
require 'sketchup.rb'
UI.menu("PlugIns").add_item("Tig Export") {
exportDCs2csv
}Thanks
-
The units are probably arriving in SketchUp base units == inches.
So either multiply your columns in Excel by 25.4 to make mm OR when you a 'length' in inches do something like
sprintf("%.1f", length.to_mm)
so 1.0" >> 25.4 ? -
@tig said:
The units are probably arriving in SketchUp base units == inches.
So either multiply your columns in Excel by 25.4 to make mm OR when you a 'length' in inches do something like
sprintf("%.1f", length.to_mm)
so 1.0" >> 25.4 ?TIG
Thanks for your help.
the ComponentReporter + + plugins I reported in mm but axes x, y, z
You could modify this plugin to me that report LenX leny, lenz,(dynamic attributes)+ material, definition, of what is selected?
in one csv.Thanks again, my knowledge of programming are very beginner
-
This original http://sketchucation.com/forums/viewtopic.php?p=373590#p373590
does some DC attribute data things...
This is a NEWER version...
(c) TIG 2013
Script:
TIG-exportDCs2csv[2].rb
Type into the Ruby Console:
TIG.exportDCs2csv2
OR use
Plugins menu > TIG.exportDCs2csv2
It Exports all Selected DCs' data into a file, as:
Name,LenX,LenY,LenZ,Material,Layer
It uses 'mm' for the XYZ units.
It is a 'CSV' [COMMA separated variable] file - made in the model's folder and named after the model thus:
ModelName.skp >> ModelNameDCs.csv
If a new model is unsaved the current directory receives this new file.
Edit sep="," if something other than separating comma is desired.
Make sep="\t" if a 'TSV' [TAB separated variable] file is desired and change ext="csv" to ext="tsv".
...
-
@tig said:
This original http://sketchucation.com/forums/viewtopic.php?p=373590#p373590
does some DC attribute data things...
This is a NEWER version...
(c) TIG 2013
Script:
TIG-exportDCs2csv[2].rb
Type into the Ruby Console:
TIG.exportDCs2csv2
OR use
Plugins menu > TIG.exportDCs2csv2
It Exports all Selected DCs' data into a file, as:
Name,LenX,LenY,LenZ,Material,Layer
It uses 'mm' for the XYZ units.
It is a 'CSV' [COMMA separated variable] file - made in the model's folder and named after the model thus:
ModelName.skp >> ModelNameDCs.csv
If a new model is unsaved the current directory receives this new file.
Edit sep="," if something other than separating comma is desired.
Make sep="\t" if a 'TSV' [TAB separated variable] file is desired and change ext="csv" to ext="tsv".
...Tig
thank you very much, works perfect.
Just an observation. If doubled within skp component and modify its dimensions (eg. LenX) reports all copies with the same valueDeputy model
Thanks
-
@tig said:
This original http://sketchucation.com/forums/viewtopic.php?p=373590#p373590
does some DC attribute data things...
This is a NEWER version...
(c) TIG 2013
Script:
TIG-exportDCs2csv[2].rb
Type into the Ruby Console:
TIG.exportDCs2csv2
OR use
Plugins menu > TIG.exportDCs2csv2
It Exports all Selected DCs' data into a file, as:
Name,LenX,LenY,LenZ,Material,Layer
It uses 'mm' for the XYZ units.
It is a 'CSV' [COMMA separated variable] file - made in the model's folder and named after the model thus:
ModelName.skp >> ModelNameDCs.csv
If a new model is unsaved the current directory receives this new file.
Edit sep="," if something other than separating comma is desired.
Make sep="\t" if a 'TSV' [TAB separated variable] file is desired and change ext="csv" to ext="tsv".
...TIG
ud can have the report grouped plugin components, adding the name of the group in a new column?
thanks post your feedback -
Hi TIG - Love the plugin! I just recently stumbled on this page and it has been super useful tracking my work! I was wondering if you had the time to help me make a slight tweak? Basically, I want to tidy up the parentage report to display nested components in a more intuitive way similar to the sketchup outliner?. Hopefully the attached image makes sense: It shows only the counts of of instances, and also puts the them to the right of its parent component. This way, I can visually track the hierarchy.
If you have the time, I'd really appreciate the help given that I am not versed in ruby.
Thank you very much!
-
Hi TIG, Thank you so much for your powerful script. I'm using it to do my construction schedules. It helps me a lot. Could you please add a modification that allow me to get volume numbers for components? (my components are solid ready). I don't have much Ruby knowledge and was failed to do it my self.
-
@nghminh81 said:
Hi TIG, Thank you so much for your powerful script. I'm using it to do my construction schedules. It helps me a lot. Could you please add a modification that allow me to get volume numbers for components? (my components are solid ready). I don't have much Ruby knowledge and was failed to do it my self.
Edit the file with Notepad++...
Around line #149 you can see the 'area' code.
You need to add some similar 'volume' code near that, like this:volume=0.0 volume=c.volume if c.volume > 0 # it's always in cu" - to make into something else use a conversion factor like this for cu metres; volume=volume*0.000016387064 # convert it into a string volume=volume.to_s.tr(",",".")### trap for comma as decimal point... # edit line ~ # 166 [remember that it will have shifted down after you entered the new volume code !] ilist.push([dname,iname,lname,cname,id,x,y,z,pname,area,areas].flatten!) # to include volume... ilist.push([dname,iname,lname,cname,id,x,y,z,pname,area,areas,volume].flatten!) # edits the lines making the header text ~ # 178 file.puts("DEFN-NAME,PARENT[NAME<TYPE>],INST-NAME,LAYER,MATERIAL,ID,X,Y,Z,AREA,SUB-MAT-AREAS\n\n")if miner file.puts("DEFN-NAME,INST-NAME,LAYER,MATERIAL,ID,X,Y,Z,AREA,SUB-MAT-AREAS\n\n")if not miner # to read... file.puts("DEFN-NAME,PARENT[NAME<TYPE>],INST-NAME,LAYER,MATERIAL,ID,X,Y,Z,AREA,SUB-MAT-AREAS,VOLUME\n\n")if miner file.puts("DEFN-NAME,INST-NAME,LAYER,MATERIAL,ID,X,Y,Z,AREA,SUB-MAT-AREAS,VOLUME\n\n")if not miner # now edit the code around lines ~ # ilist.each{|c| xx=""; c[10..-1].each{|x|;xx=","+x.to_s} if miner file.puts(c[0]+","+c[8]+","+c[1]+","+c[2]+","+c[3]+","+c[4]+","+c[5]+","+c[6]+","+c[7]+","+c[9]+xx) else file.puts(c[0]+","+c[1]+","+c[2]+","+c[3]+","+c[4]+","+c[5]+","+c[6]+","+c[7]+","+c[9]+xx) end#if } # to read with the extra volume element ... +","+c[-1] ... # -1 says last element in array which we know in the newly added 'volume' string. ilist.each{|c| xx=""; c[10..-1].each{|x|;xx=","+x.to_s} if miner file.puts(c[0]+","+c[8]+","+c[1]+","+c[2]+","+c[3]+","+c[4]+","+c[5]+","+c[6]+","+c[7]+","+c[9]+","+c[-1]+xx) else file.puts(c[0]+","+c[1]+","+c[2]+","+c[3]+","+c[4]+","+c[5]+","+c[6]+","+c[7]+","+c[9]+","+c[-1]+xx) end#if }
Hope that helps...
-
Thanks TIG so much for spending time with my case. Your help make it works perfectly. I've learned many many of Ruby language with your code.
-
Hello TIG
thank you for your time with this plugin.do you think it is possible to list dynamic components and their LenX, LenY, LenZ that are inside another dynamic component?
-
sorry....
Advertisement