[Plugin] TIG-export_SKP_by_layer.rb

[Plugin] TIG-export_SKP_by_layer.rb

Postby TIG » Thu Aug 23, 2012 10:19 am

(c) TIG 2012-2017

TIG-export_SKP_by_layer.rb

Usage: Type into the Ruby Console

TIG.export_SKP_by_layer

Exports everything in the current Model into a set of SKP files 'by Layer',
Faces with Edges on another layer take those Edges with them.
Potential duplicate layer/skp names are suffixed _1 etc...
Unused 'empty' layers are ignored.
The files are named 'modelname-layername.skp'
Only -_a-zA-Z0-9 are used in the file-name, all other characters become '_'

With v2.0 exported SKPs are put into a 'SKP_by_layer' subfolder with the model.

*With v2.0 you can pass an optional argument to save the SKPs as another version
e.g. for SketchUp version 8 SKPs pass 8.

TIG.export_SKP_by_layer(8)

The version passed must be lower than the Current SketchUp version.
Allowable versions are: 8, 2013, 2014, 2015, 2016, 2017.
Note the version passed must be an integer, not a string.
Passing anything else defaults the SKPs to the Current version.
Note: with SketchUp < v2014 a different version cannot be specified,
if one is passed, then it is ignored and it defaults to the Current version.

You might need to manually delete any unwanted SKB/~.SKP backup files in the
sub-folder...


v2.0 20171105
Now compatible with newer versions of SketchUp.
Exported SKPs are put into a 'SKP_by_layer' subfolder with the model.
Optional SKP version argument added to the command*.
Unused Components, Layers & Materials are properly purged from the SKPs.
v2.1 20171105
Layer which exported is not switched ON.
If the SKP's entities is empty a guide-point is added at the ORIGIN.


Download the latest version from the PluginStore

Download

0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby Tobobo » Fri Aug 24, 2012 1:25 pm

Thanks TIG

(14 downloads and no comments :roll: )
0
Toby

Philippians 4:13

I can do everything through him who gives me strength.
User avatar
Tobobo 
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby TIG » Fri Aug 24, 2012 3:11 pm

That's life - ungrateful bunch ! :roll:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby gullfo » Fri Aug 24, 2012 6:27 pm

TIG wrote:That's life - ungrateful bunch ! :roll:

could be we're just a bunch of slackers when it comes to testing and haven't yet checked it out :enlight:
0
User avatar
gullfo 
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby Phil Rader, AIA » Sat Aug 25, 2012 3:25 am

Sounds useful but I don't have a use for it at the moment. Thanks for thinking of useful things even before there is a use for them.

Regards.
0

Phil Rader, AIA 
Premium Member
Premium Member
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby JClements » Mon Aug 27, 2012 5:46 pm

I think it will be useful when a model will need to be used by another application .... provided "meaningful" layer naming has been used.
1
John
Illustrator
Beaverton, Oregon
User avatar
JClements 
Premium Member
Premium Member
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby Rich O Brien » Mon Aug 27, 2012 8:44 pm

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

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby the.pjt » Thu Aug 30, 2012 10:22 pm

thanks a lot TIG .... thanks :thumb:
best for exporting to 3Ds max :sketchstatic:

do you have a plan to make it more ? .. a menu .. a toolbar ..
do you let me creat a Icon for it ?
:P
0

the.pjt 
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby hawamazon » Mon Oct 01, 2012 1:19 pm

Thanks
0

hawamazon 
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby halftonejones » Thu Oct 18, 2012 9:51 pm

Hi TIG,

Using this script, can you export SKP layers as .pdf files?

Thank you.
0
User avatar
halftonejones 
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby TIG » Fri Oct 19, 2012 5:06 pm

halftonejones wrote:Hi TIG,

Using this script, can you export SKP layers as .pdf files?

Thank you.
If you want a PDF there's the built in Print to a 2d vector PDF tools, or use a 2d raster PDF system printer like PDF995 ? The built in version only does edges/faces etc and no shadow info is retained.
You would need to re-construe the code to get a desired layer/view and then NOT use 'export' but rather 'write_image'.
Code: Select all
@model.active_view.refresh
keys={
        :filename => imgpath,
        :width => vpw,
        :height => vph,
        :antialias => false,
        :compression => 0.9
    }
@model.active_view.write_image(keys)
This code snippet taken from Slicer5's export_to_png code is for a PNG file, where 'imgpath' tells us where to save it. The equivalent for a PDF would be similar...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby Larry Bates » Thu Oct 25, 2012 7:16 pm

Thanks TIG! layers to 3DS! yes.
0
User avatar
Larry Bates 
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby StephenM » Fri Nov 09, 2012 11:24 pm

TIG,

I am having trouble finding out where to locate and how to actually use the plugin...

any help would be much appreciated!

thank you,

Stephen
0

StephenM 
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby JClements » Sat Nov 10, 2012 1:51 am

Stephen, does this answer your question?
Example 1. The location where the ruby script needs to be copied to.
Example 2. How to execute the ruby script (ignore the short-keys for the "Window" menu
as these are my custom shortcut key assignments).
0
John
Illustrator
Beaverton, Oregon
User avatar
JClements 
Premium Member
Premium Member
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby TIG » Sat Nov 10, 2012 12:56 pm

I was going to say much the same... but thanks to John !
His explanation is better than mine anyway :roll:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby orthodox32 » Sun Nov 11, 2012 9:27 am

Thank you TIG! I didn't knew i need this one until i read the description! Life saver, really :)
0

orthodox32 
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby StephenM » Mon Nov 12, 2012 4:24 pm

