[Plugin] Import ALL from Folder

Re: [Plugin] Import ALL from Folder

Postby driven » Sun Jan 18, 2015 3:32 pm

I only use mac, but...

you could, save each file to 'Trash', close it, then open a new for the next import?

SU should then be starting fresh each time and you don't need to erase any entities?

just a thought, I use the idea in a script...
this is the an extract for Trash on a mac...
Code: Select all
def revert
  trash_copy = (File.expand_path("~/.Trash/" + "." + @orig.title + ".skp")).dup.freeze
  @orig.save(trash_copy)
  Sketchup.send_action("closeDocument:")
  Sketchup.send_action("newDocument:")
end

john
0
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Import ALL from Folder

Postby TIG » Mon Jan 19, 2015 12:12 pm

@Young

You code is overly complicated.
It also has some odd working practices... :?

I am sure I have answered this same query elsewhere...
See the @yuyuwhy posts...
Is it you, but with a different user-name ??
viewtopic.php?p=554042#p554042

This thread explains how to setup an empty model SKP - the order of purging IS important - yours is wrong !
Do that BEFORE importing anything.

It also suggests a sensible approach to the subsequent import, purge and export of each DAE in turn.
If you enclose those actions within a 'model.start_operation(...)' block, BUT afterward each you 'model.abort_operation' it [NOT the usual 'model.commit_operation' it] then the imported data is simply forgotten, but the export is safe because the DAE file is now outside of the SKP's control... So there is no need to purge between each import/export at all.

Recast your code thus...
Make the host SKP empty.
Process the list of DAE files in turn.
Use a model.start_operation(...) block around each iterate step.
Remember to use the model.abort_operation to undo the import etc, but leave the export intact.
You should end up with an empty SKP and all of the DAE files processed.

Incidentally, your code only works in v2015 as the UI folder selector is new in that version's API.
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Import ALL from Folder

Postby YoungOSG » Mon Jan 19, 2015 3:09 pm

driven wrote:I only use mac, but...

you could, save each file to 'Trash', close it, then open a new for the next import?

SU should then be starting fresh each time and you don't need to erase any entities?

just a thought, I use the idea in a script...
this is the an extract for Trash on a mac...
Code: Select all
def revert
  trash_copy = (File.expand_path("~/.Trash/" + "." + @orig.title + ".skp")).dup.freeze
  @orig.save(trash_copy)
  Sketchup.send_action("closeDocument:")
  Sketchup.send_action("newDocument:")
end

john


Thanks!
I tried it.It works fine on my PC,however it crashed on others.
0

YoungOSG 
 

Re: [Plugin] Import ALL from Folder

Postby Rich O Brien » Fri Jan 23, 2015 10:55 pm

This is splatting for me?

No console message. Just splat!

I try nuke my plugins older to isolate
0
There's a frontroom and a backroom....reverse faces
User avatar
Rich O Brien 
Administrator
 

Re: [Plugin] Import ALL from Folder

Postby driven » Fri Jan 23, 2015 11:07 pm

@rich,

maybe your need to watch the tutorial?

john
0
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Import ALL from Folder

Postby Rich O Brien » Fri Jan 23, 2015 11:11 pm

@john

hahahaha

even that didn't help...

I'm trying to import 126 faceme .skp then run components to grid.

I ain't getting past the import all part as yet.

SU2015 64bit Pro in case that helps?
0
There's a frontroom and a backroom....reverse faces
User avatar
Rich O Brien 
Administrator
 

Re: [Plugin] Import ALL from Folder

Postby driven » Fri Jan 23, 2015 11:11 pm

seriously now...
I just tested it and had a splat as well, sent it to trimble...
I'll have a look a the report

john
0
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Import ALL from Folder

Postby Rich O Brien » Fri Jan 23, 2015 11:15 pm

na na nana na
0
There's a frontroom and a backroom....reverse faces
User avatar
Rich O Brien 
Administrator
 

Re: [Plugin] Import ALL from Folder

Postby driven » Fri Jan 23, 2015 11:22 pm

@rich line 101 delete puts re-save, restart...
worked for me
0
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Import ALL from Folder

Postby Rich O Brien » Fri Jan 23, 2015 11:27 pm

nope! splat
0
There's a frontroom and a backroom....reverse faces
User avatar
Rich O Brien 
Administrator
 

Re: [Plugin] Import ALL from Folder

Postby driven » Fri Jan 23, 2015 11:34 pm

