How to triangulate between two curves?

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
stefankorisnik3
Posts: 101
Joined: Sun Jul 24, 2022 12:49 pm

How to triangulate between two curves?

Post by stefankorisnik3 »

Given two closed wires how to make a triangulation between those two wires?
I have tried some https://docs.scipy.org/doc/scipy/refere ... aunay.html

but didn't succeed to set the parameters to only triangulate between two curves
To clarify i don't want triangulation between points in the same curve. Just want the triangulation between two curves

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.29177 (Git)
Build type: Release
Branch: releases/FreeCAD-0-20
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.2
Locale: English/United Kingdom (en_GB)
Installed mods: 
  * CurvedShapes 1.0.3
  * Curves 0.5.2
User avatar
onekk
Veteran
Posts: 6222
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: How to triangulate between two curves?

Post by onekk »

stefankorisnik3 wrote: Tue Aug 02, 2022 2:27 pm Given two closed wires how to make a triangulation between those two wires?
I have tried some https://docs.scipy.org/doc/scipy/refere ... aunay.html

but didn't succeed to set the parameters to only triangulate between two curves
To clarify i don't want triangulation between points in the same curve. Just want the triangulation between two curves

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.29177 (Git)
Build type: Release
Branch: releases/FreeCAD-0-20
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.2
Locale: English/United Kingdom (en_GB)
Installed mods: 
  * CurvedShapes 1.0.3
  * Curves 0.5.2
I think that you have to:

- create a surface between the curves
- triangulate thie surface


But if you are using FreeCAD only to show "external created" triangulations, I think that this could be a problem, as FC internally is not using the same curves as scipy.

As example in FC you could create a surface between two curves as follows (complete code is in the included file):

Code: Select all

el1 = Part.Ellipse(Vector(0,0,0), 100, 50)

el2 = Part.Ellipse(Vector(0,0,50), 50, 25)

# Part.show(el1.toShape(), "el1_Shape")
# Part.show(el2.toShape(), "el2_Shape")

el_edg1 = el1.toShape(0, pi/3)
el_edg2 = el2.toShape(0, pi/3)

rs = Part.makeRuledSurface(el_edg1, el_edg2)

Part.show(rs, "Surface")

DOC.recompute()
20220802-surf4curves.py
(2.99 KiB) Downloaded 7 times
or even creating a BSPline curves, it is not so different from the code above.

Hope it helps.

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
stefankorisnik3
Posts: 101
Joined: Sun Jul 24, 2022 12:49 pm

Re: How to triangulate between two curves?

Post by stefankorisnik3 »

Thanks
Can you let me know how can i triangulate the surface?
heda
Veteran
Posts: 1348
Joined: Sat Dec 12, 2015 5:49 pm

Re: How to triangulate between two curves?

Post by heda »

Mesh_FromPartShape
complete with script examples...
stefankorisnik3
Posts: 101
Joined: Sun Jul 24, 2022 12:49 pm

Re: How to triangulate between two curves?

Post by stefankorisnik3 »

Thanks.
So first a make let's say the ruled surface with function

Code: Select all

makeRuledSurface
then i export it as a mesh
then i convert mesh into the shape to get access to the triangles
Is this proper way?

Also i'm looking from the beginning of the question for something like triangled loft between curves (two solid)
I know how to apply regular loft in the FreeCAD
heda
Veteran
Posts: 1348
Joined: Sat Dec 12, 2015 5:49 pm

Re: How to triangulate between two curves?

Post by heda »

stefankorisnik3 wrote: Tue Aug 02, 2022 4:17 pm then i export it as a mesh
then i convert mesh into the shape to get access to the triangles
not sure where you are going with that, sound like jibberish to me

face (as in shape) --> meshobj (as in create in-memory)
and you have access to tri's

why would you go back to a shape-obj?

maybe read the introduction in Part_Workbench

but then again what do i know about what you intend to do, and how...
Post Reply