From 16df329c18cbb198688277dcdba785e3bb40d081 Mon Sep 17 00:00:00 2001 From: Jason Garrett Date: Mon, 24 Feb 2025 16:31:31 -0500 Subject: [PATCH 1/3] add client component braces --- .../spidacalc/client/componentBrace.schema | 79 +++++++++++++++++++ resources/schema/spidacalc/client/data.schema | 6 ++ 2 files changed, 85 insertions(+) create mode 100644 resources/schema/spidacalc/client/componentBrace.schema diff --git a/resources/schema/spidacalc/client/componentBrace.schema b/resources/schema/spidacalc/client/componentBrace.schema new file mode 100644 index 00000000..ed9cea08 --- /dev/null +++ b/resources/schema/spidacalc/client/componentBrace.schema @@ -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 +} \ No newline at end of file diff --git a/resources/schema/spidacalc/client/data.schema b/resources/schema/spidacalc/client/data.schema index b40672e3..eef54f5f 100644 --- a/resources/schema/spidacalc/client/data.schema +++ b/resources/schema/spidacalc/client/data.schema @@ -209,6 +209,12 @@ "items": { "$ref": "../../spidacalc/client/truss.schema" } + }, + "componentBraces": { + "type": "array", + "items": { + "$ref": "../../spidacalc/client/componentBrace.schema" + } } }, "additionalProperties": false From 257db50a4af41c1373d20252d16586ebb0248036 Mon Sep 17 00:00:00 2001 From: Jason Garrett Date: Mon, 24 Feb 2025 16:42:59 -0500 Subject: [PATCH 2/3] add missing comma --- resources/schema/spidacalc/client/componentBrace.schema | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/schema/spidacalc/client/componentBrace.schema b/resources/schema/spidacalc/client/componentBrace.schema index ed9cea08..a690ee6c 100644 --- a/resources/schema/spidacalc/client/componentBrace.schema +++ b/resources/schema/spidacalc/client/componentBrace.schema @@ -66,7 +66,7 @@ }, "throughHoleDiameter": { "$ref": "../../general/measurable.schema" - } + }, "aliases": { "type": "array", "items": { From c34a86718364d10a3cb03f18e30e789b4135c902 Mon Sep 17 00:00:00 2001 From: Jason Garrett Date: Tue, 25 Feb 2025 09:59:50 -0500 Subject: [PATCH 3/3] add changeset --- .../changeset/ConverterUtils.groovy | 3 + .../v12/ComponentBraceChangeset.groovy | 55 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 src/main/groovy/com/spidasoftware/schema/conversion/changeset/v12/ComponentBraceChangeset.groovy diff --git a/src/main/groovy/com/spidasoftware/schema/conversion/changeset/ConverterUtils.groovy b/src/main/groovy/com/spidasoftware/schema/conversion/changeset/ConverterUtils.groovy index c2661cb6..fea22eaf 100644 --- a/src/main/groovy/com/spidasoftware/schema/conversion/changeset/ConverterUtils.groovy +++ b/src/main/groovy/com/spidasoftware/schema/conversion/changeset/ConverterUtils.groovy @@ -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) @@ -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) @@ -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) diff --git a/src/main/groovy/com/spidasoftware/schema/conversion/changeset/v12/ComponentBraceChangeset.groovy b/src/main/groovy/com/spidasoftware/schema/conversion/changeset/v12/ComponentBraceChangeset.groovy new file mode 100644 index 00000000..aa661515 --- /dev/null +++ b/src/main/groovy/com/spidasoftware/schema/conversion/changeset/v12/ComponentBraceChangeset.groovy @@ -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 + } +}