I have some code which tessellates the shape of a selected obey. If I try it on a Part::Sphere it just loops for ever.
Is this a bug?
OS: macOS 10.15
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16146 (Git)
Build type: Release
Branch: (HEAD detached at 0.18.4)
Hash: 980bf9060e28555fecd9e3462f68ca74007b70f8
Python version: 3.6.7
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedKingdom (en_GB)
Tessellate of sphere loops for ever.[Resolved]
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Tessellate of sphere loops for ever.[Resolved]
Last edited by keithsloan52 on Thu Jun 04, 2020 1:06 pm, edited 1 time in total.
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Re: Tessellate of sphere loops for ever.
Code: Select all
class TessellatePlanarFeature :
def Activated(self) :
from .GDMLObjects import GDMLTessellated, GDMLTriangular, \
ViewProvider, ViewProviderExtension
for obj in FreeCADGui.Selection.getSelection():
#if len(obj.InList) == 0: # allowed only for for top level objects
print('Action Tessellate')
if hasattr(obj,'Shape') :
print(obj.Shape.ShapeType)
if hasattr(obj.Shape,'Vertexes') :
numVert = len(obj.Shape.Vertexes)
print('Number of Vertex : '+str(numVert))
if numVert > 2 :
if hasattr(obj,'InList') :
parent = obj.InList[0]
#print(dir(parent))
myTess=parent.newObject("Part::FeaturePython", \
"GDMLTessellate_Tessellate")
tess = GDMLTessellated(myTess,0)
print(dir(tess))
if FreeCAD.GuiUp :
ViewProviderExtension(myTess.ViewObject)
ViewProvider(myTess.ViewObject)
print('About to Tessellate')
list = obj.Shape.tessellate(1)
print(len(list))
print(list)
prints About to Tessellate loops and never prints list
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Re: Tessellate of sphere loops for ever.
Interesting that if I try the Mesh workbench and Tessellate a Sphere choosing the standard option. It tessellates the sphere okay and
very quickly. Do I assume that the workbench which seems to be written in C++ uses different code to Tessellate a TopShape?
Would have thought at library level C++ or Python the function would be the same.
I assume that TopShape.Tessellate is using OCC function?
very quickly. Do I assume that the workbench which seems to be written in C++ uses different code to Tessellate a TopShape?
Would have thought at library level C++ or Python the function would be the same.
I assume that TopShape.Tessellate is using OCC function?
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Re: Tessellate of sphere loops for ever[Resolved]
Have switched to using Mesh facilities rather than Tessellate of Shape ( TopShape )