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

Can i draw the whole building structure with code?

Scheduled Pinned Locked Moved Developers' Forum
31 Posts 7 Posters 3.3k 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.
  • C Offline
    chrisglasier
    last edited by 14 Apr 2010, 02:35

    @wdbao said:

    but i like doing it in the bare ruby code
    cause dynamic component is kinda slow
    try to calculate the steel inside a multi-span beam, say six spans
    you will need a super computer for that
    dynamic component certainly make sth more easy to do
    but i am looking for some methods so that i can automated my work

    I suggest you first review your understanding of the structure of coding in order to align your work to it. Think in terms of hierarchies of objects ... slabs, columns, beams ... beams, concrete, rebar ... then add qualifiers and activities as their properties/attributes/methods. You need to think about unique identities and navigation. You will need to automate your navigation as well as the devices that make the calculations and size and position the objects in Sketchup.

    With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

    1 Reply Last reply Reply Quote 0
    • W Offline
      wdbao
      last edited by 29 Apr 2010, 08:19

      @chrisglasier said:

      I suggest you first review your understanding of the structure of coding in order to align your work to it. Think in terms of hierarchies of objects ... slabs, columns, beams ... beams, concrete, rebar ... then add qualifiers and activities as their properties/attributes/methods. You need to think about unique identities and navigation. You will need to automate your navigation as well as the devices that make the calculations and size and position the objects in Sketchup.

      thank you for your suggestion
      I am working in a construction right now. so i am very busy.
      and i am struggling to find time to learn ruby
      but i did have some new ideas for my project
      "Hierarchies of objects" i haven't think of that
      but i think i can define classes like pile\column\beam\slab with the needed property in it, some methods to get the position of the component in a three dimensional world etc.
      more importantly, i want my classes i defined above could access data in spreadsheet.
      in real projects, we may have a lot of spreadsheets from the design institute or the construction company
      and we could totally use those data to automated our work
      anyway using spreadsheet is a faster way to input all the data we needed and it could be done by non-professionals.
      right now i try to take the data about piles which my college put in a spreadsheet and turn it into a model in sketchup which contain all the information needed about the piles of our project.

      1 Reply Last reply Reply Quote 0
      • C Offline
        chrisglasier
        last edited by 29 Apr 2010, 09:30

        Just a few points you might like to consider.

        Objects are used in JavaScript rather than classes but hierarchies of both are important. So are the hierarchies of whatever you are trying to model. For example, does a wall belong to a room or to a floor? It also could belong to a concrete mix or a structure subcontract; a time period or a submission ... To make your data useful it needs to accept multiple links.

        To achieve this in spreadsheets is just too difficult. While in 1989 they became three dimensional with multiple sheets, they never really satisfactorily harboured 3d data. The solution I found was to simply lay down column and row headings side by side in columns. Each column has its own axis; while presented in 2D it actually represents 3D. A column of floor numbers is like a section, an adjacent column of room names like a plan. These columns move so that you can navigate to and manipulate large amounts of data and create as many links and cross links as you need.

        Data in spreadsheets can easily be converted into delimited plain text. If you have many you can create a macro to automate it somewhat. What I mean is that because data is in a spreadsheet don't assume the solution is limited to it. Really plain text is king because it is common to all proprietary and open source applications ... and humans!

        Input can always be done by non-professionals.

        I would suggest you think about a web based application with a Ruby file to work Sketchup.

        With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

        1 Reply Last reply Reply Quote 0
        • W Offline
          wdbao
          last edited by 29 Apr 2010, 10:01

          @chrisglasier said:

          Just a few points you might like to consider.

          Objects are used in JavaScript rather than classes but hierarchies of both are important. So are the hierarchies of whatever you are trying to model. For example, does a wall belong to a room or to a floor? It also could belong to a concrete mix or a structure subcontract; a time period or a submission ... To make your data useful it needs to accept multiple links.

          To achieve this in spreadsheets is just too difficult. While in 1989 they became three dimensional with multiple sheets, they never really satisfactorily harboured 3d data. The solution I found was to simply lay down column and row headings side by side in columns. Each column has its own axis; while presented in 2D it actually represents 3D. A column of floor numbers is like a section, an adjacent column of room names like a plan. These columns move so that you can navigate to and manipulate large amounts of data and create as many links and cross links as you need.

          Data in spreadsheets can easily be converted into delimited plain text. If you have many you can create a macro to automate it somewhat. What I mean is that because data is in a spreadsheet don't assume the solution is limited to it. Really plain text is king because it is common to all proprietary and open source applications ... and humans!

          Input can always be done by non-professionals.

          I would suggest you think about a web based application with a Ruby file to work Sketchup.

          i have read some document about BIM
          and i just read some of webpages about your "namesets"
          the whole thing is a little bit hard for me to grasp all at once, considering i am a not a programmer and i just read some fraction of ruby tutorial
          but i find your ideas very fascinating
          i would definitely look into it

          your ideas about BIM is definitely the way for the future
          but right now i want to improve my existing work flow in my construction business.
          more over i need to come up with sth fast and consolidate myself confident to continue my work and my dream for the future

          1 Reply Last reply Reply Quote 0
          • C Offline
            chrisglasier
            last edited by 30 Apr 2010, 04:23

            A simple image to hopefully explain "while presented in 2D it actually represents 3D"

            pig 027.png

            Of course animation is needed to allow columns to open in a 2D space.

            With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

            1 Reply Last reply Reply Quote 0
            • W Offline
              wdbao
              last edited by 30 Apr 2010, 13:15

              @thomthom said:

              If you're starting out SU scripting you might find this sticky post interesting: http://forums.sketchucation.com/viewtopic.php?f=180&t=10142

              It is a great post
              thank you

              1 Reply Last reply Reply Quote 0
              • W Offline
                wdbao
                last edited by 8 May 2010, 13:48

                I am actually glad you move this into public discussion
                if not boring you, i want to introduce myself more for better understanding:
                i am one of the only two college graduates in my small company and the other one hate English.
                so i am all alone on this.
                and i don't really have a lot of free time. Now i just work as a ordinary builder(one of the construction crews ). so a lot of hard labour and working overtime.
                But i still have a strong desire to learn new things.
                now i just put my original ideas on the table when i have a little free time.
                no more thorough thoughts,
                cause as times move on, i can never keep up with chris on this discussion.
                my original ideas are simply.
                i just want to model the whole building(mainly structural parts) with ruby codes.using scripts i can kill all the boring repeated modelling job once in all. Cause the main components in a concrete structure( the main building structure here in china), like reinforced columns, beams and slabs, are very similar in nature. they all follow some regional Coding( we have our Chinese Designing Coding for concrete) which can be totally represent in scripting codes. and then i can get the information which set the particularity of each component in a special project from the design institute( i am looking this at a construction standpoint).For example, a table of column which contain all the information about columns in a project.
                so it is all set. all i need to do is write the script which respect the Designing Code once, and make sure the data from design institute are readable for my script.
                When i get my model in sketchup for my project. there are three main things i want to do ( Chris, you are right. I really want to "be able to incorporate your research into your day to day work ")
                First, I can use this model to detect any problem before construction from the blueprint passed from the design institute. I believe they call it Collision Detection.
                Second, I can import this model into Synchro or Virtual Builder for construction Management.
                Third, I can use this model to illustrate some construction process.

                I had never been involved with complex data in programming or building design which you need " 3D spreadsheets". Chris, sorry that i still can't fully understand your way of handling complex data. why not just more columns? and information about components are not just 3 dimensionals. Just adding the timeline
                it will turn into 4D.

                i am working in a residential construction site. the structure is simple. so my original idea is to have two different models. One represent the design, one for the building actually constructed. you know for future comparison. and the data of different component are in separate spreadsheet in excel. My starting point is from Piling foundation. I have already have data on spreadsheets which contain the information about the pressed piles, like the actually length, diameter, the date constructed and so on. this is actually a construction record which i asked another college to put it into computer. and i have another file which contain all the coordinate of the piles. originally i use this mainly for surveying and setting out using total station. with this two i think i can construct the piles in sketchup. But i haven't finish the script yet. cause i need to finish my ruby tutorial first and i have some structural analysis to do.
                i think i all i need is a csv reader and the code using this data to form the geometry in sketchup.

                About the nameset. Chris, i download the file. but i don't think it working properly for me. or it just a hmtl problem of my browser. all i see is sth like Cgscsene which helps me to navigate the scene. i didn't see sth like Figure 3 or Figure 4 in your Essay. Never mind, i have read your essay about nameset.
                i believe your main purpose is organize "information that is assembled to direct a physical outcome". I think it's great idea. It really blow my mind. i never think that the information around building can be organize in such a way.
                But i think you need to form a whole new workflow to implement your ideas. i have read some articles about BIM. i think all those new solution is really good for different aspects of the design team to better understanding each other and limiting errors. But they haven't form a good workflow. the old paper oriented method did have its merits. Like some other BIM system, your nameset treat all the information as a unity. But in the specific step of the construction process, we just need a fraction of the information. Like in the setting out stage, we just need one or a few paper to set the position. i know we can extract that part of the information. But that would lead us back into the old workflow. what i mean is we need to consider the overall workflow.

                1 Reply Last reply Reply Quote 0
                • C Offline
                  chrisglasier
                  last edited by 10 May 2010, 04:52

                  Well even for a graduate that was a fine post in English. Actually I met some other Chinese graduates the other night (one came from Foshan btw) who also enjoyed trying out their ideas in English - made me feel very bad only knowing a few words in Cantonese and only two or three in Putonghua. But my main concern is while English is an international language of business, JavaScript is not.

                  What this means is that many are coming up with simple solutions like "drawing a whole building structure with code" without considering how this links in with other persons' simple solutions. The outcome is an unnecessary complexity of simple solutions. My interest is in finding a way to unite the efforts of all so that the complexity is handled by the computer, with only the required information being presented for the task at hand; this means automation.

                  My purpose in sending you the current development of namesets was mainly to demonstrate that we can make machines from HTML and JavaScript - compare banks making ATMs to substitute cheques and cashiers. Of course ATMs only deal with money whereas most of us have to deal with a diverse range of objects and their attributes and properties. This is why structuring the information as hierarchies of objects with key/value records is important both for navigation and automation, and I am afraid adding columns in spreadsheets just doesn't come close.

                  One benefit of such machines is capturing information as close as possible to its source. There need never be ridiculous situations where a designer determines a dimension for a column, draws it in plan and section, sends the drawings to a builder who extracts the information to instruct the setter out. Instead the dimension immediately gets stuck to the column for all to see in whatever format they want to see it. The only change in workflow is omission of duplication. I hope you will like to think about that.

                  With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

                  1 Reply Last reply Reply Quote 0
                  • C Offline
                    chrisglasier
                    last edited by 13 May 2010, 03:41

                    Also for the Ruby part see Automatic Sketchup which is reviewed in this topic.

                    With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

                    1 Reply Last reply Reply Quote 0
                    • C Offline
                      chrisglasier
                      last edited by 13 May 2010, 04:06

                      wdbao, I hope you don't mind my moving our PM discussion here. It just might be of interest to others.

                      In a PM to me
                      @wdbao said:

                      ... i hope i can contribute sth to this nice community
                      but i haven't had much time, most of the time i have to work day and night
                      believe me ...

                      Living in Hong Kong and China for many years I certainly believe you!

                      So I am wondering, in pursuit of the point behind the question in the title, whether you would be better off for the time being just acknowledging that Ruby code can assemble components as a 3D model and concentrate on exploring how to structure data of one of your current projects that will later enable you to so. The same data can be used for buying materials, planning and monitoring progress, instructing labour, supporting payment requests and so on. So you should be able to incorporate your research into your day to day work for the benefit of your business.

                      As I mentioned in one of my PMs I was responsible for fitting out the Forum Hotel in Shenzhen, China - 750 guestrooms and three floors of public spaces - where I put to the test my previous adventures into using spreadsheets for large quantities of data (particularly on Norman Foster's Hong Kong Bank project). This was in 1988 about a year after Lotus introduced their multi-sheet application (123 v 4.0), which initially I thought would greatly help deal with the three dimensional nature of data. But it didn't; let me explain using a simple example of a concrete column by looking at the hierarchies within the data.

                      COLUMN > Width, depth, height, x, y, z;
                      COLUMN > Material, labour, equipment;
                      COLUMN > Start date, duration
                      COLUMN - Material > Concrete, rebar, plywood, struts, clamps;
                      COLUMN - Labour > Steel fixer, carpenter, concretor;

                      Of course this is just the start (yet to list are suppliers, costs, prices, instances of other columns and on and on). It is like you need to keep turning each list through 90 degs alternatively on the XY, XZ and YZ planes; it just doesn't work; either the data overlays other data on the XY plane or is just too difficult to drill down into the underlying sheets in the Z oriented planes.

                      What we did on the Forum Hotel was to list everything in one column only adding data to columns to the right to terminate a hierarchy - e.g. width = 300mm. We set up a number of columns on the left of the data for various indexes to allow us to alternatively sort the data into different aspects of the object in question. One aspect was shop drawings (drawn by hand in those days) which now could be the natural output of structured data as a fully supported Sketchup model. And of course all that tedious sorting can now be avoided by animation.

                      What I realised from our discussion so far was that the menu system I was using for namesets wasn't in line with what I have said. So I have now started to redevelop it. I think the structure is OK for the objects in the nameset itself; it's the backup that assumes devices rather devices being called by the data (or something like that!).

                      Anyway I think if you would like to start to introduce some of what I have said into your day to day work, hopefully quite soon I can take your data and turn it into a nameset ... and then we can use it to start generating Sketchup models. This should then help you learn Ruby coding.

                      With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

                      1 Reply Last reply Reply Quote 0
                      • M Offline
                        minguinhirigue
                        last edited by 8 Jul 2010, 16:16

                        wdbao, any improvment in this big project of yours ?

                        1 Reply Last reply Reply Quote 0
                        • W Offline
                          wdbao
                          last edited by 24 Jul 2010, 15:36

                          @chrisglasier said:

                          Also for the Ruby part see Automatic Sketchup which is reviewed in this topic.

                          been busy with a lot of stuff
                          now i am reading the automatic sketchup, since the author make the pdf file public.
                          it's a really great work.
                          and only now i truely understand the important of hirarchy chris have told me about.

                          1 Reply Last reply Reply Quote 0
                          • W Offline
                            wdbao
                            last edited by 24 Jul 2010, 15:38

                            @minguinhirigue said:

                            wdbao, any improvment in this big project of yours ?

                            progress has been slow
                            now i still looking for ways to read csv files from inside the ruby script
                            and make use of the data in csv files

                            1 Reply Last reply Reply Quote 0
                            • W Offline
                              wdbao
                              last edited by 24 Jul 2010, 16:44

                              it seems to me that Sketchup Ruby API don't have the CSV library.
                              should i just use the File class
                              or should i add the csv module to it
                              and how?

                              1 Reply Last reply Reply Quote 0
                              • C Offline
                                chrisglasier
                                last edited by 25 Jul 2010, 00:09

                                @wdbao said:

                                it seems to me that Sketchup Ruby API don't have the CSV library.
                                should i just use the File class
                                or should i add the csv module to it
                                and how?

                                I used this to collect data from json files (could be csv text files)...

                                @dlg.add_action_callback("send") { |d, a|
                                			nr = Integer(a)
                                			subDir = "nset/"
                                			files = ["config","nset","mset","words","numbers"]
                                			lines = []
                                			file = File.join(File.dirname(__FILE__), files[nr] + ".json")
                                			File.open(file, 'r') do |f1|
                                				while line = f1.gets  
                                					lines.push line  
                                				end
                                			end 
                                			array = [nr,lines]
                                			array = array.join("qq")
                                			#p array
                                			script = "rubyReceive('#{array}')";
                                			d.execute_script(script)
                                
                                

                                I don't know what you mean by csv library.

                                With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

                                1 Reply Last reply Reply Quote 0
                                • W Offline
                                  wdbao
                                  last edited by 25 Jul 2010, 00:31

                                  i mean CSV library as one of the Ruby Standard Library
                                  http://forums.sketchucation.com/viewtopic.php?f=180&t=29544&start=0&hilit=ruby+library

                                  1 Reply Last reply Reply Quote 0
                                  • Dan RathbunD Offline
                                    Dan Rathbun
                                    last edited by 25 Jul 2010, 01:42

                                    @wdbao said:

                                    i mean CSV library as one of the Ruby Standard Library
                                    http://forums.sketchucation.com/viewtopic.php?f=180&t=29544&start=0&hilit=ruby+library

                                    You can add the paths to the full Ruby Library directories, and load from there.
                                    See a script I posted here, tweek it to your system, version etc.
                                    (code) Ruby LOAD PATHs script for (Win32)

                                    You should try to run the same Lib versions as the interpreter that Sketchup loads.
                                    Are you on a Mac/OSX or PC/Win32 ??

                                    I'm not here much anymore.

                                    1 Reply Last reply Reply Quote 0
                                    • Dan RathbunD Offline
                                      Dan Rathbun
                                      last edited by 25 Jul 2010, 01:52

                                      To talk more about your CSV File question, I thought TIG posted an example here somewhere on the forums.

                                      It's not that hard.
                                      As each line of the file is read ( f = file.readline ) the var contains a string, so you'd use the String method .split and specify the character to split by.
                                      record = f.split(',')
                                      At that point the var record is an Array of String values.

                                      It's up to you if you wish to convert each record to Ruby data, line by line; or just collect an Array of record Arrays, close the file, then do your conversions all at once with a nested loop.

                                      I'm not here much anymore.

                                      1 Reply Last reply Reply Quote 0
                                      • W Offline
                                        wdbao
                                        last edited by 28 Jul 2010, 00:14

                                        @dan rathbun said:

                                        To talk more about your CSV File question, I thought TIG posted an example here somewhere on the forums.

                                        It's not that hard.
                                        As each line of the file is read ( f = file.readline ) the var contains a string, so you'd use the String method .split and specify the character to split by.
                                        record = f.split(',')
                                        At that point the var record is an Array of String values.

                                        It's up to you if you wish to convert each record to Ruby data, line by line; or just collect an Array of record Arrays, close the file, then do your conversions all at once with a nested loop.

                                        thanks Dan
                                        it is easy to get the data on csv file this way. or any other files

                                        1 Reply Last reply Reply Quote 0
                                        • Dan RathbunD Offline
                                          Dan Rathbun
                                          last edited by 28 Jul 2010, 00:35

                                          @wdbao said:

                                          thanks Dan
                                          it is easy to get the data on csv file this way. or any other files

                                          Is this a question ??

                                          Do you want examples ??

                                          EDIT: Well, I posted 1 example using Ruby's IO class:
                                          [code] reading a CSV file

                                          I'm not here much anymore.

                                          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