Originally I did that approach and it was not recognizing it... now on a monday morning it works... Figures! haha

The program must have checked out for the week/weekend Friday...

Thank you for the timely response,

Stephen
0

StephenM 
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby matt.gordon320 » Mon Dec 17, 2012 7:20 pm

Thanks TIG!
0

matt.gordon320 
Premium Member
Premium Member
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby MrMitchell » Sun Nov 05, 2017 8:16 am

Tig,

Just a quick question regarding your Layers to SKP plugin:

I have been searching for some ways to get SKP into Revit, and have a couple workflows that I am able to use well currently, however I am trying to just find some quick optimizations and found your old plugin! I am currently using SKP Pro 2015, and just tried your script and this is what the ruby console spat back at me:

TIG.export_SKP_by_layer

Exporting from...
//Mac/Home/Desktop/SKP2RVT/RVT2SKP.skp
as

//Mac/Home/Desktop/SKP2RVT/RVT2SKP-Layer0.skp
Error: #<TypeError: reference to deleted Layers>
C:/Users/*****/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/TIG-export_SKP_by_layer.rb:43:in `purge_unused'
C:/Users/*****/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/TIG-export_SKP_by_layer.rb:43:in `block in export_SKP_by_layer'
C:/Users/*****/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/TIG-export_SKP_by_layer.rb:40:in `each'
C:/Users/*****/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/TIG-export_SKP_by_layer.rb:40:in `export_SKP_by_layer'
<main>:in `<main>'
SketchUp:1:in `eval'

I am using a Mac Laptop with Windows 10 on Parallels if that info helps at all? Anyway, it just creates the first "RVT2SKP-Layer0.skp" file and then stops... I am wondering what is going wrong?

If we can get past this hurdle, one feature I have been looking for in this whole deal is to make sure that whatever files are saved, are saved in SKP8 format :o

Let me know if you can see where I am erring...
Thanks!
0
User avatar
MrMitchell 
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby TIG » Sun Nov 05, 2017 3:31 pm

Updated v2.0 now available.
See first post full full chanage-log: viewtopic.php?p=422953#p422953
v2.0 20171105
Now compatible with newer versions of SketchUp.
Exported SKPs are put into a 'SKP_by_layer' subfolder with the model.
Optional SKP version argument added to the command*.
Unused Components, Layers & Materials are properly purged from the SKPs.

Download

1
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby MrMitchell » Sun Nov 05, 2017 6:00 pm

So, everything is working beautifully on the simpler SKP2RVT file, but something is happening where the more complex SKP2RVT2 file is crashing Sketchup and aborting the process after the Layer0 begins to save. I am attaching both files below.
0
User avatar
MrMitchell 
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby TIG » Sun Nov 05, 2017 6:53 pm

Thanks for the feedback.
At first I thought it was because in the more complex SKP Layer0 is the current layer, BUT it contains NO 'raw' entities using that layer...
You can always try and save an entirely empty SKP... but is not valid and messes up !
However, I trapped for this by adding a single guide-point at the origin, if the SKP has no entities.
BUT this still doesn't work !
I added extra 'Garbage-Collection' but it hasn't helped.

I also noted that 'OFF' layers export, but they are not visible - so I fixed that side-issue !

I also saw that your Styles varied - material by material v. none ... but that makes no difference.

So at the moment I am at a loss to see what's up...

I'll publish v2.1.
Watch out for it...

Please install that.
I expect it'll still BugSplat on some of your files...
Can you submit the BugSplat to Trimble, add an email and also email your full details and the problem SKP and my latest RBZ [with my email-address too] so they have all of the details - they might have some ideas... V2017 is full of new issues that developers are not always aware of...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby MrMitchell » Sun Nov 05, 2017 7:05 pm

I'm currently troubleshooting things on my end as well, I simplified the model by removing all instances of components, nested layers inside components and groups (not ideal, but workable; ideally I could keep a "window" component that is LayerWhatever but have SKP-GLASS and SKP-WINDOWS inside so that if I change one instance of windows in the model, they all update as well...) until I explore more, I can at least have glass groups on SKP-GLASS... I am going to try out 2.1, and start slowly adding complexity again until I break it, but what I also did that seemed to help the most (oddly) was remove all ifc tags, group names, and component definitions? I am attaching the SKP2RVT2 working file below.

One thing I did notice was that for whatever reason in Revit, whenever I brought in the linked SKP, the other layers were still being pulled in (SKP_FLOORS had SKP_DOORS, WINDOWS, etc.) at least on the first linking if I did not choose specify layers to link inside Revit, again, not a problem, I just make sure to only bring in the layers associated with the link, just more FYI.

I will play around with this all tonight.
0
User avatar
MrMitchell 
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby TIG » Sun Nov 05, 2017 7:05 pm

Here's v2.1...

Download


It fixes a few issues in the previous post - however, I suspect that sometimes it might still BugSplat !
Please test and feedback - submit splats too...
1
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] TIG-export_SKP_by_layer.rb

Postby MrMitchell » Mon Nov 06, 2017 6:45 am

TIG, still getting problems here. On more complex production files, the routine ends up bogging down hard, prompting the option to abort the script. On "nested" layers geometry is butchered so that solids are not retained, only bringing in line segments. At least named components in layers do work. I am attaching a "simple complex" file that does work as far as finishing the routine, however, on a large scale file, the process bogs down to untenable, and I have yet to sit through a full cycle of the script running...
0
User avatar
MrMitchell 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Plugins

Who is online

Users browsing this forum: Google Bot, Verbitsky and 31 guests

Visit our sponsors: