Slice up an object

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
bulke
Posts: 2
Joined: Tue Jul 29, 2014 8:44 am

Slice up an object

Post by bulke »

Hi all
is there a way to get the slices(few µm thicknes) from an object?
Something like a screenshots from one axis, in TIFF for example?

Nikola

OS: Windows 7
Word size: 32-bit
Version: 0.14.3692 (Git)
Branch: releases/FreeCAD-0-14
Hash: 5fe6e0c48f621f1136595e47cc8d7346090e7456
Python version: 2.6.2
Qt version: 4.5.2
Coin version: 3.1.0
SoQt version: 1.4.1
OCC version: 6.5.1
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Slice up an object

Post by wmayer »

Hi Nicola,

in the Part workbench you'll find the command "Cross-sections". in the top part of the panel you can choose the section plane either parallel to XY, XZ or YZ plane and the start position. For multiple sections (what you want to do) activate the second part. There you can define the numbers of sections and the distance between them.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Slice up an object

Post by jmaustpc »

Hi Nicola
I was going to say what Werner did which gives you a line drawing style cross-section, like you would see in a 2d printed drawing, or 2D CAD program. I was wondering if that was what you meant, or did you mean that you actually want a 3d solid created from a slice of another solid? For example, did you want to produce a 3d model of something like a gasket?

If so you can do this
1) create a standard Part Box (a solid cube) in the part work bench
2) adjust its height to the thickness of the cross-section you require (assuming the slice is parallel to the xy plane)
3) adjust the width and length such that they are much larger than the overall dimensions of your solid.
4) depending on your exact example, you may need to adjust the position values in all 3 axes.
5) assuming your slice is parallel to the xy plane, adjust the z position value until you Part Box is at the correct height.
6) select the solid to be sliced and the Part Box, then click on the Boolean "common" in the Part Work bench.

The result will be a 3d solid slice.

Jim
bulke
Posts: 2
Joined: Tue Jul 29, 2014 8:44 am

Re: Slice up an object

Post by bulke »

Hi,
sorry for VEEERY late replay!
I didnt deal with this issues for a while and I just revisited it again and saw your replays, many thanks.
jmaustpc wrote:Hi Nicola
I was going to say what Werner did which gives you a line drawing style cross-section, like you would see in a 2d printed drawing, or 2D CAD program. I was wondering if that was what you meant, or did you mean that you actually want a 3d solid created from a slice of another solid? For example, did you want to produce a 3d model of something like a gasket?
Jim
Its something in Werner´s direction but a bit different.

This is what I need, from 3d model -> set of images (2bit would be perfect)
Attachments
freecad-forum2.jpg
freecad-forum2.jpg (42.63 KiB) Viewed 4429 times
User avatar
quick61
Veteran
Posts: 3803
Joined: Sat Aug 24, 2013 2:49 am
Location: u.S.A.

Re: Slice up an object

Post by quick61 »

Ah, your looking for a slicer tool like the sketchup plugin. I had mentioned this some time ago and have always thought the tool to be incomplete. It would be a great addition/enhancement to the cross sections tool. You can do it manually, but it takes a bit of time. Having a tool or macro that would do that automatically would be nice. I'm thinking that if we see anything like it at all, it will probably be in the form of a macro.

Done manually -
CrossSection.png
CrossSection.png (26.68 KiB) Viewed 4399 times
Mark
This post made with 0.0% Micro$oft products - GOT LINUX?
MichaGue
Posts: 41
Joined: Tue Feb 21, 2017 10:06 am

Re: Slice up an object

Post by MichaGue »

Hello, here is a python script doing the job.

http://freecadbuch.de/doku.php?id=blog: ... -schneider

and a youtube Video

https://www.youtube.com/watch?v=o0gonvsrMhs

Using the example, it works for me. But using my own model I got an error:
Error message python script.
Error message python script.
2017-04-24_08h53_34.png (4.07 KiB) Viewed 3628 times
I have no experience with python. Can someone give me a hint how to change the script to run it without an error? Attached you find my model I used for the test.

Thanks,
Michael

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6706 (Git)
Build type: Release
Branch: releases/FreeCAD-0-16
Hash: f86a4e411ff7848dea98d7242f43b7774bee8fa0
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Attachments
Test_slice_model.FCStd
Personal test model for the python script.
(6.56 KiB) Downloaded 49 times
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Slice up an object

Post by sgrogan »

MichaGue wrote: Using the example, it works for me. But using my own model I got an error:

2017-04-24_08h53_34.png
"Pocket" is hard coded
edit line 45
from

Code: Select all

slicePart(App.ActiveDocument.Pocket)
to (for your particular test file)

Code: Select all

slicePart(App.ActiveDocument.Fusion)
or more generally

Code: Select all

slicePart(Gui.Selection.getSelection()[0])
for this select the shape to be sliced in the combo view first, then run the macro.

Note the macro has a problem for non-planar surfaces at the limits. In your file the first slice "Extrude" is invalid because the macro tries to extrude an empty compound. At the tangent point of the sphere there are no wires, it's only a point.
Last edited by sgrogan on Mon Apr 24, 2017 8:16 pm, edited 1 time in total.
"fight the good fight"
MichaGue
Posts: 41
Joined: Tue Feb 21, 2017 10:06 am

Re: Slice up an object

Post by MichaGue »

Thanks a lot. Your solution works fine for me.

Best regards,
Michael
zumer
Posts: 11
Joined: Mon Sep 26, 2016 9:02 am

Re: Slice up an object

Post by zumer »

Another method is to make a block the thickness of the slice which extends beyond the extents of the model, create an array of the block at 2 x thickness intervals, then boolean|section between the model and array. Downgrade the resulting section to separate the edges.
Attachments
sliced.png
sliced.png (56.75 KiB) Viewed 3483 times
IzzY
Posts: 128
Joined: Tue Apr 25, 2017 9:58 pm
Location: gagny

Re: Slice up an object

Post by IzzY »

Hi everyone.

Michel From France.

MichaGue, I can't find how to adjust the distance between the slices? I have to tell that I begin with macro, so maybe there is something to do with the script?

Thnaks a lot.
Post Reply