keep the puts deleted, but on line 106 add an new line UI.messagebox(name)
try on a small number of skps first
just to see if slowing it down helps...

john
0
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Import ALL from Folder

Postby TIG » Fri Jan 23, 2015 11:57 pm

That means you need to press OK 126 times !
Rich, why not ZIP and email me those 126 SKPs, explain [clearly] what you want to do...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Import ALL from Folder

Postby driven » Sat Jan 24, 2015 12:10 am

@Tig
sorry, just trying to help out, thought you were at pub...

it's failing with only two models to import...

removing the puts helps sometimes,
pre-saving the model helps sometimes,
adding the UI.messagebox helps sometimes...

but if I try a larger folder it bugsplats again...

john
0
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Import ALL from Folder

Postby TIG » Sat Jan 24, 2015 12:12 am

OK, I'll check it out - not a bug reports for years, then three come at once...

Maybe it needs updating...
:?
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Import ALL from Folder

Postby TIG » Sat Jan 24, 2015 2:20 pm

I just revisited this Plugins code.
As it was, it still worked fine for me on multiple SKP imports, but I have made some adjustments because the SKP import could now be more 'streamlined' > SUp v8...

Here's the updated v1.4 RBZ in the PluginStore

Download



Please try it and feedback.

PS: Rich - you can email me the 126 SKPs in a ZIP if you like ?
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Import ALL from Folder

Postby driven » Sat Jan 24, 2015 2:35 pm

bug splat on mac...
there are some weird names, but I import them as a test folder for my icon maker plugin, and they were importing then failing last night...
john
full folder content
Code: Select all
.DS_Store
.png
¨„¶®™_·_Ë‚„‡¢†´Æ¨.skp
¨„¶®™_·_™†°•´•¨.skp
¨„¶®™_·_™†≠®·‚‡Æ©.skp
¨„¶®™_·_™‡†·™Æ©.skp
¨„¶®™_·Æ_·‚•‚Á®™Æ¨_£•©£•‡†.skp
¨„¶®™_®_™‡Î·†.skp
¨„¶®™_≠†_´•·‚≠®Ê•.skp
¨„¶®™_߆_·‚ƴƨ.skp
¨„¶®™®_·_°ÆÁ™†¨®.skp
¨„¶®™®_¢_™Æ´Æ§Ê•.skp
£Æ´Î©_¨„¶®™.skp
file_names from folder.scpt
filenames.txt
Ø®‡Æ‚•Â≠®™.skp
Øƶ†‡≠Ε_·Æ_·‚¢Æ´Æ¨_1.skp
Øƶ†‡≠Ε_·Æ_·‚¢Æ´Æ¨_2.skp
Øƶ†‡≠Ε_·Æ_·‚¢Æ´Æ¨_3.png
Øƶ†‡≠Ε_·Æ_·‚¢Æ´Æ¨_3.skp
Øƶ†‡≠Ω_·_‚ÆØƇƨ.skp
Øƶ†‡≠Ω_·_Æ£≠•‚„Ë®‚•´•¨.skp
Øƶ†‡≠Ω_≠†_Ë•·‚•.skp
Øƶ†‡≠Ω_1.skp
Øƶ†‡≠Ω_2.skp
Øƶ†‡≠Ω_3.skp
Øƶ†‡≠Ω_3~.skp
ru_aviator.skp
ru_blueSanta.skp
ru_garbageCollect.skp
ru_glassman.skp
ru_jackHammer_male.skp
ru_jackHammer.skp
ru_leafBlower.skp
ru_plumBob.skp
ru_surveyor.skp
ru_welder.skp
ru_wheelBarrow.skp
site_logo.png
welder.png
welder.skp
0
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Import ALL from Folder

Postby TIG » Sat Jan 24, 2015 2:50 pm

They are weird SKP names !
What happens with a simpler set of 'sensible' names ??
Maybe I need to try and force the file path's encoding to UTF-8 if >=v2014 ?

Are they all real SKPs ?
Is their version <= SUp version you are using ?
If it's > then you will get an 'empty-skp' message for each one...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Import ALL from Folder

Postby TIG » Sat Jan 24, 2015 3:02 pm

Here's v1.5, it forces the file names to UTF-8 in >v2014 to see if that addresses file-type errors

Download

0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Import ALL from Folder

Postby Rich O Brien » Sat Jan 24, 2015 3:07 pm

