Curves workbench

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
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!
drmacro
Veteran
Posts: 8806
Joined: Sun Mar 02, 2014 4:35 pm

Re: Curves workbench

Post by drmacro »

In the attached file I have create two curved pipes using a Freehand BSpline.

The spline itself passes geometry check. I have done the pipe with both a multi-profile Part Sweep and a Curves PipeShell. The Sweep cause the sweep profile to rotate around the spine, causing a very wonky seam line. The PipeShell behaves much better.

But, both the Sweep and the PipeShell fail geometry check. Both show the seam line (Edge1 in each) with a BOPAlgo GeomAbs_C0. Both also show the face of the solid with the same error.

Is there settings or can the constituent objects be changed to remedy this?
Snip macro screenshot-6b923a.png
Snip macro screenshot-6b923a.png (209.51 KiB) Viewed 1812 times
Attachments
Example-1.FCStd
(577.13 KiB) Downloaded 32 times
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: Curves workbench

Post by chrisb »

I get the wonky seamline only with the Frenet option set, without it looks quit normal. However, even without Frenet it shouws the CheckGeometry errors.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
drmacro
Veteran
Posts: 8806
Joined: Sun Mar 02, 2014 4:35 pm

Re: Curves workbench

Post by drmacro »

Apparently Curves Shapes, Curves and FC 0.20 don't really get along well ATM...

I tried removing and reinstall, same...

Code: Select all

12:46:45  Traceback (most recent call last):
  File "/home/mac/.local/share/FreeCAD/Mod/CurvedShapes/CurvedArray.py", line 196, in onChanged
    self.execute(fp)
  File "/home/mac/.local/share/FreeCAD/Mod/CurvedShapes/CurvedArray.py", line 179, in execute
    self.makeRibs(prop)
  File "/home/mac/.local/share/FreeCAD/Mod/CurvedShapes/CurvedArray.py", line 114, in makeRibs
    if (obj.Surface or obj.Solid) and obj.Items > 1:
<class 'AttributeError'>: 'FeaturePython' object has no attribute 'Surface'
12:46:45  16Standard_Failure Need at least two vertices, edges or wires to create loft face
12:46:45  Creation of surface is not possible !
12:46:45  <Part> ViewProviderExt.cpp(1306): Cannot compute Inventor representation for the shape of sink#CurvedArray: Bnd_Box is void
12:46:45  16Standard_Failure Need at least two vertices, edges or wires to create loft face
12:46:45  Creation of surface is not possible !
12:46:45  <Part> ViewProviderExt.cpp(1306): Cannot compute Inventor representation for the shape of sink#CurvedArray: Bnd_Box is void
12:46:45  Traceback (most recent call last):
  File "/home/mac/.local/share/FreeCAD/Mod/CurvedShapes/CurvedArray.py", line 196, in onChanged
    self.execute(fp)
  File "/home/mac/.local/share/FreeCAD/Mod/CurvedShapes/CurvedArray.py", line 179, in execute
    self.makeRibs(prop)
  File "/home/mac/.local/share/FreeCAD/Mod/CurvedShapes/CurvedArray.py", line 114, in makeRibs
    if (obj.Surface or obj.Solid) and obj.Items > 1:
<class 'AttributeError'>: 'FeaturePython' object has no attribute 'Surface'
12:46:45  16Standard_Failure Need at least two vertices, edges or wires to create loft face
12:46:45  Creation of surface is not possible !
12:46:45  <Part> ViewProviderExt.cpp(1306): Cannot compute Inventor representation for the shape of sink#CurvedArray001: Bnd_Box is void
12:46:45  16Standard_Failure Need at least two vertices, edges or wires to create loft face
12:46:45  Creation of surface is not possible !
12:46:45  <Part> ViewProviderExt.cpp(1306): Cannot compute Inventor representation for the shape of sink#CurvedArray001: Bnd_Box is void
12:46:45  AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
12:46:45  AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.

Code: Select all

12:53:21  Traceback (most recent call last):
  File "/home/mac/.local/share/FreeCAD/Mod/Curves/./freecad/Curves/parametricSolid.py", line 97, in onDocumentRestored
    fp.setEditorMode("ShapeStatus", 1)
<class 'AttributeError'>: Property container has no property 'ShapeStatus'
12:53:21  Traceback (most recent call last):
  File "/home/mac/.local/share/FreeCAD/Mod/Curves/./freecad/Curves/parametricSolid.py", line 112, in getIcon
    return self.icons[self.Object.ShapeStatus]
