FreeCAD version -
OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.29177 (Git)
Build type: Release
Branch: releases/FreeCAD-0-20
Problem Statement [A rough description of what I want to design using the FreeCAD] -
Consider an irregular cylindrical tube. I have the tube length and the x-y coordinates of the start and end cross-sections [assume ten coordinates for each cross-section in a txt file]. I am struggling with how to build these kinds of models with FreeCAD. Or it's not possible at all.
I have an idea of what I should be doing, but I am not sure how to do it-
Create a body -> Start a sketch -> Select a plane -> Import coordinates to connect and create the first cross-sectional plane -> Create a second sketch and follow the same to create the second cross-sectional plane. Then use the "loft" option to connect both sketches.
But I am not sure how to import coordinates to sketch. Could you please help me or provide some ideas to solve this problem.
Experience with FreeCAD -
I am new to FreeCAD and building CAD models. This is my first post here. I am sorry if I am breaking any forum rules here.
Sketching by importing coordinates
Forum rules
and Helpful information
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!
Also, be nice to others! Read the FreeCAD code of conduct!
-
- Posts: 11
- Joined: Thu Aug 11, 2022 2:13 pm
Re: Sketching by importing coordinates
Try using Draft Point - you can specify coordinates manually or with Python scripting. Then you could convert these points to sketches for further operations but keep in mind that sketches have to be planar - all points for a single sketch must lie in the same plane. But maybe conversion to sketches won’t be necessary.
-
- Veteran
- Posts: 3192
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: Sketching by importing coordinates
Make Wires from your imported points, then use Part.Loft in the Gui (or script it) to loft them together
Above I synthesized the points. You'll need to read them in from your file. The Points workbench might be useful in this regard.
Code: Select all
from math import sin, cos, pi
import Draft, Part
V3 = App.Vector
doc = App.ActiveDocument
npts = 20
thetas = [i * 2 * pi/npts for i in range(npts)]
r1 = 10
circle1 = [r1 * V3(cos(theta), sin(theta), 0) for theta in thetas]
wire1 = Draft.makeWire(circle1, closed = True)
r2 = 20
circle2 = [r2 * V3(cos(theta), sin(theta), 1) for theta in thetas]
wire2 = Draft.makeWire(circle2, closed = True)
doc.recompute()
-
- Veteran
- Posts: 3192
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: Sketching by importing coordinates
If you want a smooth fit through your imported points, you can use a Draft BSpline instead
Code: Select all
from math import sin, cos, pi
import Draft, Part
V3 = App.Vector
doc = App.ActiveDocument
npts = 20
thetas = [i * 2 * pi/npts for i in range(npts)]
r1 = 10
circle1 = [r1 * V3(cos(theta), sin(theta), 0) for theta in thetas]
#wire1 = Draft.makeWire(circle1, closed = True)
bs1 = Draft.makeBSpline(circle1)
r2 = 20
circle2 = [r2 * V3(cos(theta), sin(theta), 1) for theta in thetas]
#wire2 = Draft.makeWire(circle2, closed = True)
bs2 = Draft.makeBSpline(circle2, closed = True)
doc.recompute()
-
- Posts: 11
- Joined: Thu Aug 11, 2022 2:13 pm
Re: Sketching by importing coordinates
Thanks @edwilliams16 and @NewJoker for answering my question and sharing the code. I will give it a try and let you know.
Re: Sketching by importing coordinates
--> Import your coordinates into Points-WB.
--> Convert pointClouds to BSplines with "Aproximate"-Tool in Curves-WB. Adjust Splines in General-Section of Spline-Data-Tab (close spline, ...).
--> Make a Loft in Part-WB (look that Start/EndPoints of Start/EndSplines are nearby to avoid twisting).
--> Convert pointClouds to BSplines with "Aproximate"-Tool in Curves-WB. Adjust Splines in General-Section of Spline-Data-Tab (close spline, ...).
--> Make a Loft in Part-WB (look that Start/EndPoints of Start/EndSplines are nearby to avoid twisting).