Skip to content

gi-nx


gi-nx / updateUsage

ts
function updateUsage(usageName: string, updates: Partial<Usage>): void;

Update an existing usage definition. Accepts a partial — only the fields you provide will be merged into the existing usage. Set a field to null to remove it.

updateUsage(usageName: string, updates: Partial<Usage>): void

The updates object must use the nested Usage structure. Properties go inside default or join, never at the top level:

typescript
// CORRECT — floorToFloor inside join
{ join: { floorToFloor: 4.2 } }

// WRONG — floorToFloor at top level (will be ignored)
{ floorToFloor: 4.2 }

Parameters

ParameterTypeDescription
usageNamestringThe name of the usage to update (e.g. 'Residential').
updatesPartial<Usage>Partial Usage object with default and/or join keys. Fields within each are shallow-merged. Set a field to null to delete it.

Returns

void

Throws

Error if the usage does not exist.

Example

typescript
// Update the height default — all other fields are preserved
rpc.invoke("updateUsage", ["Residential", {
  default: { height: 25 }
}]);

// Update a join property
rpc.invoke("updateUsage", ["Commercial", {
  join: { floorToFloor: 4.2 }
}]);

// Remove the 'color' default
rpc.invoke("updateUsage", ["Residential", {
  default: { color: null }
}]);