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

    Importing excel to SU

    Scheduled Pinned Locked Moved Plugins
    6 Posts 3 Posters 395 Views 3 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.
    • Q Offline
      Qub3
      last edited by

      Hi,

      I'm searching the net for a plugin that can read in sizes of components from excel file and create them in SU. Couldn't get DST Manager to work in SU2015.
      Does anyone here have some solution? I'm going to create 1k-2k different small pieces and it would speed up the process because I have them in excel.

      1 Reply Last reply Reply Quote 0
      • sdmitchS Offline
        sdmitch
        last edited by

        @qub3 said:

        Hi,

        I'm searching the net for a plugin that can read in sizes of components from excel file and create them in SU. Couldn't get DST Manager to work in SU2015.
        Does anyone here have some solution? I'm going to create 1k-2k different small pieces and it would speed up the process because I have them in excel.

        Export the excel file as a .csv and post it. It is simple enough for a plugin to read that file and create the objects when the exact values and there order are know.

        Nothing is worthless, it can always be used as a bad example.

        http://sdmitch.blogspot.com/

        1 Reply Last reply Reply Quote 0
        • Q Offline
          Qub3
          last edited by

          Hi,

          Then I will upload it here. Pretty basic but it will be much more parts and different names. What I would like to to is to iterate trough the file and create components with the given values.


          Examplefile

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

            You've used a ';' as your value-separator rather than a ','
            However you can readily read your file and extract the data from each of the lines - whatever the separator, provided you know what it is and there is no individual-entry value likely to confuse things [even that is fixable, but...]

            Cod-code...

            lines = IO.read(path_to_the_csv_file)
            bits = []
            lines.each{|line|
              data = line.split(';') ### or ANY other separator
              bits << data
            }
            

            The array 'bits' now has each of the csv's lines, represented as an array of each lines values...

            TIG

            1 Reply Last reply Reply Quote 0
            • Q Offline
              Qub3
              last edited by

              Hi,

              Then it must be possible to combine reading in a csv file and drawing with box.rb from Sketchup examples right? I'm really new to this so I have some problem to figure out how to do. Someone who has the possibility?


              SU Examples

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

                Ley's assume from my earlier example 'bits' consists of separate values in the form
                0.0,0.0,1.0
                And that those represent the X,Y,Z values of a point...

                points=[]
                bits.each{|bit|
                  xyz=bit.split(',')
                  xyz.clone.each_with_index{|e, i|
                    xyz[i] = xyz[i].to_f
                  }
                  points << Geom;;Point3d.new(xyz)
                }
                

                'points' is now an array of Point3d values based on converting the CSV lines' strings into three floats, representing XYZ values.
                Assuming that the points are logically ordered you need four for each face of a cube, so you need to have 4 lines x 6 faces, you read the first 4 then the next 4 etc and make a face for each 'set' in turn.
                Points will need to be duplicated doing it this way.
                If you known it's a simple cube then you only need to define the 4 points making the base and in code pushpull that into a 3d form...

                TIG

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

                Advertisement