<class 'AttributeError'>: 'FeaturePython' object has no attribute 'ShapeStatus'
OS: Debian GNU/Linux 10 (buster) (XFCE/lightdm-xsession)
Word size of FreeCAD: 64-bit
Version: 0.20.26829 (Git)
Build type: Release
Branch: master
Hash: 175ceb2d12e69c81017fbb34c4e20d9eaa4fd5cc
Python version: 3.7.3
Qt version: 5.11.3
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
Chris_G
Veteran
Posts: 2572
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Curves workbench

Post by Chris_G »

drmacro wrote: Sat Jan 01, 2022 2:04 pm Is there settings or can the constituent objects be changed to remedy this?
Unfortunately no, I don't think.
But BOPAlgo GeomAbs_C0 errors should be safe as long as you don't use the surface for Thickness or 3DOffset operations.
drmacro wrote: Sat Jan 01, 2022 5:52 pm Apparently Curves Shapes, Curves and FC 0.20 don't really get along well ATM...

I tried removing and reinstall, same...
You have some parametricSolid objects in your document that were made with an older version of CurvesWB.
This should fix it :

Code: Select all

for o in App.ActiveDocument.Objects:
    if hasattr(o, "Proxy") and ("parametricSolid" in o.Proxy.__repr__()) and not hasattr(o, "ShapeStatus"):
        o.addProperty("App::PropertyString", "ShapeStatus", "Solid", "Status of the created shape")

drmacro
Veteran
Posts: 8806
Joined: Sun Mar 02, 2014 4:35 pm

Re: Curves workbench

Post by drmacro »

Chris_G wrote: Sat Jan 01, 2022 6:47 pm
drmacro wrote: Sat Jan 01, 2022 2:04 pm Is there settings or can the constituent objects be changed to remedy this?
Unfortunately no, I don't think.
But BOPAlgo GeomAbs_C0 errors should be safe as long as you don't use the surface for Thickness or 3DOffset operations.
drmacro wrote: Sat Jan 01, 2022 5:52 pm Apparently Curves Shapes, Curves and FC 0.20 don't really get along well ATM...

I tried removing and reinstall, same...
You have some parametricSolid objects in your document that were made with an older version of CurvesWB.
This should fix it :

Code: Select all

for o in App.ActiveDocument.Objects:
    if hasattr(o, "Proxy") and ("parametricSolid" in o.Proxy.__repr__()) and not hasattr(o, "ShapeStatus"):
        o.addProperty("App::PropertyString", "ShapeStatus", "Solid", "Status of the created shape")

Thanks I'll give it a go.

Just for clarity, the errors were on other files, not this one.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
drmacro
Veteran
Posts: 8806
Joined: Sun Mar 02, 2014 4:35 pm

Re: Curves workbench

Post by drmacro »

Hmm...loaded an offending file, ran the code, closed/opened file:

Edit: it appears to work on some files.

Code: Select all

14:19:23  Traceback (most recent call last):
  File "/home/mac/.local/share/FreeCAD/Mod/CurvedShapes/CurvedArray.py", line 196, in onChanged
    self.execute(fp)
  File "/home/mac/.local/share/FreeCAD/Mod/CurvedShapes/CurvedArray.py", line 179, in execute
    self.makeRibs(prop)
  File "/home/mac/.local/share/FreeCAD/Mod/CurvedShapes/CurvedArray.py", line 114, in makeRibs
    if (obj.Surface or obj.Solid) and obj.Items > 1:
<class 'AttributeError'>: 'FeaturePython' object has no attribute 'Surface'
14:19:23  16Standard_Failure Need at least two vertices, edges or wires to create loft face
14:19:23  Creation of surface is not possible !
14:19:23  <Part> ViewProviderExt.cpp(1306): Cannot compute Inventor representation for the shape of sink#CurvedArray: Bnd_Box is void
14:19:23  16Standard_Failure Need at least two vertices, edges or wires to create loft face
14:19:23  Creation of surface is not possible !
14:19:23  <Part> ViewProviderExt.cpp(1306): Cannot compute Inventor representation for the shape of sink#CurvedArray: Bnd_Box is void
14:19:23  Traceback (most recent call last):
  File "/home/mac/.local/share/FreeCAD/Mod/CurvedShapes/CurvedArray.py", line 196, in onChanged
    self.execute(fp)
  File "/home/mac/.local/share/FreeCAD/Mod/CurvedShapes/CurvedArray.py", line 179, in execute
    self.makeRibs(prop)
  File "/home/mac/.local/share/FreeCAD/Mod/CurvedShapes/CurvedArray.py", line 114, in makeRibs
    if (obj.Surface or obj.Solid) and obj.Items > 1:
