by ErwinV » Mon Nov 23, 2009 5:21 pm
Hi all, I'm checking 3D world tiles of different areas all saved in Collada 1.4. I can manually import every single tile but as most areas consist of +300 tiles, I would very much like to have a script that can import a complete directory of import a list of file from a csv file. Is such a script available? I am not a coder/scripter so I would appreciate if someone could help me out. Importing them manually works perfectly, I 'just' want to have this task automated to keep me from getting RSI  thanks, Erwin
-
ErwinV
-
- Posts: 3
- Joined: Mon Nov 23, 2009 4:18 pm
by MartinRinehart » Mon Nov 23, 2009 11:17 pm
ErwinV wrote:I would very much like to have a script that can import a complete directory of import a list of file from a csv file.
I was just searching the Ruby API for File/Import. Love to help you out, but ... Scripters: is File/Import in there?
-
MartinRinehart
-
- Posts: 764
- Joined: Mon Jul 27, 2009 1:13 pm
- Name: MartinRinehart
by TIG » Tue Nov 24, 2009 2:15 pm
It is quite possible to import all of the files in a folder... I'll knock something up for you to try...
TIG
-

TIG
- Global Moderator
-
- Posts: 20272
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- SketchUp version: 2021
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by TIG » Tue Nov 24, 2009 3:35 pm
Here it is: import_from_folder.rbRun the tool by typing import_from_folderin 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 viewtopic.php?p=331966#p331966 for latest script...
Last edited by TIG on Tue Nov 24, 2009 7:46 pm, edited 1 time in total.
TIG
-

TIG
- Global Moderator
-
- Posts: 20272
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- SketchUp version: 2021
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by pilou » Tue Nov 24, 2009 6:37 pm
Seems a very speedy answer solution 
-

pilou
- Top SketchUcator
-
- Posts: 21109
- Joined: Wed Jan 23, 2008 10:33 pm
- Name: Pilou
- Operating system: Windows
- SketchUp version: 2017
- License type: Free/Make
- SketchUp use: hobby
- Level of SketchUp: Advanced
-
by ErwinV » Wed Nov 25, 2009 3:37 pm
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
-
ErwinV
-
- Posts: 3
- Joined: Mon Nov 23, 2009 4:18 pm
by leixing » Wed Dec 23, 2009 1:38 pm
TIG wrote:Here it is: import_from_folder.rbRun the tool by typing import_from_folderin 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. import_from_folder.rb
Yeeh!!very good work!! Tig thank you agian! but i also to import photo(jpg png...)in one time. please up!
-
leixing
-
- Posts: 27
- Joined: Fri Apr 11, 2008 9:24 am
by TIG » Wed Dec 23, 2009 2:50 pm
leixing wrote: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
-

TIG
- Global Moderator
-
- Posts: 20272
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- SketchUp version: 2021
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by leixing » Thu Dec 24, 2009 3:51 pm
TIG wrote:leixing wrote: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!
-
leixing
-
- Posts: 27
- Joined: Fri Apr 11, 2008 9:24 am
by pdonner » Fri Mar 05, 2010 9:34 am
TIG wrote:Here it is: import_from_folder.rb... v1.0 20091124 First issue. import_from_folder.rb
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.
-
pdonner
-
- Posts: 69
- Joined: Tue Feb 02, 2010 8:47 pm
- Location: Iivantiira, Finland
by TIG » Fri Mar 05, 2010 10:52 am
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
-

TIG
- Global Moderator
-
- Posts: 20272
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- SketchUp version: 2021
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by TIG » Fri Mar 05, 2010 11:39 am
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 viewtopic.php?p=331966#p331966 for latest script...
TIG
-

TIG
- Global Moderator
-
- Posts: 20272
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- SketchUp version: 2021
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by pdonner » Fri Mar 05, 2010 1:39 pm
TIG wrote: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?
Last edited by pdonner on Fri Mar 05, 2010 1:44 pm, edited 1 time in total.
-
pdonner
-
- Posts: 69
- Joined: Tue Feb 02, 2010 8:47 pm
- Location: Iivantiira, Finland
by TIG » Fri Mar 05, 2010 1:43 pm
pdonner The batch importer v1.1 here viewtopic.php?p=229939#p229939now works with images too...
TIG
-

