• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

Import script to import 300 dae into 1 project

Scheduled Pinned Locked Moved Developers' Forum
27 Posts 11 Posters 20.0k 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.
  • T Offline
    TIG Moderator
    last edited by 24 Nov 2009, 13:15

    It is quite possible to import all of the files in a folder...
    I'll knock something up for you to try...

    TIG

    1 Reply Last reply Reply Quote 0
    • P Offline
      pilou
      last edited by 24 Nov 2009, 17:37

      Seems a very speedy answer solution 😎

      Frenchy Pilou
      Is beautiful that please without concept!
      My Little site :)

      1 Reply Last reply Reply Quote 0
      • T Offline
        TIG Moderator
        last edited by 24 Nov 2009, 18:46

        Here it is:

        import_from_folder.rb

        Run the tool by typing
        import_from_folder
        in the Ruby Console or picking 'Import ALL from Folder' from the File menu.
        In the dialog that appears navigate to the required Folder and pick one
        File of the 'type' to be imported.
        e.g. select any skp, dwg, dxf, kml, dae, 2ds, dem, ddf ...
        ALL files of the 'type' you selected will be imported from that folder
        into the Model.
        Progress of each file is shown in the VCB...

        v1.0 20091124 First issue.

        EDIT:
        See here http://forums.sketchucation.com/viewtopic.php?p=331966#p331966 for latest script...

        TIG

        1 Reply Last reply Reply Quote 0
        • E Offline
          ErwinV
          last edited by 25 Nov 2009, 14:37

          Hi TIG,

          thanks for the script ... you really made my week !!! πŸ‘ πŸ‘
          It is running as we speak and only caveat will relate to my PC's available memory as 100 tiles already generated a 175Mb skp file ... 222 to go πŸ˜‰

          First 50 tiles took only 6 minutes ... manual import took me approx 1 minute per tile even using a shortcut. Seems I was the lazy bastard in the process πŸ˜•

          thanks again,
          Erwin

          1 Reply Last reply Reply Quote 0
          • L Offline
            leixing
            last edited by 23 Dec 2009, 12:38

            @tig said:

            Here it is:

            import_from_folder.rb

            Run the tool by typing
            import_from_folder
            in the Ruby Console or picking 'Import ALL from Folder' from the File menu.
            In the dialog that appears navigate to the required Folder and pick one
            File of the 'type' to be imported.
            e.g. select any skp, dwg, dxf, kml, dae, 2ds, dem, ddf ...
            ALL files of the 'type' you selected will be imported from that folder
            into the Model.
            Progress of each file is shown in the VCB...

            v1.0 20091124 First issue.
            [attachment=0:3uo549ud]<!-- ia0 -->import_from_folder.rb<!-- ia0 -->[/attachment:3uo549ud]

            Yeeh!!very good work!! Tig thank you agian!
            but i also to import photo(jpg png...)in one time.
            please up!

            1 Reply Last reply Reply Quote 0
            • T Offline
              TIG Moderator
              last edited by 23 Dec 2009, 13:50

              @leixing said:

              Yeeh!!very good work!! Tig thank you agian!
              but i also to import photo(jpg png...)in one time.
              please up!

              It's designed for geometry imports, images don't work well...
              To batch import images from a folder to use as materials use massmaterialimporter.rb ...

              TIG

              1 Reply Last reply Reply Quote 0
              • L Offline
                leixing
                last edited by 24 Dec 2009, 14:51

                @tig said:

                @leixing said:

                Yeeh!!very good work!! Tig thank you agian!
                but i also to import photo(jpg png...)in one time.
                please up!

                It's designed for geometry imports, images don't work well...
                To batch import images from a folder to use as materials use massmaterialimporter.rb ...

                thank you for your help!
                i want import photo(jpg png...)in one time because iwant import
                same photos were cut from one picture for look it more clear,if i import one by one i must re scale them to the same big.
                thanks again!

                1 Reply Last reply Reply Quote 0
                • P Offline
                  pdonner
                  last edited by 5 Mar 2010, 08:34

                  @tig said:

                  Here it is:

                  import_from_folder.rb

                  ...

                  v1.0 20091124 First issue.
                  [attachment=0:2cg8uxas]<!-- ia0 -->import_from_folder.rb<!-- ia0 -->[/attachment:2cg8uxas]

                  Hi. I copied a couple of png-files into a folder and tried out this demo. Yes, it imports a png, but not all of them.

                  I'm trying to get into SU ruby scripting, but there seems to be something wrong or missing in my installation or script.

                  Another symptom which could be of the same kind: If I issue a command 'status=Sketchup.active_model.import("c:\temp\test.png",false)' in the Ruby console window, the engine replies with a messagebox saying: 'Image file invalid!'

                  This must be something trivial, but is there someone around who could help me in taking the first steps into this new world.

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    TIG Moderator
                    last edited by 5 Mar 2010, 09:52

                    The importer v1.0 was made to import 'geometry files' only.
                    Images require you to pick a position and a scale - there is no 'automated way' of doing this via import - it must be by entities.add_image - I'll add this to the importer too...

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      TIG Moderator
                      last edited by 5 Mar 2010, 10:39

                      Here's v1.1 it now imports both geometry files AND image files.
                      Images are imported [by type], sized in inches to match their pixel size, and placed in a line along the x-axis [red], spaced out by their widths...
                      EDIT:
                      See here http://forums.sketchucation.com/viewtopic.php?p=331966#p331966 for latest script...

                      TIG

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        TIG Moderator
                        last edited by 5 Mar 2010, 12:43

                        pdonner

                        The batch importer v1.1 here http://forums.sketchucation.com/viewtopic.php?p=229939#p229939
                        now works with images too...

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • P Offline
                          pdonner
                          last edited by 5 Mar 2010, 12:44

                          @tig said:

                          The importer v1.0 was made to import 'geometry files' only.
                          Images require you to pick a position and a scale - there is no 'automated way' of doing this via import - it must be by entities.add_image - I'll add this to the importer too...

                          Thanks, TIG for clever advice. I did this to import a local file, and it worked:

                          objEntities=Sketchup.active_model.entities
                          point = Geom::Point3d.new 10,20,30
                          objEntities.add_image "c:/temp/ypykka800.jpg", point, 300, 300

                          The user interface File > Import... > file open dialog would accept a URL as a file reference. Is there a way of doing that in a SU Ruby script or do I have to get the file first into a local directory?

                          BTW I didn't spot entities.add_image as I don't have a way browsing the reference material. Is there a reference manual in PDF which would be a bit easier to delve into than the online HTML pages?

                          1 Reply Last reply Reply Quote 0
                          • P Offline
                            pdonner
                            last edited by 5 Mar 2010, 12:49

                            @tig said:

                            The batch importer v1.1 here http://forums.sketchucation.com/viewtopic.php?p=229939#p229939
                            now works with images too...

                            Thanks TIG. I'm very grateful for being able to read your scripts as I haven't found a proper SU Ruby tutorial either. And I'm new in Ruby scripting as well, but I do have a useful Ruby tutorial at hand. - Nice language.

                            1 Reply Last reply Reply Quote 0
                            • Chris FullmerC Offline
                              Chris Fullmer
                              last edited by 5 Mar 2010, 15:19

                              I've done two tutorials for this website on beginning ruby. They might have lost their formatting due to some CSS snafu's that might not have beeen entirely resolved.

                              Link Preview Image
                              SketchUcation

                              3D SketchUp Community for Design and Engineering Professionals.

                              favicon

                              (www.sketchucation.com)

                              I also have a series of 6 or so short video clips on YouTube that explain where to begin with writing ruby for SketchUp. It starts with this one:

                              Then there are a few others that get into other simple tasks. I'm not a huge fan of watching YouTube videos actually, but many people seem to find these 5 minute clips useful.

                              Chris

                              Lately you've been tan, suspicious for the winter.
                              All my Plugins I've written

                              1 Reply Last reply Reply Quote 0
                              • P Offline
                                pdonner
                                last edited by 5 Mar 2010, 18:27

                                Sorry for dwelling on a topic which doesn't fall under the heading.

                                Yes, the text versions are really neat and 'readable', but the second one seems to suffer from some CSS problems.

                                Many thanks Chris for the pointer to your highly useful video tutorials. It is quite obvious that these text oriented videos should be looked upon in HD format - as you indicate. Unfortunately I don't get there. When I select 720p HD and choose the Full Screen button this results in an audio only black screen presentation.

                                Found a thread on one of your videos with an embedded YouTube player at http://forums.sketchucation.com/viewtopic.php?f=18&t=25100&p=215249&hilit=+writing+sketchup+ruby+#p215249 That worked excellently without any problem.

                                Checked four of the videos with quite some pain. Assuming that I'm not the only one experiencing this problem, I'm courageous enough to ask if there is anyone out there who could guide me how to play the fine tutorial videos in HD mode?

                                1 Reply Last reply Reply Quote 0
                                • Chris FullmerC Offline
                                  Chris Fullmer
                                  last edited by 5 Mar 2010, 19:21

                                  Generally they just work when you click on the HD button. If they are staying blac, that could mean you need tp upgrade your flash version? or maybe your video card is incompatible? I'm ot really sure. I've never heard of that happening before.

                                  Lately you've been tan, suspicious for the winter.
                                  All my Plugins I've written

                                  1 Reply Last reply Reply Quote 0
                                  • bagateloB Offline
                                    bagatelo
                                    last edited by 6 Mar 2011, 14:00

                                    I can't import 3ds files. This plugin is great anyway....

                                    While the cat's away, the mice will play

                                    1 Reply Last reply Reply Quote 0
                                    • P Offline
                                      peacelim
                                      last edited by 9 Apr 2018, 12:12

                                      Hi!

                                      Tested the latest script (import_from_folder_v1.6.rbz) on sketchup make 2017, doesn't seem to work 😒

                                      Pop up shows that the import was completed but the models could not be found in the scene.

                                      Similarly, I have hundreds of dae files which i would like to import into the scene.

                                      Any help or update would be helpful.

                                      Thanks in advance!
                                      PH

                                      1 Reply Last reply Reply Quote 0
                                      • T Offline
                                        TIG Moderator
                                        last edited by 10 Apr 2018, 19:04

                                        @peacelim said:

                                        Hi!

                                        Tested the latest script (import_from_folder_v1.6.rbz) on sketchup make 2017, doesn't seem to work 😒

                                        Pop up shows that the import was completed but the models could not be found in the scene.

                                        Similarly, I have hundreds of dae files which i would like to import into the scene.

                                        Any help or update would be helpful.

                                        Thanks in advance!
                                        PH

                                        If you look in the model's Component Browser you should see that all of the DAE files will have successfully imported as individual definitions, BUT they will be without any instances.
                                        But that is the nature of multiple imports like this - at least in the newer SketchUp versions.
                                        If you really want to import several DAE files, and add instances, then the attached RBZ is an alternative which does that for you.

                                        Please download and install it... and feedback...


                                        import_from_folder.RBZ

                                        TIG

                                        1 Reply Last reply Reply Quote 0
                                        • jujuJ Offline
                                          juju
                                          last edited by 10 Apr 2018, 20:56

                                          @tig said:

                                          If you really want to import several DAE files, and add instances, then the attached RBZ is an alternative which does that for you.

                                          Please download and install it... and feedback...

                                          Honestly, without contributions of TIG, and other developers like him (please don't be offended if I don't name anyone else specifically, the list would be long) SU just wouldn't be the same. Thanks for your contributions devs!

                                          Save the Earth, it's the only planet with chocolate.

                                          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