<class 'AttributeError'>: 'FeaturePython' object has no attribute 'Surface'
14:19:23  16Standard_Failure Need at least two vertices, edges or wires to create loft face
14:19:23  Creation of surface is not possible !
14:19:23  <Part> ViewProviderExt.cpp(1306): Cannot compute Inventor representation for the shape of sink#CurvedArray001: Bnd_Box is void
14:19:23  16Standard_Failure Need at least two vertices, edges or wires to create loft face
14:19:23  Creation of surface is not possible !
14:19:23  <Part> ViewProviderExt.cpp(1306): Cannot compute Inventor representation for the shape of sink#CurvedArray001: Bnd_Box is void
14:19:23  AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
14:19:23  AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
This is the 2nd file where it didn't work. The 1st was past forum limit.
Attachments
SurfaceTo3Pipes.FCStd
(533.08 KiB) Downloaded 24 times
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
onekk
Veteran
Posts: 6098
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Curves workbench

Post by onekk »

Some scriptability tests of Curves WB, the code is working if you have correctly installed the AddOn.

I'm stating from this post.

https://forum.freecadweb.org/viewtopic. ... 27#p334527

Sadly this example will not work anymore, as something has changed in sources, so I have slightly modified some calls.

The relevant code is in:

https://forum.freecadweb.org/viewtopic. ... 70#p325870

Code: Select all

# Create the Gordon surface

gordon = freecad.Curves.gordon.InterpolateCurveNetwork([bs0,bs1,bs2],[bs3,bs4,bs5],0.1,0.001)
Part.show(gordon.surface().toShape())

DOC.recompute()
And leveraging some more the code present in Curves WB, I have obtained to make this code work, to show combs.

Code: Select all

FreeCADGui.Selection.clearSelection()
s = FreeCADGui.Selection.addSelection(obj5, "Edge1")

comb_obj = freecad.Curves.ParametricComb.ParametricComb()
comb_obj.Activated()


FreeCADGui.Selection.clearSelection()
s = FreeCADGui.Selection.addSelection(obj4, "Edge1")

comb_obj1 = freecad.Curves.ParametricComb.ParametricComb()
comb_obj1.Activated()
Sadly if freecad.Curves.ParametricComb.ParametricComb() will have a more direct mean to assign the curve to show it will be a very good thing.


Hope it will help to spread the use of Curves WB.

Regards

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/
User avatar
Chris_G
Veteran
Posts: 2572
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Curves workbench

Post by Chris_G »

With this commit, the Comb Activated() command returns the created FeaturePython object.
So you can now do :

Code: Select all

FreeCADGui.Selection.clearSelection()
s = FreeCADGui.Selection.addSelection(obj5, "Edge1")

comb_obj = freecad.Curves.ParametricComb.ParametricComb()
comb_fp = comb_obj.Activated()

# Change Comb target
comb_fp.Edge = (obj4, "Edge1")

User avatar
onekk
Veteran
Posts: 6098
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Curves workbench

Post by onekk »

Chris_G wrote: Wed Jan 12, 2022 3:25 pm With this commit, the Comb Activated() command
Many thanks, for the reply.

A part for the usual consideration, your WB is Experimental.

How stable is the interface.

I can't get an idea, as I've read almost all the 113 pages of this thread, so "Sweep to 2 Rails" seem to be deprecated in favour of "gordon surfaces",

One thing I'm missing is some customisation about the GeomInfo as they are not very readable.

Would it to be possible to add a GeomFontString to choose the font and maybe the color of the diaplyed info, or maybe something similar to these lines:

Code: Select all

	    f_name = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Curves").GeString('GeomInfoFontString', "FreeMono,FreeSans,sans") 
	    self.myFont.name = f_name
            size = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Curves").GetInt('GeomInfoFontSize', 14)
            print(size)
            self.myFont.size.setValue(size)
            self.SoText2 = coin.SoText2()
            self.SoText2.string = ""  # "Nothing Selected\r2nd line"
            pref_col = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Curves").GetString('GeomInfoFontColor', "0,0,0")
            color = tuple([float(x) for x in pref_col.split(',')])
            self.color = coin.SoBaseColor()
            self.color.rgb = color

Many thanks for your work and Best Regards.

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/
drmacro
Veteran
Posts: 8806
Joined: Sun Mar 02, 2014 4:35 pm

Re: Curves workbench

Post by drmacro »

Just note, in case someone else attempts to use Curves on Manjaro.

With the latest updates on Manjaro that installs Python 3.10 Curves is definitely broken.

I've not found the secret to adding another version of Python to Manjaro.

I guess it breaks pivy as well.

The Arch User Repository for freecad-git fails to complete the install as well, failing a bunch of test suite.

I have only been looking at Manjaro for a couple weeks, and am far from comfortable with this OS at this point.
So, there may be a simple fix or tweak to make it work...
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Post Reply