[SOLVED] Looking for ideas to create a surface design on an elipsoid

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!
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: [SOLVED] Looking for ideas to create a surface design on an elipsoid

Post by Kunda1 »

Cool thread.
I wanted to drop a recent tutorial made by Joko Engineering (aka @Celica_Supra) that is relevant:
phpBB [video]
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
mario52
Veteran
Posts: 4701
Joined: Wed May 16, 2012 2:13 pm

Re: [SOLVED] Looking for ideas to create a surface design on an elipsoid

Post by mario52 »

hi

here little macro for follow the surface to the ovoid

Code: Select all

##https://forum.freecadweb.org/viewtopic.php?f=3&t=47340
##Looking for ideas to create a surface design on an elipsoid
##07/07/2020
##Mario52
#
import Draft, Part

# select First the object to work (here oeuf (ellipse))
# select the object to clone (must be created in the y axis)
# run the macro
####
# PS: if only one object is selected, only the AXIS is created
####

#### configuration begin ####
ValueLenght     = -300.0 # value lenght of bject (and length of axis if is negatif " - " reverse the axis)
beginStep       = 0      # must be smaller of valueNumberCopy 
#
valueNumberCopy = 300    # number of copy (begin from beginStep to valueNumberCopy) 
                         # then beginStep=20 valueNumberCopy=60 number objects: 60-20=40
                         # valueNumberCopy cannot exceed ValueLenght
#
valueStep       = 1      # step of step (min 1) ex: valueStep=10 then 10, 20, 30, 40, .....
                         # the object make a little rotation at each step !!! domage
#### configuration end ####

valueNumberCopy = valueNumberCopy + beginStep
if valueNumberCopy > int(abs(ValueLenght)):
    valueNumberCopy = int(abs(ValueLenght))

selectedEdge0  = FreeCADGui.Selection.getSelectionEx()[0].SubObjects[0]   # select one element
SubElementName = FreeCADGui.Selection.getSelectionEx()[0].SubElementNames[0]
sel            = FreeCADGui.Selection.getSelection()
selectedEdge   = selectedEdge0

objectBase   = sel[0]
try:
    objectToCopy = sel[1]
except Exception:
    None

plr = plDirection = FreeCAD.Placement()

comptV = 0
comptC = 0
for i in range(beginStep, int(abs(valueNumberCopy)), valueStep):
    comptV += 1
    try:
        ########## section direction
        yL = App.Vector(float(i), float(0), float(0))
        uv = selectedEdge.Surface.parameter(yL)
        nv = selectedEdge.normalAt(uv[0], uv[1])
        direction = yL.sub(nv + yL)
        r = App.Rotation(App.Vector(0,0,1),direction)
        plDirection.Rotation.Q = r.Q
        plDirection.Base = yL
        plr = plDirection
        ########## section direction
    
        ########## section axis
        points=[FreeCAD.Vector(0.0,0.0,(ValueLenght * 2.0)) ,FreeCAD.Vector(0.0,0.0,0.0)]
#        points=[FreeCAD.Vector(0.0, 0.0, 0.0) ,FreeCAD.Vector(0.0, 0.0, (ValueLenght * 2.0))]
        centerX = Draft.makeWire(points,closed=False,face=False,support=None)
        centerX.Placement = plr
        centerX.Label = "Axis_" + SubElementName
        ########## section axis

        ########## section clone
        try:
            if len(sel) == 2:
                objectClone = Draft.clone(objectToCopy) #
                objectClone.Placement = plr
        except Exception:
            None
        ########## section clone
        comptC += 1
    except Exception:
        print("ouf creation ",comptV)
        None
print(comptC," to ", comptV," objects created")


oeuf00_000.png
oeuf00_000.png (13.44 KiB) Viewed 655 times
oeuf_00.FCStd
(62.6 KiB) Downloaded 13 times
EDIT: 7/7/2020 22h02 little correction code

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
TomB19
Posts: 179
Joined: Wed May 01, 2019 4:58 am

Re: [SOLVED] Looking for ideas to create a surface design on an elipsoid

Post by TomB19 »

Thank you, Mario.

I'm new to Macros so it looks like you're giving me a skeleton routine that I can modify to draw hex onto my ovoid?

I like the idea because working with the current model, which does look the way I hoped it would, is a nightmare. Every action is followed by a 15 minute pause. If I could simplify the model and reduce the feature collisions, I could get to the next phase a lot more easily.
mario52
Veteran
Posts: 4701
Joined: Wed May 16, 2012 2:13 pm

Re: [SOLVED] Looking for ideas to create a surface design on an elipsoid

Post by mario52 »

hi

I think the long time for execute your project is the many (beaucoup) number of object and creation of many surface

the macro help you just for follow the surface (normale, axis perpendicular of point position of the surface )

you can post your file (sketch and hexagon) for the real dimension (just for see)

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
User avatar
Vincent B
Veteran
Posts: 4741
Joined: Sun Apr 05, 2015 9:02 am
Location: La Rochelle, France

Re: [SOLVED] Looking for ideas to create a surface design on an elipsoid

Post by Vincent B »

here an honey comb challenge:
https://forum.freecadweb.org/viewtopic. ... &hilit=nid
...
need time to thinking about a irrugular array.. :roll:
TomB19
Posts: 179
Joined: Wed May 01, 2019 4:58 am

Re: [SOLVED] Looking for ideas to create a surface design on an elipsoid

Post by TomB19 »

Merci. 8-)
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: [SOLVED] Looking for ideas to create a surface design on an elipsoid

Post by keithsloan52 »

Very impressive.

I think if I was contemplating making such an object, I would consider making/programming it in OpenSCAD.
I would have thought it was easier to do in OpenSCAD and also to test out variations etc.

Depending on what the final objective is, it could stay as just OpenSCAD or try importing into FreeCAD.
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: [SOLVED] Looking for ideas to create a surface design on an elipsoid

Post by keithsloan52 »

TomB19 wrote: Wed Jul 08, 2020 9:49 pm Thank you, Mario.

I'm new to Macros so it looks like you're giving me a skeleton routine that I can modify to draw hex onto my ovoid?

I like the idea because working with the current model, which does look the way I hoped it would, is a nightmare. Every action is followed by a 15 minute pause. If I could simplify the model and reduce the feature collisions, I could get to the next phase a lot more easily.
15 minute pause - That is why I would have tried using OpenSCAD, think it is much better suited for creation of such objects.
Post Reply