Dynamo Mobius Strip

A Dynamo graph that has the Mobius Strip created using Python :slight_smile:

Requirements:

Dynamo_Mobius_Strip.dyn (31.9 KB)

import clr 
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('DSCoreNodes')
from DSCore import List as ls

import numpy as np 
import pandas as pd

# Amount of Points per line
pntAmt = IN[0]

theta = np.linspace(0, 2 *np.pi, 30)
w = np.linspace(-0.25, 0.25, pntAmt)
w, theta = np.meshgrid(w, theta)

phi = 0.5 * theta

#radius in x-y plane
r = 1 + w * np.cos(phi)

x = np.ravel(r * np.cos(theta))
y = np.ravel(r * np.sin(theta))
z = np.ravel(w * np.sin(phi))

numX = [float(i) for i in x]
numY = [float(i) for i in y]
numZ = [float(i) for i in z]

_points = [Point.ByCoordinates(x,y,z) for x,y,z in zip(numX,numY,numZ)]

OUT = _points
10 Likes

Here is my graph for the Mobius strip using only OOTB nodes. I think it鈥檚 a good exercise for manipulating geometries in Dynamo, thanks @solamour

MobiusStripOOTB.dyn (32.9 KB)

3 Likes

I wanted to play with some color the other day, and just finished up this iteration:

This is a great thread to illustrate that there are many ways to produce a given outcome. :grin:

4 Likes

Mmmm鈥 bring on the Mobius candy! :candy: :lollipop:

1 Like

Test with open3d

import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import numpy as np

clr.AddReference('Python.Included')
import Python.Included as pyInc
path_py3_lib = pyInc.Installer.EmbeddedPythonHome
sys.path.append(path_py3_lib + r'\Lib\site-packages')
import open3d as o3d

geo = o3d.geometry.TriangleMesh.create_mobius(length_split=70, width_split=15, twists=2, raidus=2, flatness=1, width=2, scale=2)
vertices = geo.vertices
surfaces = []
for i, j, k in geo.triangles:
    pta = Point.ByCoordinates(*vertices[i])
    ptb = Point.ByCoordinates(*vertices[j])
    ptc = Point.ByCoordinates(*vertices[k])
    surfaces.append(Surface.ByPerimeterPoints([pta, ptb, ptc]))
OUT = surfaces
4 Likes