-
Notifications
You must be signed in to change notification settings - Fork 3
Home
Welcome to building py!
look on the right to see the documentation per class.
go to Setup to learn how to setup building py.
to search in code, use this filter:
BuildingPy*,*single_file.py,docs/usage*,Versie*,example,sandbox
we are using PEP guidelines:
- class names are PasCalCased.
- other (method, function, file, folder, variable) names are snake_cased.
every variable should have a functional name. so no 'a', 'b', 'i', 'j', 'k' or '_'
module structure: geometry contains all geometric classes that aren't mathematical concepts, like pointclouds. abstract contains concept classes. exchange contains extrenal libraries, we don't include any files from there in the default buildingpy.py
to use a class's own type, we use Self (typing.Self)
properties don't have 'get' in front of them. does the property not modify the object and doesn't take arguments? then it's marked with @property
math follows conventions found on wikipedia:
- rotation is counter-clockwise, PI * 2 is a full rotation. polygon winding order is counter-clockwise
- 2d rotation starts from x 1 y 0, so the angle of x 1 y 0 = 0 and the angle of x 0 y 1 = PI / 2
- matrixes and points multiply from right to left (matrix-last * matrix-first, matrix * point-first)
- we're following the right hand rule for things like axes and the cross product.
- color components are ordered in r, g, b, a order.
- statical moment takes y = 0 as origin, and multiplies area with the y coordinate of the centroid. transform objects to measure statical moment on other orientations.
arrays are x - minor, y - major, z - even more major etc.
2D vectors use X, Y
+X = right
+Y = up
+Z = front
all classes derive from serializable
we don't check types at run time (using isinstance) but rather use try/catch as much as possible. we denote types as much as possible. we don't use import * that way, we can import circularly when needed.
we use names from dynamo in python format, so PolyCurve.ByPoints becomes PolyCurve.by_points. when there are operators available though, we prefer to use operators, but also provide named functions which just call these operators.