Hi Daniel
You can create an module using the following code:
// create your working copy and then...
const model = workingCopy.model();
const modelProject : projects.IProject = model.allProjects()[0];
const module = projects.Module.createIn(modelProject);
const moduleSecurity = security.ModuleSecurity.createIn(module);
const domainModel = domainmodels.DomainModel.createIn(module);
If you want to add module roles:
const moduleRole = security.ModuleRole.createIn(moduleSecurity);
moduleRole.name = "Administrator";
If you want to add an entity into your domain model:
const entity = domainmodels.Entity.createIn(domainModel);
entity.name = "MyNewEntity";
entity.location = { 50, 50 };
Adding a string attribute to your entity:
const type = domainmodels.StringAttributeType.create(model);
type.length = 200;
const value = domainmodels.StoredValue.create(model);
value.defaultValue = "Hello!";
const attribute = domainmodels.Attribute.create(model);
attribute.name = "MyStringAttribute";
attribute.type = type;
attribute.value = value;
entity.attributes.push(attribute);
Hope that helps to get your on your way!
Cheers
iain