sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Report face surface

    Scheduled Pinned Locked Moved Plugins
    26 Posts 6 Posters 1.4k Views 6 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.
    • F Offline
      flyman
      last edited by

      hi,
      any solution ?
      please

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        <span class="syntaxdefault"></span><span class="syntaxkeyword">class&nbsp;</span><span class="syntaxdefault">FaceReport<br />&nbsp;def&nbsp;initialize</span><span class="syntaxkeyword">()<br />&nbsp;&nbsp;</span><span class="syntaxdefault">model</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model<br />&nbsp;&nbsp;ss</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">selection<br />&nbsp;&nbsp;faces</span><span class="syntaxkeyword">=[];&nbsp;</span><span class="syntaxdefault">ss</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each</span><span class="syntaxkeyword">{|</span><span class="syntaxdefault">e</span><span class="syntaxkeyword">|</span><span class="syntaxdefault">faces&nbsp;</span><span class="syntaxkeyword"><<&nbsp;</span><span class="syntaxdefault">e&nbsp;</span><span class="syntaxkeyword">if&nbsp;</span><span class="syntaxdefault">e</span><span class="syntaxkeyword">.class==</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Face</span><span class="syntaxkeyword">}<br />&nbsp;&nbsp;</span><span class="syntaxdefault">text</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"FACE,ORIN,AREA,MATL\n"<br />&nbsp;&nbsp;</span><span class="syntaxdefault">faces</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each</span><span class="syntaxkeyword">{|</span><span class="syntaxdefault">face</span><span class="syntaxkeyword">|<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="syntaxdefault">name</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">face</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">to_s<br />&nbsp;&nbsp;&nbsp;&nbsp;orin</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">face</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">normal</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">to_s<br />&nbsp;&nbsp;&nbsp;&nbsp;area</span><span class="syntaxkeyword">=(</span><span class="syntaxdefault">face</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">area&nbsp;</span><span class="syntaxkeyword">*&nbsp;</span><span class="syntaxdefault">0.00064516</span><span class="syntaxkeyword">).</span><span class="syntaxdefault">to_s<br />&nbsp;&nbsp;&nbsp;&nbsp;matl</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"<NIL>"</span><span class="syntaxkeyword">;&nbsp;</span><span class="syntaxdefault">matl</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">face</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">material</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">display_name&nbsp;</span><span class="syntaxkeyword">if&nbsp;</span><span class="syntaxdefault">face</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">material<br />&nbsp;&nbsp;&nbsp;&nbsp;text&nbsp;</span><span class="syntaxkeyword">=&nbsp;</span><span class="syntaxdefault">text</span><span class="syntaxkeyword">+</span><span class="syntaxdefault">name</span><span class="syntaxkeyword">+</span><span class="syntaxstring">","</span><span class="syntaxkeyword">+</span><span class="syntaxdefault">orin</span><span class="syntaxkeyword">+</span><span class="syntaxstring">","</span><span class="syntaxkeyword">+</span><span class="syntaxdefault">area</span><span class="syntaxkeyword">+</span><span class="syntaxstring">","</span><span class="syntaxkeyword">+</span><span class="syntaxdefault">matl</span><span class="syntaxkeyword">+</span><span class="syntaxstring">"\n"<br />&nbsp;&nbsp;</span><span class="syntaxkeyword">}<br />&nbsp;&nbsp;</span><span class="syntaxdefault">puts&nbsp;text<br />&nbsp;&nbsp;</span><span class="syntaxkeyword">return&nbsp;</span><span class="syntaxdefault">nil<br />&nbsp;end</span><span class="syntaxcomment">#def<br /></span><span class="syntaxdefault">end</span><span class="syntaxcomment">#class&nbsp;</span><span class="syntaxdefault"></span>
        

        Copy/Paste this code into a file called 'FaceReport.rb' in the Plugins folder.
        To use it open your .SKP, Select the faces to report on and open the Window >> Ruby Console and type 'FaceReport.new'
        It will list the faces in a comma separated set of lines, by reference,orientation,area,material.
        Note that you will need to do some work on the following:
        'reference' - I don't see this as much use?
        'orientation' - this is currently the 'face.normal' BUT can be converted into a compass direction with some mathematics as every 'normal' makes an angle with the X/Y/Z axes... Instead of N/S/E/W etc why not get the 'angle' in degrees ?
        'area' - this reports in square metres BUT you might want to format it to a number of decimal-places ?
        'material' - this reports the material name or '<NIL>' if it's the default-material.
        You can also easily 'puts' the text of the report into an external .CSV file if desired...

        TIG

        1 Reply Last reply Reply Quote 0
        • F Offline
          flyman
          last edited by

          great,
          now i tried.
          thanks
          flyman

          1 Reply Last reply Reply Quote 0
          • F Offline
            flyman
            last edited by

            Yesssssssssss, it work.

            For surface in mq is ok but with two decimal like this "mq. 1234,56"

            For orientation i have thought about this scheme: the value x y understood in the red quadrant brings value in "NE" , the value x y understood in the yellow quadrant brings value in "N" etc etc, but i don't know the language ruby and I am not able to resolve the problem.

            Can you help me yet again ?

            Thanks
            flyman


            schema.png

            1 Reply Last reply Reply Quote 0
            • TIGT Offline
              TIG Moderator
              last edited by

              I see if I have a spare slot over the next few days...

              It's relatively easy to format the area text to 2 dp.
              You have come up with the N/S?E/W etc orientation testing I was expecting [I AM ahead of you 😉 ]
              ...

              Meanwhile think about what you want in terms of an 'output' [e.g. a 'file' ??]

              TIG

              1 Reply Last reply Reply Quote 0
              • F Offline
                flyman
                last edited by

                hi
                sorry bu i not understand "You have come up with the N/S?E/W etc orientation testing I was expecting [I AM ahead of you 😉 ]
                ..."
                My english language is bad ,my scholastic studies are ago of many years.

                thanks
                flyman

                1 Reply Last reply Reply Quote 0
                • TIGT Offline
                  TIG Moderator
                  last edited by

                  I meant that you had worked out the orientation ranges that I had already drafted out...
                  I'll try and look at this for you tomorrow...
                  [What is you native language?]

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • F Offline
                    flyman
                    last edited by

                    Thanks you very very much for your work!

                    I'm an Italian architect, helped by his son (that is writing this answer!)

                    1 Reply Last reply Reply Quote 0
                    • TIGT Offline
                      TIG Moderator
                      last edited by

                      @flyman said:

                      Thanks you very very much for your work!
                      I'm an Italian architect, helped by his son (that is writing this answer!)

                      I shall post messages in English with Italian translations [my bad translation!] for you, from now on... 😉
                      Devo postare i messaggi in Inglese con traduzione Italiana [la mia traduzione difettosa] per voi, d'ora in poi 😉 😉

                      TIG

                      1 Reply Last reply Reply Quote 0
                      • TIGT Offline
                        TIG Moderator
                        last edited by

                        Flyman

                        Here is my script that should do what you want - put it into the 'Plugins' folder and follow the instructions...
                        Qui è mia script che se io dà che cosa volete - messo esso nel 'Plugins' e segue le istruzioni...

                        c) TIG 2011

                        RelazioneFacce.rb

                        To use type 'relazionefacce' in the Ruby Console.
                        It makes a report of all selected faces.
                        By Reference, Orientation, Area [sqm to 2 dp] and Material.
                        This is printed in the Ruby Console.
                        If the SKP has been saved a TSV file is made with it and it is
                        automatically opened.
                        Note that all text is in Italian.

                        Per utilizzare scrivere 'relazionefacce' nella Console di Ruby.
                        Si fa un report di tutte le facce selezionate.
                        Con Riferimento, Orientamento, Area [mq a 2 dp] e Materiale.
                        Questo è stampato nella Console di Ruby.
                        Se il SKP è stato salvato un file TSV è fatto con esso e si apre
                        automaticamente.
                        Notare che tutto il testo è in italiano.

                        Donations by PayPal to info @ revitrev.org

                        Version 1.0 20110203 First Issue.
                        ---RelazioneFacce.rb

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • EarthMoverE Offline
                          EarthMover
                          last edited by

                          TIG - You are a hell of a guy! Your generosity is truly inspiring. ☀

                          3D Artist at Clearstory 3D Imaging
                          Guide Tool at Winning With Sketchup
                          Content Creator at Skapeup

                          1 Reply Last reply Reply Quote 0
                          • Didier BurD Offline
                            Didier Bur
                            last edited by

                            My 2 cents:
                            This one will output the same TSV file as TIG's, but sorted by orientation, adds a sub-total per orientation and a general total at the end.

                            afflitto, non parlo italiano 😄

                            Enjoy!


                            RelazioneFacceSortedTotal.zip

                            DB

                            1 Reply Last reply Reply Quote 0
                            • F Offline
                              flyman
                              last edited by

                              I could NEVER expect a so "fast-in-make" and "match-to-my-desire" script! 😍

                              You can't imagine how many hour I can earn by this script... Much, much thanks to TIG and to DidierBur!

                              This script-making-story has interested me in Ruby. It is difficult to learn? Because I had 20 years old a good experience in Autolisp (programming language for Autocad).
                              And, abusing of you time and kindness, are there any Ruby's manual-tutorial? 😆

                              Another thanks to everybody!
                              flyman

                              1 Reply Last reply Reply Quote 0
                              • Didier BurD Offline
                                Didier Bur
                                last edited by

                                Hi,
                                I also had long time ago some experience with Autolisp and learned to program with it.
                                Some books including tutorials can be found here: http://rhin.crai.archi.fr/rld/automatic_SketchUp.php
                                some links here: http://rhin.crai.archi.fr/rld/links_ruby_sites.php
                                some plugins links here:http://rhin.crai.archi.fr/rld/links_plugins_sites.php
                                and last but not least: http://forums.sketchucation.com/viewtopic.php?f=180&t=10142
                                If you have some knowledge in Autolip and OO programming, Ruby is quite easy to learn (IMHO).
                                Regards,

                                DB

                                1 Reply Last reply Reply Quote 0
                                • L Offline
                                  ledisnomad
                                  last edited by

                                  I'm always amazed at how quickly questions and requests get answered here at SketchUcation!

                                  This script, modified a little, is serving me well as a way to get the areas of my master plan models. However, not being familiar with Ruby, yet, I wonder what it would take to do the following: sum the area each material.

                                  To put it another way, I'd like a report that reads:
                                  There is 460.33sf of material 01.
                                  There is 230.15sf of material 02.
                                  etc.

                                  And it would have to work with groups and components and exclude back-faces... that's the part that makes me hesitate to try to do it myself, not knowing Ruby, yet. What do y'all think?

                                  1 Reply Last reply Reply Quote 0
                                  • Didier BurD Offline
                                    Didier Bur
                                    last edited by

                                    Hi,
                                    Actually you can select a face with some material, then right-click and choose 'select all with same material', then display the 'entity info' window where you'll get the corresponding area. But that's a manual process.
                                    aaa.gif
                                    I think it will be a good starting idea for you to learn Ruby. Download some scripts related to materials and start from them.

                                    DB

                                    1 Reply Last reply Reply Quote 0
                                    • L Offline
                                      ledisnomad
                                      last edited by

                                      The select all with same material only works in the current context, not in components and groups, but thanks for the suggestion.

                                      1 Reply Last reply Reply Quote 0
                                      • Didier BurD Offline
                                        Didier Bur
                                        last edited by

                                        Here is a quick script that sums areas by material. It doesn't dig into groups or comps.


                                        areas_mats.zip

                                        DB

                                        1 Reply Last reply Reply Quote 0
                                        • TIGT Offline
                                          TIG Moderator
                                          last edited by

                                          To find areas of materials inside groups/components... [pseudo-coded]

                                          txt=""
                                          model.definitions.each{|defn|
                                            insts=defn.instances
                                            num=insts.length
                                            next if num==0
                                            mats=[]
                                            defn.entities.each{|e|
                                              next if not e.class==Sketchup;;Face
                                              mats << [e.material, e.area] 
                                            }
                                            txt << num.to_s+"\n"
                                            mats.each{|m| txt << m[0]+","+m[1]+"\n" }
                                          }
                                          ###...
                                          puts txt
                                          

                                          and so on to assemble a list of materials with areas within definitions. multiply by 'num' to get total area of all instances of each definition etc etc...........

                                          TIG

                                          1 Reply Last reply Reply Quote 0
                                          • Didier BurD Offline
                                            Didier Bur
                                            last edited by

                                            @unknownuser said:

                                            multiply by 'num' to get total area of all instances
                                            Not that simple, don't forget that instances can be scaled...

                                            DB

                                            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