I'll email files later.

But no weird characters except _
0
There's a frontroom and a backroom....reverse faces
User avatar
Rich O Brien 
Administrator
 

Re: [Plugin] Import ALL from Folder

Postby driven » Sat Jan 24, 2015 3:33 pm

@tig

no joy, it's failing on even a simple 2 skp, good filenames folder...

the other folder names are deliberately obnoxious to represent a 'user' folder, but the names all show in message bar as they are found...
0
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Import ALL from Folder

Postby TIG » Sat Jan 24, 2015 5:11 pm

So this begs the question, "why does it work OK for me ?"
:roll:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Import ALL from Folder

Postby Rich O Brien » Sat Jan 24, 2015 5:13 pm

You on Win8.1?
0
There's a frontroom and a backroom....reverse faces
User avatar
Rich O Brien 
Administrator
 

Re: [Plugin] Import ALL from Folder

Postby driven » Sat Jan 24, 2015 5:14 pm

TIG wrote:So this begs the question, "why does it work OK for me ?"
:roll:

have you run it on your mac?
0
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Import ALL from Folder

Postby TIG » Sat Jan 24, 2015 5:15 pm

Win7 64bit, v2015 64bit... also works in v8 32bit etc...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Import ALL from Folder

Postby Rich O Brien » Sat Jan 24, 2015 5:28 pm

I won't get near laptop until 9pm.

But I will test then.
0
There's a frontroom and a backroom....reverse faces
User avatar
Rich O Brien 
Administrator
 

Re: [Plugin] Import ALL from Folder

Postby TIG » Sat Jan 24, 2015 7:24 pm

No rush... I'm asleep right now ;)
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Import ALL from Folder

Postby Rich O Brien » Sat Jan 24, 2015 7:34 pm

I won't get near laptop until 9pm.

But I will test then.
0
There's a frontroom and a backroom....reverse faces
User avatar
Rich O Brien 
Administrator
 

Re: [Plugin] Import ALL from Folder

Postby YoungOSG » Sat Jan 31, 2015 2:36 pm

TIG wrote:@Young

You code is overly complicated.
It also has some odd working practices... :?

I am sure I have answered this same query elsewhere...
See the @yuyuwhy posts...
Is it you, but with a different user-name ??
viewtopic.php?p=554042#p554042

This thread explains how to setup an empty model SKP - the order of purging IS important - yours is wrong !
Do that BEFORE importing anything.

It also suggests a sensible approach to the subsequent import, purge and export of each DAE in turn.
If you enclose those actions within a 'model.start_operation(...)' block, BUT afterward each you 'model.abort_operation' it [NOT the usual 'model.commit_operation' it] then the imported data is simply forgotten, but the export is safe because the DAE file is now outside of the SKP's control... So there is no need to purge between each import/export at all.

Recast your code thus...
Make the host SKP empty.
Process the list of DAE files in turn.
Use a model.start_operation(...) block around each iterate step.
Remember to use the model.abort_operation to undo the import etc, but leave the export intact.
You should end up with an empty SKP and all of the DAE files processed.

Incidentally, your code only works in v2015 as the UI folder selector is new in that version's API.



Thanks!! I tried and it works!
And I want to import *.dae file with 2000 jpg.However Sketchup stop at 10%. It do not warn me anything.
could you help me ?
0

YoungOSG 
 

Re: [Plugin] Import ALL from Folder

Postby TIG » Sun Feb 01, 2015 5:08 pm

Here's v1.6

Download

It is overhauled to ensure that SKP file imports do not BugSplat - which was an unpredictable issue with multiple SKP files, especially those including un-purged dross.
Rather than use 'import' for SKP files, it now uses 'load' on them, which adds their definitions to the model and depending on the user's choice, it either leaves them as unused Component-Browser definitions, or it also places an instance of each of them at [0,0,0]...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Import ALL from Folder

Postby McSquizzy » Wed Mar 23, 2016 7:44 pm

This tool is exactly what I am looking for but having problems with it. I am having some issues with collada (.dae) files. The tool seems to operate properly until it completes. Once it has stepped through all of the collada files, it says it has completed but does not render any of the data. I am left with an empty SketchUp model. I am using it with v2014. I have tried this plugin with .skp files and worked perfectly.
0

McSquizzy 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

PreviousNext


 

Return to Plugins

Who is online

Users browsing this forum: teemnoi and 69 guests

Visit our sponsors: