Week 2: Transformation and Nesting Objects With Rhino

Introduction: Week 2: Transformation and Nesting Objects With Rhino

Assignment: Create a set of small stacking or nesting objects functional or otherwise (cups, baskets, coasters, measuring spoons, Matryoshka dolls etc.)

Findings:

I made a shelled heart shape using a set of grasshopper operations. I think due to the asymmetry of the shape, the scale and nesting is not perfect. Some places is closer to each other, like the corners, while other places are far away. So I use the closest places as referencing points for vector adjustment. After baking all generated objects, I use manual moving and snapping to nest and stack the objects.

For object transformation, I altered the code with a scale offset to control the scale.

Problem:

One problem I have is on the surface morph. In the example Jennifer gave, the 'surf' input of surfmorph is connected to a geometry component. But I got error like: data conversion failed from brep to surface. I also tried extracting the surface, it works when the surface is not 'closed'. Wondering how should I change my code to the closed surface.

Here is the complete python code:

"""Provides a scripting component.<br>    Inputs:
        x: The x script variable
        y: The y script variable
    Output:
        a: The a output variable"""
__author__ = "mengjia"
import rhinoscriptsyntax as rs
import Rhino.Geometry as geom
'''function to create an affine transformation given two points and a scale value'''
def TransformFrom2Points(p0,p1,s):
    v1 = p1-p0
   
    
    v3 = rs.CreateVector(0,0,1)
    v2 = geom.Vector3d.CrossProduct(v3,v1)
    v3 = geom.Vector3d.CrossProduct(v1,v2)
    v1.Unitize()
    v2.Unitize()
    v3.Unitize()
   
    t = geom.Transform.Identity
    t.M00 = v1.X*s
    t.M10 = v1.Y*s
    t.M20 = v1.Z*s
    t.M01 = v2.X*s
    t.M11 = v2.Y*s
    t.M21 = v2.Z*s
    t.M02 = v3.X*s
    t.M12 = v3.Y*s
    t.M22 = v3.Z*s
    t.M03 = p0.X
    t.M13 = p0.Y
    t.M23 = p0.Z
    return t
    
'''get points from first and last point of first curve in input list'''
p0 = c[0].PointAtStart
p1 = c[0].PointAtEnd
'''list for storing transformed geometry'''
geomOutput = []
'''calculating inital scaling value based on distance between first and last point'''
s = (p1-p0).Length/100
'''loop through count set by input slider'''
for i in range(0,count):
    
    '''create a duplicate of input geomety, calculate the transformation and apply to the duplicate'''
    gC = g.Duplicate();
    t = TransformFrom2Points(p0,p1,s)
    gC.Transform(t)
    geomOutput.append(gC)
    '''calculate the placement based on the bounding box of the input geometry'''
    bbox = geomOutput[i].GetBoundingBox(geom.Plane.WorldXY)
    center = bbox.Center
    center.Z = center.Z-stackingOffset
    '''set points for next transformation relative to the bounding box of the previously transformed geometry'''
    diff = center-p0
    p0 = center
    p1 = p1+diff
    s = s + soffset
    
a = geomOutput

Printing:

I printed the smallest and the second smallest object for demonstration. The bed leveling test took sometime and resulting printing is good after some adjustment.

Be the First to Share

    Recommendations

    • Tinkercad Student Design Contest

      Tinkercad Student Design Contest
    • Lamps and Lighting Contest

      Lamps and Lighting Contest
    • Micro:bit Contest

      Micro:bit Contest

    4 Comments

    0
    sambourgault
    sambourgault

    1 year ago

    I love the shape you decided to go with. Fabrication can be playful and useful at the same time! And your prints look sharp! The vertical borders of the heart seem really thin. Did you have to adjust some settings to obtain such precision and fine resolution?

    0
    mengjiazhu
    mengjiazhu

    Reply 1 year ago

    Thanks! I actually used the standard setting, like standard filling, and 0.4 mm nozzle I think. The printer should have 0.4mm resolution if no technical fails. The thickness I have on the smallest one maybe around 2~3mm.

    0
    weidi
    weidi

    1 year ago

    I like the shape which is so joyful! and I also enjoyed seeing your 3d printing objects!