Hello Mårten, Welcome (back) to FreeCAD and the forum.more11 wrote:I am pretty new to FreeCAD. I have used it a couple of years ago, so I don't remember much.
I have successfully imported a points cloud to FreeCAD. I want do define a line from this cloud. I don't know which type of line to use, but at this stage it doesn't matter much. I will use the line to define a surface.
The points are twodimensional, z is always 0.
Do I need to do this in Python?`
Please post you Help about FreeCAD data as that comment does not define which one of the "latest" versions you are using. I assume you mean you downloaded one of the precompiled 0.14 release versions from Sourceforge, but its annoying having to guess.more11 wrote:I use the latest FreeCAD for windows.
If you find something wrong post your Help about FreeCAD data, a file that demonstrates the bug and exact step by step instructions to repeat the bug, ....if the bug is a bug and is still there in the development version, it will likely be fixed...in the development version..more11 wrote:FreeCAD is still a bit buggy.
Code: Select all
# -*- coding: utf-8 -*- from __future__ import unicode_literals # created a wire with coordinate x y z separated (in the file without coma) __title__= "Macro_WireXYZ" __author__= "Mario52" __date__= "2020/10/16" __version__= "00.03" ## #EX: #0 0 0 #10 10 10 #15 20 25 #. . . . from FreeCAD import Base import Draft, Part ## path for Windows : C:\yourPath\cloud.asc (create one error in Python (cause, the "\" is a command syntax in Python) ## replace "\" by "/" result : C:/yourPath/cloud.asc ## or replace the "\" by "\\" result : C:\\yourPath\\cloud.asc fichier = "C:\\yourPath\\cloud.asc" # path and name of file.txt file = open(fichier, "r") # open the file read wire =  X=Y=Z = 0.0 for ligne in file: coordinates = ligne.split() try: # for format PCD ignore the header X,Y,Z = coordinates # separate the coordinates # Draft.makePoint(float(X),float(Y),float(Z)) # create points (uncomment for use) print(X," ",Y," ",Z) wire.append(FreeCAD.Vector(float(X),float(Y),float(Z))) # append the coordinates except Exception: None file.close() Draft.makeWire(wire,closed=False,face=False,support=None) # create the wire open #Draft.makeWire(wire,closed=True,face=False,support=None) # create the wire closed (uncomment for use) #Draft.makeBSpline(wire,closed=False,face=False,support=None)# create the BSpline open (uncomment for use) #Draft.makeBSpline(wire,closed=True,face=False,support=None)# create the BSpline open (uncomment for use) App.ActiveDocument.recompute()