Wrapper

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Post Reply
User avatar
Shor-ty
Posts: 11
Joined: Sat Aug 07, 2021 8:37 am
Location: Augsburg
Contact:

Wrapper

Post by Shor-ty »

Hey everybody,

I am wondering if Freecad offers some kind of wrapper around an STL, or other CAD file? For example: I do have a CAD geometry of some radiator and I want to have only the outer surface (so wrapping a box around the radiator). At the end, I have a wrapped geometry that represents the outer shell of the object (without any holes).

Tobi
chrisb
Veteran
Posts: 54177
Joined: Tue Mar 17, 2015 9:14 am

Re: Wrapper

Post by chrisb »

You can turn the stl into a solid and subtract it from e.g. a cube. Then the cut is a wrapper around the original stl.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Roy_043
Veteran
Posts: 8544
Joined: Thu Dec 27, 2018 12:28 pm

Re: Wrapper

Post by Roy_043 »

I think the OP wants a convex hull (shrink wrapped) type solution.
User avatar
Shor-ty
Posts: 11
Joined: Sat Aug 07, 2021 8:37 am
Location: Augsburg
Contact:

Re: Wrapper

Post by Shor-ty »

Hey everybody,

exactly as @Roy_043 mentioned. The geometry is, e.g., a raw TV housing with all the cooling channels and so on. I want to wrap around the geometry to get a closed volume that fits the TV housing well (e.g, closing the cooling channels etc.).

Is there any solution? Probably I could do it using Blender.
wmayer
Founder
Posts: 20302
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Wrapper

Post by wmayer »

Assuming you have loaded a mesh file then with the script below you can create a fitting box

Code: Select all

import Mesh

mesh=App.ActiveDocument.ActiveObject.Mesh.copy()

eigen = mesh.getEigenSystem()
mesh.transformGeometry(eigen[0])

bbox = mesh.BoundBox
triangles = []
triangles.append(bbox.getPoint(0))
triangles.append(bbox.getPoint(1))
triangles.append(bbox.getPoint(2))
triangles.append(bbox.getPoint(0))
triangles.append(bbox.getPoint(2))
triangles.append(bbox.getPoint(3))
triangles.append(bbox.getPoint(0))
triangles.append(bbox.getPoint(5))
triangles.append(bbox.getPoint(1))
triangles.append(bbox.getPoint(0))
triangles.append(bbox.getPoint(4))
triangles.append(bbox.getPoint(5))
triangles.append(bbox.getPoint(0))
triangles.append(bbox.getPoint(3))
triangles.append(bbox.getPoint(7))
triangles.append(bbox.getPoint(0))
triangles.append(bbox.getPoint(7))
triangles.append(bbox.getPoint(4))
triangles.append(bbox.getPoint(4))
triangles.append(bbox.getPoint(6))
triangles.append(bbox.getPoint(5))
triangles.append(bbox.getPoint(4))
triangles.append(bbox.getPoint(7))
triangles.append(bbox.getPoint(6))
triangles.append(bbox.getPoint(1))
triangles.append(bbox.getPoint(6))
triangles.append(bbox.getPoint(2))
triangles.append(bbox.getPoint(1))
triangles.append(bbox.getPoint(5))
triangles.append(bbox.getPoint(6))
triangles.append(bbox.getPoint(2))
triangles.append(bbox.getPoint(7))
triangles.append(bbox.getPoint(3))
triangles.append(bbox.getPoint(2))
triangles.append(bbox.getPoint(6))
triangles.append(bbox.getPoint(7))

box = Mesh.Mesh(triangles)
box.transformGeometry(eigen[0].inverse())
Mesh.show(box)
Is this what you are looking for?

If you have a recent build that includes git commit 2808c4bc you can simplify the script:

Code: Select all

import Mesh

mesh=App.ActiveDocument.ActiveObject.Mesh.copy()

eigen = mesh.getEigenSystem()
mesh.transformGeometry(eigen[0])

box=Mesh.createBox(mesh.BoundBox)
box.transformGeometry(eigen[0].inverse())
Mesh.show(box)

Post Reply