Polyhedron ball + cone starting from surface to center


#1

Hello,
I want to create an array of cones, that form all together a sphere, tip of the cones = center of sphere. I’ve started now from a polyhedron, and creating from each facet a cone toward the center of the ball. But this is way too slow, is there a way I can do this more efficient?

Thanks!

question R5.3dm (10.0 MB)


(Pascal Golay) #2

Hello - if you can get the circles on the hexagons, you can select them all at once and ExtrudeCrvToPoint (0,0,0,)

@Philippe1 Here’s a quick Python that will make circles from the hexagons - (DupBorder on the hexagonal faces) It leaves them selected, so run ExtrudeCurveToPoint 0,0,0 and you should be done - Cap the results if needed.
Note, it does not do any checking to see if you actually have a proper hexagon - that’s up to you…

import Rhino
import scriptcontext as sc
import rhinoscriptsyntax as rs


def CircleFromPolygon():
    
    crvIds = rs.GetObjects("Select hexagons.", 4, preselect=True)
    if not crvIds: return
    tol = sc.doc.ModelAbsoluteTolerance
    angTol = sc.doc.ModelAngleToleranceRadians
    
    circleIds = []
    for id in crvIds:
        
        crv= sc.doc.Objects.Find(id).Geometry
        simplify = Rhino.Geometry.CurveSimplifyOptions.All
        crv.Simplify(simplify, tol, angTol)
        rc, pLine = crv.TryGetPolyline()
       
        pts = []
        if rc:
    
            for i in range(pLine.Count-1):
                pts.append ((pLine[i]+pLine[i+1])* .5)
        
        rc, circle = Rhino.Geometry.Circle.TryFitCircleToPoints(pts)
        if rc: 
            circleIds.append(sc.doc.Objects.AddCircle(circle))
            
    if len(circleIds) > 0:
        sc.doc.Objects.UnselectAll()
        rs.SelectObjects(circleIds)
    sc.doc.Views.Redraw()
        
if __name__ == "__main__": CircleFromPolygon()

It looks like you may want to OffsetMultiple the initial border curves.

-Pascal


#3

WOW!!! This is just brilliant, this software doesn’t stop to amaze me!! Thanks so much!!!


#4

One more question, when I use OffsetMultiple it doesn’t delete the input or auto selects the result, is there a way to make the selection easier than selecting one by one?


#5

What happens to those pesky stray pentagons?


(Pascal Golay) #6

Hello - SelLast should get the offsets selected.

-Pascal


(Pascal Golay) #7

Should work on those as well.

-Pascal


#8

ha again beauty! :slight_smile: thanks!