Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client component brace [AB#1612445] #495

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions resources/schema/spidacalc/client/componentBrace.schema
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"description": "Engineering properties for a component brace",
"id": "#/spidacalc/client/componentBrace.schema",
"type": "object",
"required": [
"size",
"width",
"depth",
"weightPerLength",
"modulus",
"wallThickness",
"shape",
"materialCategory",
"alleyArm",
"throughHoleDiameter"
],
"anyOf":[
{"required":["maxStrength"]},
{"required":["maxTension", "maxCompression"]}
],
"properties": {
"id": {
"type": "string"
},
"version": {
"type": "string"
},
"size": {
"type": "string"
},
"length": {
"$ref": "../../general/measurable.schema"
},
"width": {
"$ref": "../../general/measurable.schema"
},
"depth": {
"$ref": "../../general/measurable.schema"
},
"weightPerLength": {
"$ref": "../../general/measurable.schema"
},
"modulus": {
"$ref": "../../general/measurable.schema"
},
"wallThickness": {
"$ref": "../../general/measurable.schema"
},
"shape": {
"$ref": "../../spidacalc/client/enums/shape.schema"
},
"materialCategory": {
"$ref": "../../spidacalc/client/enums/material_category.schema"
},
"alleyArm": {
"type": "boolean"
},
"maxStrength": {
"$ref": "../../general/measurable.schema"
},
"maxTension": {
"$ref": "../../general/measurable.schema"
},
"maxCompression": {
"$ref": "../../general/measurable.schema"
},
"throughHoleDiameter": {
"$ref": "../../general/measurable.schema"
},
"aliases": {
"type": "array",
"items": {
"description": "A list of alternative aliases/framing codes for this item in integrations.",
"$ref": "../../spidacalc/client/alias.schema"
}
}
},
"additionalProperties": false
}
6 changes: 6 additions & 0 deletions resources/schema/spidacalc/client/data.schema
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@
"items": {
"$ref": "../../spidacalc/client/truss.schema"
}
},
"componentBraces": {
"type": "array",
"items": {
"$ref": "../../spidacalc/client/componentBrace.schema"
}
}
},
"additionalProperties": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class ConverterUtils {
converter.addChangeSet(12, new CSAMaxWindTemperatureChangeset())
converter.addChangeSet(12, new PushBraceHeightChangeSet())
converter.addChangeSet(12, new TensionOverrideChangeset())
converter.addChangeSet(12, new ComponentBraceChangeset())
// add calc changesets above here

converter.setCurrentVersion(currentVersion)
Expand All @@ -112,6 +113,7 @@ class ConverterUtils {
converter.addChangeSet(11, new TrussChangeSet())
converter.addChangeSet(12, new CSAMaxWindTemperatureChangeset())
converter.addChangeSet(12, new TensionOverrideChangeset())
converter.addChangeSet(12, new ComponentBraceChangeset())
// add client data changesets above here

converter.setCurrentVersion(currentVersion)
Expand Down Expand Up @@ -139,6 +141,7 @@ class ConverterUtils {
converter.addChangeSet(12, new PushBraceHeightChangeSet())
converter.addChangeSet(12, new TensionOverrideChangeset())
converter.addChangeSet(12, new DetailedResultsVersionChangeset())
converter.addChangeSet(12, new ComponentBraceChangeset())
// add result changesets above here

converter.setCurrentVersion(currentVersion)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright (c) 2025 Bentley Systems, Incorporated. All rights reserved.
*/
package com.spidasoftware.schema.conversion.changeset.v12

import com.spidasoftware.schema.conversion.changeset.ConversionException
import com.spidasoftware.schema.conversion.changeset.client.AbstractClientDataChangeSet
import groovy.transform.CompileStatic

@CompileStatic
class ComponentBraceChangeset extends AbstractClientDataChangeSet {

@Override
boolean applyToClientData(Map clientDataJSON) throws ConversionException {
// do nothing
return false
}

@Override
boolean revertClientData(Map clientDataJSON) throws ConversionException {
boolean anyChanged = false
if(clientDataJSON.containsKey("componentBraces")) {
anyChanged = !(clientDataJSON.componentBraces as List).isEmpty()
clientDataJSON.remove("componentBraces")
}

clientDataJSON.assemblies?.each { Map assembly ->
anyChanged |= revertStructure(assembly.assemblyStructure as Map)
}
return anyChanged
}

@Override
void revertDesign(Map designJSON) throws ConversionException {
super.revertDesign(designJSON)

if (designJSON.structure != null) {
revertStructure(designJSON.structure as Map)
}
}

@Override
boolean revertResults(Map resultsJSON) throws ConversionException {
super.revertResults(resultsJSON)

if (resultsJSON.analyzedStructure != null) {
return revertStructure(resultsJSON.analyzedStructure as Map)
}
return false
}

protected boolean revertStructure(Map structureJSON) {
return false // todo AB#1614910
}
}