DesignScript Geometry Basics
Last updated
Last updated
The simplest geometrical object in the Dynamo standard geometry library is a point. All geometry is created using special functions called constructors, which each return a new instance of that particular geometry type. In Dynamo, constructors begin with the name of the object’s type, in this case Point, followed by the method of construction. To create a three dimensional point specified by x, y, and z Cartesian coordinates, use the ByCoordinates constructor:
Constructors in Dynamo are typically designated with the “By” prefix, and invoking these functions returns a newly created object of that type. This newly created object is stored in the variable named on the left side of the equal sign.
Most objects have many different constructors, and we can use the BySphericalCoordinates constructor to create a point lying on a sphere, specified by the sphere’s radius, a first rotation angle, and a second rotation angle (specified in degrees):
Points can be used to construct higher dimensional geometry such as lines. We can use the ByStartPointEndPoint constructor to create a Line object between two points:
Similarly, lines can be used to create higher dimensional surface geometry, for instance using the Loft constructor, which takes a series of lines or curves and interpolates a surface between them.
Surfaces too can be used to create higher dimensional solid geometry, for instance by thickening the surface by a specified distance. Many objects have functions attached to them, called methods, allowing the programmer to perform commands on that particular object. Methods common to all pieces of geometry include Translate and Rotate, which respectively translate (move) and rotate the geometry by a specified amount. Surfaces have a Thicken method, which take a single input, a number specifying the new thickness of the surface.
Intersection commands can extract lower dimensional geometry from higher dimensional objects. This extracted lower dimensional geometry can form the basis for higher dimensional geometry, in a cyclic process of geometrical creation, extraction, and recreation. In this example, we use the generated Solid to create a Surface, and use the Surface to create a Curve.