I’m trying to build a class, but i get an error stating
Error: ‘;’ is expected
class Profile
{
department = " ";
subDepartment = " ";
name = " ";
count = 0;
area = 0.0;
comments = " ";
guidelines = " ";
id = " ";
constructor ByValues (d, sD, n, ct, a, cm, g, id)
{
this.department = d;
this.subDepartment = sD
this.name = n;
this.count = ct;
this.area = a;
this.comments = cm;
this.guideline = g;
this.id = id;
}
};
I copied some code from the spec document and that fails in the same way. I feel like there’s something really basic i’m missing here, but am having trouble finding other tutorials
class Point2D
{
x = 0;
y = 0;
constructor ByCoordinates (x,y)
{
this.x = x;
this.y = y;
}
};
ah. i overlooked the line in the Design Script Guide: just like you said.
Note: Classes can only be declared in DesignScript script files or files that have a .DS extension. Class
declarations are not allowed in code block nodes in Dynamo. DS files can be imported into a Dynamo
session to be consumed as nodes.
i was trying to streamline the management of a ‘profile’ as part of a space planning graph. currently, i’m using a dictionary, but thought it would be nicer to just be able to use . access notation. Also recognize that classes are something that i don’t really understand to well so i thought this might be the right situation to use it.