tomate44 / curveswb Goto Github PK
View Code? Open in Web Editor NEWExperiments for a FreeCAD Surface workbench
License: GNU Lesser General Public License v2.1
Experiments for a FreeCAD Surface workbench
License: GNU Lesser General Public License v2.1
When I create a freehand spline, save, close and reopen the FCStd file I get the following error message in report view:
(1)<class 'AttributeError'>: setAttr failed.
Am I using the freehand spline wrong or how can I get rid of this error?
Version info:
Operating system: Arch linux
Freecad version: 0.20.2
Other installed workbenches:
I get the same behavior on a fresh FreeCAD 20.2 installed as flatpak with just the Curves WB and no other Workbenches installed.
Steps to reproduce:
I love this workbench. However, currently, I have to copy-paste parts of it so that I can use it in my Python script. Yes, I could import it as a package, but it still cannot be used in non-GUI mode (i.e. starting from the FreeCADCmd executable). E.g. FreeCADGui.addCommand
does not exist in non-GUI mode. This is a pity because I need to create classes that extract functionalities from the Curves workbench. It also hampers me from contributing to your workbench.
Is there an incentive that Curves would be usable without the GUI?
22:44:00 Running the Python command 'profileSupportCmd' failed:
Traceback (most recent call last):
File "/home/markus/.local/share/FreeCAD/Mod/Curves/freecad/Curves/ProfileSketch.py", line 143, in Activated
self.makeProfileFeature(shapes, params)
File "/home/markus/.local/share/FreeCAD/Mod/Curves/freecad/Curves/ProfileSketch.py", line 105, in makeProfileFeature
profileSupportFP(prof)
File "/home/markus/.local/share/FreeCAD/Mod/Curves/freecad/Curves/ProfileSketch.py", line 33, in init
obj.addProperty("Part::PropertyPartShape","Shape", "Profile", "Shape of the object")
Property runen#Profile001.Shape already exists
Add text customization options in FC preferences.
https://forum.freecadweb.org/viewtopic.php?f=3&t=22675&start=1120#p561151
Thanks for your work on this addon. I'm volunteering to improve the addon manager. Would you mind:
Thanks!
#1222
Hi
I have tried the following on both freeCAD 0.20 and 0.19 and
I have tried this on a older version of the Curves workbench and it works fine. When I updated the workbench today and tried running a join curve between two lines (tried sketch edges, freehand curves, etc) I get the error message:
18:52:18 Traceback (most recent call last):
File "/home/oranges/.local/share/FreeCAD/Mod/Curves/./freecad/Curves/JoinCurves.py", line 162, in execute
obj.Shape = obj.ExtensionProxy.approximate(obj, outEdges)
<class 'TypeError'>: type must be 'Shape', not list
This happens on both version of freeCAD. I am running on Ubuntu
Thanks
Hi, the workbench does not want to load. Here is the stacktrace. It might be related to python v3.10.
19:10:32 <built-in function SoFieldContainer_getField> returned a result with an exception set
19:10:32 Traceback (most recent call last):
File "/home/dario/.FreeCAD/Mod/Curves/freecad/Curves/init_gui.py", line 20, in Initialize
graphics.Marker([App.Vector()])
File "/home/dario/.FreeCAD/Mod/Curves/freecad/Curves/graphics.py", line 152, in __init__
super(Marker, self).__init__(points, dynamic)
File "/home/dario/.FreeCAD/Mod/Curves/freecad/Curves/graphics.py", line 63, in __init__
self.set_color()
File "/home/dario/.FreeCAD/Mod/Curves/freecad/Curves/graphics.py", line 88, in set_color
self.color.diffuseColor = COLORS[self.std_col]
File "/usr/lib/python3.10/site-packages/pivy/coin.py", line 3998, in __setattr__
field = self.getField(name)
File "/usr/lib/python3.10/site-packages/pivy/coin.py", line 3873, in getField
return _coin.SoFieldContainer_getField(self, name)
Tools like "line", "Bspline" in your WB have 3D Snap feature....So this feature can ve adapted into Freecad 's others...especially into Draft WB beside other Snap items.. ( too weird there is no 3D Snap, while there are 3D line, Spline capability). @luzpaz @yorikvanhavre @realthunder
Maybe it's time to make a new official release ?
maybe you can add these fixes for python3. reload must be imported
if sys.version_info.major >= 3:
from importlib import reload
I wrongly posted this issue in FreeCAD main:
FreeCAD/FreeCAD#9840
Please have a look.
When mapping a sketch on a curved surface whenever the sketch contains a Bezier curve, the projection seems to fail, and the sketch "shrinks": suddenly things that span the whole blue frame won't span the actual surface.
Steps to reproduce:
Expected behaviour:
The curve's endpoints reach the corners of the curved outer surface. Similar to the case of drawing the diagonal of the blue frame using a simple line, as on the left cylinder in the picture.
Further details:
In the case of the right cylinder in the picture there's one diagonal drawn using a line and the other one using a Bezier curve (with 2 intermediate points between the endpoints); and that breaks down too. Hence my hypothesis is that including any Bezier curve in the sketch will break the mapping for the whole sketch.
Hello
When opening Curves Workbench I always get this message: invalid syntax (precess.py, line 262), and the Workbench doesn't open
FreeCAD v0.20.2
How likely is this workbench to join the FreeCAD-addons on the Crowdin platform?
I am interested in the author's opinion in this regard.
Avoid Trim tool to cut through the whole object :
https://forum.freecadweb.org/viewtopic.php?f=3&t=22675&p=526397#p526397
pretty new to all of this but is it possible to follow the unit system that is set in preferences for the info dialogue?
It would be great if someone would one by one create notes for
Which will eventually become a page on the wiki: https://wiki.freecadweb.org/Curves_Workbench
When Curves WB is the active workbench, each time I right click in the 3D view to get the context menu, I have following error message, and Curves submenu (in the context menu) is empty.
14:56:41 Unknown command 'adjacent_faces'
14:56:41 Unknown command 'bspline_to_console'
Usage of "sketch on surface" command needs a bit improvement...position of projection is not set..generally shiftments at position...scale of projection is not controlable..
Per the README:
This is a python workbench, with a collection of tools for NURBS curves and surfaces. This workbench is developed with FreeCAD Master (currently 0.19) and OCC 7.4
This isn't accurate, right?
Using Sketch_On_Surface to map paths onto a cylinder with offsets and thickness. I can Fill Extrusion, or I can Fill Faces, but if I try to do both at once, it fails with this error:
13:41:48 Traceback (most recent call last):
File "/Users/magnus/Library/Application Support/FreeCAD/Mod/Curves/./freecad/Curves/Sketch_On_Surface.py", line 312, in execute
ruled.check(True)
<class 'ValueError'>: BOP check found the following errors:
Error in Vertex: BOPAlgo SelfIntersect
Error in Vertex: BOPAlgo SelfIntersect
Error in Vertex: BOPAlgo SelfIntersect
Error in Vertex: BOPAlgo SelfIntersect
Error in Edge: BOPAlgo TooSmallEdge
Error in Edge: BOPAlgo TooSmallEdge
13:41:48 Recompute failed! Please check report view.
Tried with FreeCAD 0.21 (nightly), 0.20 (stable) and RealThunder's Link Branch. The 2D geometry I'm trying to map is SVG paths imported from Inkscape.
The error message seems to indicate it's caused by self-intersecting paths, but close inspection of the path that throw the error don't seem to self-intersect.
Example file that demos the error:
freecad-ring.zip
For this certain project (FCStd file attached) - trying to put Text on Cilinder, but result is wrong, all straight lines are missing:
Original text is D+T ♥ 15.7.2017
darek_vaza_textonly2_sosbad.FCStd.zip
Arial.ttf.zip
copy of console log:
FreeCAD v0.20-1 (macOS 10.13.6), Curves Workbench installed from Addons Manager today (actual version)
I am using FreeCAD 0.21.1 and Curves Workbench 91dd891 (the latest commit as the time of writing this issue)
I just tried to design a new duct for my 3D printer with this fantastic workbench but I ran into an issue where the BlendSurface and BlendSolid commands do not work in all cases if one of the edge is circular.
Luckily I could reduce the problem to a very simple model:
As you can see the red surface just does not look right. To reproduce the problem just download the zip file above, remove the .zip extension from the file name, open the file, delete the red surface, and then recreate it with the BlendSurface command
If you play around a bit more you will see that the other 3 edge pairs work perfectly fine, only the right one is broken
I decided to dig deeper into it and added some visualization to figure out which points are used to create the surface by adding some stuff to blendcurve_at in blendcurve.py:
def blendcurve_at(self, par):
e1, e2 = self.rails
vecs1 = self.edge1.valueAtPoint(e1.value(par))._vectors
vecs2 = self.edge2.valueAtPoint(e2.value(par))._vectors
point = FreeCAD.ActiveDocument.addObject("PartDesign::Point", "start_point_0000")
pl = FreeCAD.Placement(vecs1[0], FreeCAD.Rotation(0,0,0))
point.Placement = pl
point.ViewObject.ShapeColor = (0.0, 1.0, 0.0, 0.6)
point = FreeCAD.ActiveDocument.addObject("PartDesign::Point", "end_point_0000")
pl = FreeCAD.Placement(vecs2[0], FreeCAD.Rotation(0,0,0))
point.Placement = pl
point.ViewObject.ShapeColor = (0.0, 0.0, 1.0, 0.6)
return BlendCurve(self.edge1.valueAtPoint(e1.value(par)), self.edge2.valueAtPoint(e2.value(par)))
This is how it looks on a working pair of edges:
And this is how it looks like on a broken pair of edges:
As you can see it uses completely wrong points to calculate the surface
After this first result I did some more digging and I think I might have found the culprit:
This is the function in valueAtPoint in class EdgeOnFace in blend_curve.py
def valueAtPoint(self, pt):
"Returns PointOnEdge object at given point"
if isinstance(pt, FreeCAD.Vector):
par = self._edge.Curve.parameter(pt)
if par < self._edge.FirstParameter and self._edge.Curve.isClosed():
par += self._edge.LastParameter - self._edge.FirstParameter
return self.value(abs_par=par)
Since the circular edges from my example are closed curves the code sometimes changes the value of par
in a way that is not compatible with circular edges
I fixed it in my local branch with this this code which just exclused circular edges from that calculation
if par < self._edge.FirstParameter and self._edge.Curve.isClosed():
if self._edge.Curve.TypeId == 'Part::GeomCircle':
# circles don't need a special treatment because the parameter is periodical by 2*pi and it automagically works
pass
else:
par += self._edge.LastParameter - self._edge.FirstParameter
After reading some more code I came up with this solution which might be better because it is more general:
if par < self._edge.FirstParameter and self._edge.Curve.isClosed():
if self._edge.Curve.isPeriodic():
pass
else:
par += self._edge.LastParameter - self._edge.FirstParameter
It seems that if a curve is periodic we don't have to calculate that offset
After applying any of my fixes the model looks good:
Since I have almost zero knowledge of the FreeCAD code I have no idea if these are actually good fixes or if they might break other stuff. But at least I hope it gives you some ideas on how to find the real problem if my proposed fixes are not sufficient
Mapped surface is calculated wrong, if the surface is bent into two directions.
For example, if I use a zylinder having a bent outer surface, the mapped sketch is calculated to a very small area having nothing to do with the surface selected.
Mapping is ok, if the surface is flat zylindric.
Systeminfo: FreeCad 0.20.2 on debian linux (bookworm), curves workbench 0.6.8 - same behavior using the appimage downloaded from freecad server.
After creating a parametric interpolation curve, I could find some information about what object it is based on, however there seems to be no way of adding (or removing) points.
In other words the details/properties of the object list which points it contains; but clicking on the button next to it shows a list of the sketches but not the points. And there seems to be no way of editing the list of points.
Hi, I am trying to use your workbench to create a feature in a part I am designing, with the rest of the geometry designed in the new V0.17 Part Design workbench. In a discussion on the forum with ChrisG it arose that both workbenches do not have compatibility with each other. How can this be resolved? I am willing to cooperate on this.
Each time I start FreeCAD, Curves WB throws following error in log :
During initialization the error ""'CurvesWorkbench' already exists."" occurred in freecad.Curves
--------------------------------------------------------------------------------
Traceback (most recent call last):
File "", line 154, in InitApplications
File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 665, in _load_unlocked
File "", line 678, in exec_module
File "", line 219, in _call_with_frames_removed
File "/home/user/.FreeCAD/Mod/Curves/freecad/Curves/init_gui.py", line 143, in
Gui.addWorkbench(CurvesWorkbench())
KeyError: "'CurvesWorkbench' already exists."
--------------------------------------------------------------------------------`
Trying different options to get a Gordon NURBS surface I found out that only InterpolationCurves and Freehand_BSplines work for Gordon NURBS surfaces.
If possible please allow these curve types. Thank you very much!
It should be possible to use a JoinCurve as an "Extra Object" for Sketch_On_Surface, but this does not work.
To reproduce :
I can provide call stack trace if needed
The report:
09:55:18 <App> blendSurfaceFP_new.py(121)|GeoFeatureGroupExtension.cpp(575): Furnace#Blend_Surface.Sources(links to Furnace#Wrap001) is out of scope:Furnace#Body vs. <global>
09:55:18 Traceback (most recent call last):
File "/home/user/.FreeCAD/Mod/Curves/freecad/Curves/blendSurfaceFP_new.py", line 67, in execute
bs = blend_curve.BlendSurface(edges[0], faces[0], edges[-1], faces[-1])
<class 'IndexError'>: list index out of range
09:55:18 7.45e-07 <App> blendSurfaceFP_new.py(121)|Document.cpp(4266): Failed to recompute Furnace#Blend_Surface: list index out of range
09:55:18 Recompute failed! Please check report view.
Point Selection
usage
All connected faces will be selected from the point selection (Tangent or non Tangent)
Example
Tangent Selection
usage
In the tangent selection, all connected faces that are tangent with each other will be selected.
Example
Invert selection
usage
The invert selection will select all faces except the one selected. (Tangent or non Tangent)
Example
The following screen shot is part of a 3DM file imported into FreeCAD using the ImportNURBS workbench.
The screen shot shows the output of the Curves Info tool.
Is there any way to edit the Shape with the Curves tools ?
If not how much effort add a function to create make useable Curve facilities from the Shape?
When trying to extrude a sketch containing certain text characters using Sketch_On_Surface, the extrusion fails with the following log:
09:06:22 Sketch bounds = (-42.00254100000001, 200.946716, -31.21605500000001, 43.55298600000001)
09:06:22 Target face bounds = (0.0, 6.283185307179586, 0.0, 1.0)
09:06:22 mapping shape # 1
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 0:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 1:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 2:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 3:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 4:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 5:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 6:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 7:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 8:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 9:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 10:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 11:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 12:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 13:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 14:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 15:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 16:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 17:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 18:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 19:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 20:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 21:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 22:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 23:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 24:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 25:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 26:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 27:Invalid initial face
09:06:22 Total : 28 shapes
09:06:22 mapping shape # 1
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 0:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 1:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 2:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 3:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 4:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 5:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 6:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 7:Invalid initial face
09:06:22 Self-intersecting wire
Unorientable shape
09:06:22 8:Invalid initial face
09:06:22 Traceback (most recent call last):
File "/home/yawkat/.local/share/FreeCAD/Mod/Curves/./freecad/Curves/Sketch_On_Surface.py", line 297, in execute
shapes_2 = self.map_shapelist(imput_shapes, quad, f2.Face1, obj.FillFaces)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/yawkat/.local/share/FreeCAD/Mod/Curves/./freecad/Curves/Sketch_On_Surface.py", line 199, in map_shapelist
shapelist.extend(self.map_shape(shape, quad, face, fillfaces))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/yawkat/.local/share/FreeCAD/Mod/Curves/./freecad/Curves/Sketch_On_Surface.py", line 232, in map_shape
return self.build_faces(wirelist, face)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/yawkat/.local/share/FreeCAD/Mod/Curves/./freecad/Curves/Sketch_On_Surface.py", line 180, in build_faces
f.validate()
<class 'Part.OCCError'>: BRepCheck_Analyzer::Init() - NULL shape
09:06:22 Recompute failed!
This issue seems to be specific to some characters such as 'k' and 'n'.
I've attached a reproducer project.
When trying to delete a Sketch On Surface object (select in the Tree View and hit 'Del' key), the object isn't deleted and following error raises in the report view :
Traceback (most recent call last):
File "/home/OB/.FreeCAD/Mod/Curves/Sketch_On_Surface.py", line 340, in onDelete
self.children.ViewObject.Visibility = True
<class 'AttributeError'>: 'list' object has no attribute 'ViewObject'
Hello,
The ParametricComb command shows the curvature of the selected curve.
Would it be possible to extend the reporting with:
Thanks Johnny
Part.Feature has no attribute "getSubObject"
https://forum.freecadweb.org/viewtopic.php?f=3&t=49978&start=10#p429690
Reported first via https://twitter.com/PaoloFurani/status/1502058040132087839
Just a reminder to possibly include the flatten_face.FCMacro as a tool in Curves WB, as discussed in the forum...
https://forum.freecad.org/viewtopic.php?p=582967#p582967 (topic)
https://forum.freecad.org/viewtopic.php?p=387511#p387511 (latest version of the macro)
I have come across a small issue. My scenario:
Still want to thank you for this excellent workbench.
Jan
Below are screenshots of the scenario with the 0.001 mm workaround
Switching to 0 mm:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.