Search found 19 matches
- Sun Nov 27, 2022 5:43 pm
- Forum: Python scripting and macros
- Topic: Trouble creating a flat net of a polyhedron
- Replies: 7
- Views: 868
Re: Trouble creating a flat net of a polyhedron
Your script fails for me, acting on your goldbergtest03.FCStd file Attached the file I used. First thing I do is to wrap all faces (class W implementing __hash__ and __eq__, and allowing me to add additional information to each face easily) and collect them into a dictionary. Then I produce for eve...
- Sat Nov 26, 2022 7:53 pm
- Forum: Python scripting and macros
- Topic: Goldberg polyhedron macro failure
- Replies: 14
- Views: 1659
Re: Goldberg polyhedron macro failure
As to the latter, could it be related to TNP? I don't fully understand TNP yet, but I don't think so. Shape.hashCode() and Shape.isSame() exist and can be made good use of, so why not have Shape implement def __hash__(self): return self.hashCode() and def __eq__(self,other): return self.isSame(othe...
- Sat Nov 26, 2022 7:45 pm
- Forum: Python scripting and macros
- Topic: Labelling Faces of Shape
- Replies: 5
- Views: 768
Re: Labelling Faces of Shape
Thanks, that does make more sense. Ok, got it done: doc = App.ActiveDocument obj, = Gui.Selection.getSelection() shp = obj.Shape import Draft import math txtl = [] for i,f in enumerate(shp.Faces): pl = App.Placement() pl.Base = f.CenterOfMass pl.Rotation = App.Rotation(App.Vector(0,0,1),f.normalAt(...
- Sat Nov 26, 2022 7:30 pm
- Forum: Python scripting and macros
- Topic: Trouble creating a flat net of a polyhedron
- Replies: 7
- Views: 868
Re: Trouble creating a flat net of a polyhedron
My guess is that you will need to use the more powerful App.Rotation(e1, e2, e3, 'XYZ') constructor. See https://wiki.freecadweb.org/Sandbox:Edwilliams16#Rotations. The inverse of this will allow you to rotate a object with known orientation axes back into the global XYZ triad. Thanks, Ed. However ...
- Thu Nov 24, 2022 9:42 pm
- Forum: Python scripting and macros
- Topic: Trouble creating a flat net of a polyhedron
- Replies: 7
- Views: 868
Trouble creating a flat net of a polyhedron
Dear all, as part of my quest to use FreeCAD in a design project of mine I now need to create a flat net of a Goldberg polyhedron. In order to do so I labelled all the faces of the polyhedron in a reasonable manner, and then devised a scheme for the remaining face connectivity, and a recursive funct...
- Thu Nov 24, 2022 9:18 pm
- Forum: Python scripting and macros
- Topic: Goldberg polyhedron macro failure
- Replies: 14
- Views: 1659
Re: Goldberg polyhedron macro failure
It bothered me that I hadn't really used the topology of the dual. So I figured out another way. The following will take the dual of the selected polyhedron about a sphere of radius r. I understand. shape.ancestorsOfType() and shape.isSame() together with the shape.Faces and shape.Edges iterables g...
- Wed Nov 23, 2022 3:29 pm
- Forum: Python scripting and macros
- Topic: Labelling Faces of Shape
- Replies: 5
- Views: 768
Labelling Faces of Shape
Dear all, I'd like to create labels flat on all the faces of a selected shape. Sorry if this has been answered before but I could not find any article on this. My attempt is currently as following: doc = App.ActiveDocument obj, = Gui.Selection.getSelection() shp = obj.Shape txtl = [] for i,f in enum...
- Tue Nov 22, 2022 8:19 pm
- Forum: Python scripting and macros
- Topic: Goldberg polyhedron macro failure
- Replies: 14
- Views: 1659
Re: Goldberg polyhedron macro failure
Superb, Ed. I feel I start to understand Goldberg polyhedra a bit better. As to the transfer the topology to its dual I tried to improve your macro a bit by extracting and then using something of a data structure: import FreeCAD as App doc = App.ActiveDocument def dualofsphtriangle(n1, n2, n3): ''' ...
- Sat Nov 19, 2022 2:52 pm
- Forum: Python scripting and macros
- Topic: Goldberg polyhedron macro failure
- Replies: 14
- Views: 1659
Re: Goldberg polyhedron macro failure
I found the dual vertices ... Ed, I see you used the formula (n1.cross(n2) + n2.cross(n3) + n3.cross(n1))/n1.dot(n2.cross(n3)) and do some magic using the normalised vertex vectors of the triangular face of the geodesic sphere. I haven't seen that before. Which kind of point does that compute? What...
- Sat Nov 19, 2022 2:41 pm
- Forum: Python scripting and macros
- Topic: Goldberg polyhedron macro failure
- Replies: 14
- Views: 1659
Re: Goldberg polyhedron macro failure
The geodesic sphere is presumably good, so the problem is taking the dual. Where are you getting the dual algorithm from? The algorithm is of my doing, inspired by the Polar Reciprocation section of https://en.wikipedia.org/wiki/Dual_polyhedron, and by the Blender add_mesh_geodesic_domes source cod...