dxf splines with ezdxf (python)
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!
Re: dxf splines with ezdxf (python)
Hi,
In some weeks I will need this fix, so I wonder if :
1. I have to do ALL this : http://www.freecadweb.org/wiki/CompileOnUnix (with the bug fix in the source).
2. Is it perhaps possible to do more simple ? Will the 0.17 come please soon ?
Best regards
amka
In some weeks I will need this fix, so I wonder if :
1. I have to do ALL this : http://www.freecadweb.org/wiki/CompileOnUnix (with the bug fix in the source).
2. Is it perhaps possible to do more simple ? Will the 0.17 come please soon ?
Best regards
amka
Re: dxf splines with ezdxf (python)
1. yes (when you pull from the FreeCAD git repo the fix is already in the sourceamka wrote:Hi,
In some weeks I will need this fix, so I wonder if :
1. I have to do ALL this : http://www.freecadweb.org/wiki/CompileOnUnix (with the bug fix in the source).
2. Is it perhaps possible to do more simple ? Will the 0.17 come please soon ?
Best regards
amka
2. give it a try first. 0.17 is not slated for anytime soon.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: dxf splines with ezdxf (python)
amka wrote:Have I then please to compile FreeCad if I want to open my dxf ?
FreeCAD now offers occasional appimages for the development version.yorik wrote:Yes, or, wait for someone to compile for you
Download the latest appimage (currently FreeCAD-0.17.git201703220057.glibc2.17-x86_64.AppImage) make the file executable and run FreeCAD.
https://github.com/FreeCAD/FreeCAD/rele ... g/0.17_pre
"fight the good fight"
Re: dxf splines with ezdxf (python)
Before run code, install ezdxf package to FreeCAD.
use PowerShell and change directort(cd) to ..\FreeCAD_0.17.10698_x64_dev_win\bin
and type
Double-Click to open FreeCAD and run code.
But I'm not sure spline in dxf and BSpline in FreeCAD are the same curve.
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10698 (Git)
Build type: Release
Branch: master
Hash: ac2f9f8902b67143ea081fedc9ffed86fc1a1bd3
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.0.0
use PowerShell and change directort(cd) to ..\FreeCAD_0.17.10698_x64_dev_win\bin
and type
Code: Select all
./python -m easy_install ezdxf
But I'm not sure spline in dxf and BSpline in FreeCAD are the same curve.
Code: Select all
import os
import Draft
import ezdxf
from FreeCAD import Vector
filePath, fileName = os.path.split(__file__)
drawing = ezdxf.readfile(filePath+os.sep+"ezdxf_spline.dxf")
modelspace = drawing.modelspace()
splines = modelspace.query('SPLINE')
Msg('n=%d\n'% len(splines))
points=splines[0].get_fit_points()
points2 = []
for i in points:
points2.append(Vector(i))
line = Draft.makeWire(points2,closed=False,face=False,support=None)
spline = Draft.makeBSpline(points2,closed=False,face=False,support=None)
bez = Draft.makeBezCurve(points2,closed=False,support=None)
#list(drawing.entities)
Msg('Done!\n\n')
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10698 (Git)
Build type: Release
Branch: master
Hash: ac2f9f8902b67143ea081fedc9ffed86fc1a1bd3
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.0.0
Last edited by chakkree on Tue May 23, 2017 4:59 am, edited 1 time in total.
Re: dxf splines with ezdxf (python)
Draft.makeBSpline( PTS ) creates an interpolating BSpline curve that goes through the PTS.But I'm not sure spline in dxf and BSpline in FreeCAD are the same curve.
So, in that case, PTS are not the control points of the BSplineCurve.
If you want to create a BSplineCurve from its control points, you should use :
Code: Select all
bs = Part.BSplineCurve(pts)
Part.show(bs.toShape())
Re: dxf splines with ezdxf (python)
Dashed Line is made from Part.BSplineCurve.
It's the same makeBSpline().
It's the same makeBSpline().
Code: Select all
import os
import ezdxf
import Part
import Draft
from FreeCAD import Vector
filePath, fileName = os.path.split(__file__)
drawing = ezdxf.readfile(filePath+os.sep+"ezdxf_spline.dxf")
modelspace = drawing.modelspace()
splines = modelspace.query('SPLINE')
Msg('n=%d\n'% len(splines))
points=splines[0].get_fit_points()
line = Draft.makeWire(points,closed=False,face=False,support=None)
spline = Draft.makeBSpline(points,closed=False,face=False,support=None)
bez = Draft.makeBezCurve(points,closed=False,support=None)
bs = Part.BSplineCurve()
bs.interpolate(points,False)
Part.show(bs.toShape())
#list(drawing.entities)
Msg('Done!\n\n')
Last edited by chakkree on Tue May 23, 2017 4:59 am, edited 1 time in total.
Re: dxf splines with ezdxf (python)
Thanks you all and
Do you please know where I can find such a freecad for linux ?sgrogan wrote: FreeCAD now offers occasional appimages for the development version.
Download the latest appimage (currently FreeCAD-0.17.git201703220057.glibc2.17-x86_64.AppImage) make the file executable and run FreeCAD.
https://github.com/FreeCAD/FreeCAD/rele ... g/0.17_pre
Re: dxf splines with ezdxf (python)
From my previous link this, file Direct Link to .AppImage Downloadamka wrote:Do you please know where I can find such a freecad for linux ?
Code: Select all
https://github.com/FreeCAD/FreeCAD/releases/download/0.17_pre/FreeCAD-0.17.git201703220057.glibc2.17-x86_64.AppImage
"fight the good fight"
Re: dxf splines with ezdxf (python)
Thanks, this Freecad works !
Re: dxf splines with ezdxf (python)
Thank you a lot for these informations !
My FreeCAD version is 0.16. Perhaps it is possible to do the same with the appimage (version 0.17) of the post before ?
Regards
And where have I to do this ? I did :chakkree wrote:Before run code, install ezdxf package to FreeCAD.
use PowerShell and change directort(cd) to ..\FreeCAD_0.17.10698_x64_dev_win\bin
and typeCode: Select all
./python -m easy_install ezdxf
Code: Select all
root@debian:/usr/lib/freecad/bin# ls -l
total 48
-rwxr-xr-x 1 root root 28368 mai 22 2016 FreeCAD
-rwxr-xr-x 1 root root 17256 mai 22 2016 FreeCADCmd
root@debian:/usr/lib/freecad/bin# python -m easy_install ezdxf
Searching for ezdxf
Best match: ezdxf 0.8.1
Adding ezdxf 0.8.1 to easy-install.pth file
Using /usr/local/lib/python2.7/dist-packages
Processing dependencies for ezdxf
Finished processing dependencies for ezdxf
Can you please explain me where to put this code ? I don't understand.chakkree wrote: Double-Click to open FreeCAD and run code.
But I'm not sure spline in dxf and BSpline in FreeCAD are the same curve.
Code: Select all
import os import ezdxf from FreeCAD import Vector filePath, fileName = os.path.split(__file__) drawing = ezdxf.readfile(filePath+os.sep+"ezdxf_spline.dxf") modelspace = drawing.modelspace() splines = modelspace.query('SPLINE') Msg('n=%d\n'% len(splines)) points=splines[0].get_fit_points() points2 = [] for i in points: points2.append(Vector(i)) line = Draft.makeWire(points2,closed=False,face=False,support=None) spline = Draft.makeBSpline(points2,closed=False,face=False,support=None) bez = Draft.makeBezCurve(points2,closed=False,support=None) #list(drawing.entities) Msg('Done!\n\n')
Regards