Slice a model to a series of Jpegs
-
Why not use the section-cut tool?
Add a section cut and Move+Ctrl to array copy the section-plane the required number of times.
Then set up the same number of scene-tabs and have the matching section-cut active in each tab.
Then use one of the scene exporter scripts to make jpg/png of all tabs [or export them as that image file-type manually]...
If you want the section-plane to be 'filled in' you can use my SectionCutFace tool on each sectionplane in each tab [each one is made on its own layer so you can have it 'on' in onlt the matching tab]Another possibility would be to have a section-plane in the one scene-tab, at the 'start' and a copy of it at the 'end'. Then export the two scene-tabs as an animation - but exporting to image-files rater than a movie format. Then select say every 3 images as the section-cut animates from the 'start' to the 'end' location ??? [though you can't face the cut with this way]
-
Hey Tig Thanks for the super quick reply. I should have mentioned my application in this case. I am building a High resolution 3d printer with the guys at http:\www.phlatforum.com. The reason your first suggestion does not work is memory issues. We are expecting a high number of sections that will need to be displayed (several 100's to a a few 1000's) The section cut tool and I suspect the cut face tool will choke and crash sketchup. The 3d printer in this case uses a bath of light sensitive resin that will harden when exposed to the proper wavelength of light. So I will indeed need to have the sections faced as well.
I did see your sectionCutFace plugin and it works the best I have seen (and I have tried many in the past week) If there isn't a plugin to do this how easily do you think that plugin can be converted? I am not too familiar with ruby but have used several languages and program for a living so it shouldn't be too bad. I will take a deeper look at the code while I await responses.
-
Now you say what you want...
Have you tried my Slicer tool ?
That slices a form [group/instance] in any of the 3 axes, and makes slice-sections [e.g. these could be 0mm thick at say 50mm c/c or 3mm thick at 3mm c/c].
These slice groups are them laid out flat if you wish, with ref numbers added too.
You would need to zoom. then print each 'flattened' one in turn...I have an update in development [on a back-burner] that makes these 3d slices as components so if you change the 3d assembly the flattened forms match, and the ref-text is 'engraved' flat on the face too...
It wouldn't be so difficult to zoom each flat section and then make a scene-tab to match... you could then 'print' or 'export' those...
-
I ran the slicer plugin and while it took a while it did seem to work. However manually zooming and exporting isn't practical if there is 5,000 slices in a single model. Now if we can find an automated way then we got something
-
I have found a way to mod the slicer script to get what I need. While its not dumping out an image format as I couldn't find a way to import a gem into a script (I am new to ruby so please let me know if there is a way) I ended up going to a custom xml format and displaying direct from the control software. I know svg may have been better but I am not familiar with the format yet and this was quicker to produce. Thank you to everyone who spent some time with this thread.
-
There are tools in the API to output views as images and much more.
See the API docs http://code.google.com/apis/sketchup/docs/...]
Make a folder to hold the images -imgfolder=File.join(File.dirname(model.path),"Images") Dir.mkdir(imgfolder) if not File.exist?(imgfolder)
Iterate through the array of flattened slice groups [you have it made already fromgroups=fslice.entities.to_a
] -groups.each{|group|.....}
.
You can use that within a modified version of Slicer OR make your own standalone tool to work after Slicer is done, working on the pre-selected 'FLAT...' group -groups=model.selection[0].entities.to_a
Processing each 'group' in turn you need to...
Empty the current selection -model.selection.clear
Add the group -model.selection.add(group)
Then change to plan view [parallel] -Sketchup.send_action("viewTop:")
Then useSketchup.send_action("viewZoomToSelection:")
Thenmodel.active_view.camera.perspective=false
With that as the view you can write an image-file - using thegroup.name
as part of its title...
imgname=group.name+".png" imgpath=File.join(imgfolder,imgname) keys={ :filename => imgpath, :width => 640, :height => 480, :antialias => false, :compression => 0.9 } puts imgpath model.active_view.write_image(keys)
Repeat till all groups processed...
Where the keys set whatever values you want...This is only partial code... I'll write a new method for Slicer and post is soon...
-
Here's Slicer v4.3 http://forums.sketchucation.com/viewtopic.php?p=336616#p336616
An Image export option has been added.
Usage:
Run the main Slicer tool and make your flatten slices set.
Then preselect the 'Flat-Slice-nnnnnnnn' group and type into Ruby Console:Slicer::images
It then makes .png image files of 0.9 quality, with no anti-aliasing, each named after the slice; all within a folder with the model, named 'ModelName-Slice-Images-nnnnnnnn'. All images are made the same size [based on the screen] with the relative size of each slice maintained in the 'pixel sizes', so subsequent auto-cropping of the white-space leaves images that are all 'relatively sized'...
Tip: use a Style with a white '[back]ground', no profiles, no extensions, no endpoints etc so the images are as sharp as possible.If you what something other than a .png image you can easily edit the code to make say .jpg images...
-
So no problem of proportion if I print these images?
A square will be a square when printed? -
@unknownuser said:
So no problem of proportion if I print these images?
A square will be a square when printed?Should be - at least within 1 pixel as that's the accuracy we can write and image at
If you have say a 1m square slice [max size] in a set of slices that goes down to a 100mm x 100mm square [min size], whilst every image might be 1200px x 1700px from your screen-size - the max square might be represented by a 1100px square, centered within its larger image-rectangle... BUT the min square will also be 'pro rata' and occupy only a 110px square, also centered in its image-rectangle. So if you print the images at 'full size' [or for that matter any reduced/enlarged format, provided that 'scaling' is consistently used for all the images] then the resulting slice of each image-print will remain at the correct relative size, when compared to the other slices...
To save printing materials you could also pass all of your images through a batch-editor [e.g. a Gimp plugin] which could auto-crop all of them to remove the outer 'white-space' around the images' slice-pixels. Images could then be combined onto one sheet [knowing that they are all relatively sized to one another]... so that when printed off you'll use a lot fewer sheets of paper/card/board etc. The small reference number appears at the bottom left of all of the slices so you can sort out which is which when you are trying to reassemble them later -
Tig, You are awesome! Thank you so much for your help. I will grab the new version and try it as soon as I can.
-
Tig, this is a fantastic addition to an already wonderful tool.
I'm mobile for a while so can't actually test it but will as soon as I get near a computer.But, from my read of what's happening here I thought I could make one suggestion.
For those of us that do use slices for construction quite often, exporting at full size in .DWG or various other formats would be a Godsend. I know you mentioned being able to chage that in the ruby, but I for one wouldn't have a clue how.
Just to explain the usage I see for it.
Take a model of Churchill's famous figure. Slice it and export just the lines of the slices in a format that can be read one to one by a plotter/vinyl cutter or a laser engraver/cutter.
This can then be used to construct a life size, layered replica.I actually do it manually with layers of glass, but I see so many uses for it.
Up till now I have been manually transfering each section and converting it, it's a lot of work.
-
At the moment it only writes images [i.e. any of the types supported by SUp = png, jpg, tif, bmp etc] - it defaults to 'png'... but a simple edit of a line of code allows any other type too...
Rather than the latest
Slicer::images
we could envisage a similar toolSlicer::dxfs
[or ::whatever_format_you_need], with appropriate adjustments to the code so that it export each flattened-slice as a separate file, like a 'dxf' or whatever...Let me know how you might see this evolving...
-
Excellent Tig, thanks, it's nice to know you will look at it.
I'm at sea again for a while but will get back home eventually and I'll sort out the best exports for what I do. Off the top of my head I know .dwg work for my plotter, not sure of the file format for the laser cutter, don't actually have it in hand yet, but it will be capable of cutting 900mm wide by 2000mm long.
In the meanwhile, if anyone else sees the benefits and knows the format they need.......Sorry, hate using a phone for this stuff, typing is a pain, and satellite connection is so hit and miss.
Advertisement