Development of a Curved Surface

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!
gsandy
Posts: 155
Joined: Sun Jan 27, 2019 7:07 pm
Location: Auckland New Zealand

Development of a Curved Surface

Postby gsandy » Sun Apr 12, 2020 2:43 am

I have this shape (which is curved in one direction) and wish to "flatten" it out and use this as a cutting pattern for a flat sheet.
There is a "Sheet-Metal-Unfolder" macro but it doesnt seem to work on a curved surface.
Is there another macro or something within FreeCad to do this?

If I could produce a Cutting Plane or Sketch based on two lines or three points, as shown on screen shot, I could get enough measurement to create developed shape in 2D cad. Any ideas on how to get a Cutting Plane or Sketch.

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.4 (GitTag)
Build type: Release
Branch: releases/FreeCAD-0-18
Hash: 980bf9060e28555fecd9e3462f68ca74007b70f8
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/NewZealand (en_NZ)
Attachments
Snap 2020-04-12 at 14.32.50.png
Snap 2020-04-12 at 14.32.50.png (28.09 KiB) Viewed 361 times
Snap 2020-04-12 at 12.21.47.png
Snap 2020-04-12 at 12.21.47.png (38.12 KiB) Viewed 361 times
User avatar
microelly2
Posts: 4690
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Development of a Curved Surface

Postby microelly2 » Sun Apr 12, 2020 6:21 am

it depends on the structure of your surface. Can you upload the model?
gsandy
Posts: 155
Joined: Sun Jan 27, 2019 7:07 pm
Location: Auckland New Zealand

Re: Development of a Curved Surface

Postby gsandy » Sun Apr 12, 2020 9:06 am

The file is just over 6000kb (even when zipped) so I cant upload it! Unless there is another way.
chrisb
Posts: 25204
Joined: Tue Mar 17, 2015 9:14 am

Re: Development of a Curved Surface

Postby chrisb » Sun Apr 12, 2020 9:08 am

You can use a publicly available cloud service. Please use one, that doesn't require registration for downloading.
User avatar
Chris_G
Posts: 1342
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Development of a Curved Surface

Postby Chris_G » Sun Apr 12, 2020 12:10 pm

gsandy wrote:
Sun Apr 12, 2020 9:06 am
The file is just over 6000kb (even when zipped) so I cant upload it! Unless there is another way.
We don't need the whole file. Just the face.
Maybe you could extract it to a new file ?
For example with Part -> Create a copy -> Create shape element copy
gsandy
Posts: 155
Joined: Sun Jan 27, 2019 7:07 pm
Location: Auckland New Zealand

Re: Development of a Curved Surface

Postby gsandy » Mon Apr 13, 2020 1:38 am

The dropbox file is:

https://www.dropbox.com/s/47v8ns53c4lwt ... FCStd?dl=0

Tried to find - Part -> Create a copy -> Create shape element copy

But could only see "Create a simple copy"?
User avatar
microelly2
Posts: 4690
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Development of a Curved Surface

Postby microelly2 » Mon Apr 13, 2020 6:38 am

The face is a patch of a cylinder. I'm sure there are methods to unfold a cylider patch somewhere.
If not I can write a method this evening.
dp_04_13_001.png
dp_04_13_001.png (172.6 KiB) Viewed 239 times
gsandy
Posts: 155
Joined: Sun Jan 27, 2019 7:07 pm
Location: Auckland New Zealand

Re: Development of a Curved Surface

Postby gsandy » Mon Apr 13, 2020 7:11 am

Great thanks microelly2.
User avatar
saso
Posts: 1495
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Development of a Curved Surface

Postby saso » Mon Apr 13, 2020 7:56 am

gsandy wrote:
Sun Apr 12, 2020 2:43 am
I have this shape (which is curved in one direction) and wish to "flatten" it out and use this as a cutting pattern for a flat sheet.
Check if this will give you usable result...

1. PartWB -> menu Part -> Shape Builder -> Shell from faces -> select top three faces of you shape -> click Create
2. Mesh Design WB -> menu Meshes -> Create mesh from shape -> create a mesh from the shell created in the fist step (just use the default values first, you can try to refine or use different meshes later if needed)
3. Mesh Design WB -> menu Meshes -> Unwrap Mesh

unwrap.jpg
unwrap.jpg (37.71 KiB) Viewed 218 times
Attachments
Windscreen Pattern 12-4-20A_Unwraped.FCStd
(288.28 KiB) Downloaded 3 times
Last edited by saso on Mon Apr 13, 2020 8:43 am, edited 2 times in total.
User avatar
Chris_G
Posts: 1342
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Development of a Curved Surface

Postby Chris_G » Mon Apr 13, 2020 8:21 am

Here is another solution.
- Select the cylindrical face you want to flatten in the 3D view
- Copy / Paste the following code in the Python console.
It works only on cylindrical faces.

Code: Select all

import FreeCAD
import FreeCADGui
import Part

def stretched_plane(geom_range=[0,1,0,1], param_range=[0,2,0,2]):
    u0, u1, v0, v1 = geom_range
    s0, s1, t0, t1 = param_range
    bs = Part.BSplineSurface()
    poles = [[FreeCAD.Vector(u0,v0,0), FreeCAD.Vector(u0,v1,0)],
                [FreeCAD.Vector(u1,v0,0), FreeCAD.Vector(u1,v1,0)]]
    umults = [2, 2]
    vmults = [2, 2]
    uknots = [s0, s1]
    vknots = [t0, t1]
    bs.buildFromPolesMultsKnots(poles, umults, vmults, uknots, vknots, False, False, 1, 1)
    return bs

def flatten_cylindrical_face(face):
    if not isinstance(face.Surface, Part.Cylinder):
        FreeCAD.Console.PrintError("Input face is not cylindrical")
        return None
    cos = [face.curveOnSurface(e) for e in face.Edges]
    pr1 = [v*1.1 for v in face.ParameterRange]
    pr2 = [v*1.1 for v in face.ParameterRange]
    pr1[1] *= face.Surface.Radius
    pl = stretched_plane(pr1,pr2)
    edges = [c[0].toShape(pl,c[1],c[2]) for c in cos]
    w = Part.Wire(Part.sortEdges(edges)[0])
    f = Part.Face(w)
    f.validate()
    if f.isValid():
        return f
    else:
        return w

sel = FreeCADGui.Selection.getSelectionEx()
face = sel[0].SubObjects[0]
flat_face = flatten_cylindrical_face(face)
if flat_face:
    Part.show(flat_face)

Attachments
Flat_faces.FCStd
(57.22 KiB) Downloaded 4 times