TIG
- Global Moderator
-
- Posts: 20272
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- SketchUp version: 2021
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by pdonner » Fri Mar 05, 2010 1:49 pm
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.
-
pdonner
-
- Posts: 69
- Joined: Tue Feb 02, 2010 8:47 pm
- Location: Iivantiira, Finland
by Chris Fullmer » Fri Mar 05, 2010 4:19 pm
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. http://www.sketchucation.com/advanced-tutorials-index/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: http://www.youtube.com/user/ChrisFullmer?feature=mhw4Then 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
-

Chris Fullmer
- SketchUp Team

-
- Posts: 6929
- Joined: Wed Nov 21, 2007 3:21 am
- Location: Boulder, CO
- Name: Chris Fullmer
- Operating system: Windows
- SketchUp version: 2013
- License type: Pro
- SketchUp use: landscape architecture
- Level of SketchUp: Advanced
-
by pdonner » Fri Mar 05, 2010 7:27 pm
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 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?
-
pdonner
-
- Posts: 69
- Joined: Tue Feb 02, 2010 8:47 pm
- Location: Iivantiira, Finland
by Chris Fullmer » Fri Mar 05, 2010 8:21 pm
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.
-

Chris Fullmer
- SketchUp Team

-
- Posts: 6929
- Joined: Wed Nov 21, 2007 3:21 am
- Location: Boulder, CO
- Name: Chris Fullmer
- Operating system: Windows
- SketchUp version: 2013
- License type: Pro
- SketchUp use: landscape architecture
- Level of SketchUp: Advanced
-
by bagatelo » Sun Mar 06, 2011 3:00 pm
I can't import 3ds files. This plugin is great anyway....
While the cat's away, the mice will play
-

bagatelo
-
- Posts: 278
- Joined: Wed Apr 16, 2008 4:55 pm
- Location: São José, Santa Catarina, Brasil
- Name: Alex Henrique
- Operating system: Windows
- SketchUp version: 2015
- License type: Pro
- SketchUp use: interior design
- Level of SketchUp: Advanced
-
by peacelim » Mon Apr 09, 2018 1:12 pm
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
-
peacelim
-
- Posts: 2
- Joined: Fri May 13, 2011 9:46 am
- Name: peacelim
- Operating system: Windows
- SketchUp version: 2017
- License type: Free/Make
- SketchUp use: urban planning
- Level of SketchUp: Intermediate
by TIG » Tue Apr 10, 2018 8:04 pm
peacelim wrote: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...
TIG
-

TIG
- Global Moderator
-
- Posts: 20272
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- SketchUp version: 2021
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by juju » Tue Apr 10, 2018 9:56 pm
TIG wrote: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.
-

juju
- Premium Member

-
- Posts: 2741
- Joined: Mon Oct 22, 2007 1:45 pm
- Location: Durbanville, Cape Town, South Africa.
- Name: Juju
- Operating system: Windows
- SketchUp version: 2021
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Intermediate
by peacelim » Thu Apr 12, 2018 4:29 am
The New Script works like a charm! Thank you TIG! Really like to thanks all developers like TIG for their contributions to make SU a better place/community for all users 
-
peacelim
-
- Posts: 2
- Joined: Fri May 13, 2011 9:46 am
- Name: peacelim
- Operating system: Windows
- SketchUp version: 2017
- License type: Free/Make
- SketchUp use: urban planning
- Level of SketchUp: Intermediate
by Sugareth » Tue Jun 04, 2019 10:29 pm
TIG wrote: 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...
Hi TIG, thanks for writing this plugin. This appears to be broken again in SU2019 Pro. I have imported a bunch of DAE files, which appear in object browser, but it doesn't create instances.
-
Sugareth
-
- Posts: 4
- Joined: Wed Feb 17, 2010 7:50 pm
- Name: Sugareth
by TIG » Tue Jun 04, 2019 10:49 pm
Can you run it with the Ruby Console open and see what is reported in there, if anything...
It should work in v2019...
Do you get a report-file written ? If so what does it say for each file that it imports ?
TIG
-

TIG
- Global Moderator
-
- Posts: 20272
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- SketchUp version: 2021
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by Sugareth » Wed Jun 05, 2019 1:23 am
Hi mate, maybe operator error the first couple of times I tried. Confirmed working in SU2019 Pro both with Collada DAE meshes created in Meshlab and from batch triangulated Collada export from Blender.
-
Sugareth
-
- Posts: 4
- Joined: Wed Feb 17, 2010 7:50 pm
- Name: Sugareth
by Ad Machine » 5 minutes ago
-
Ad Machine
- Robot
-
- Posts: 2012
-
Return to Developers' Forum
|