I found a bug in the update_concrete_material. At least it doesnât work as expected.
As a developer I want to use the standard available materials in the SCIA and change the properties of them. In this case C12/15 and C16/20 are never used by our users. I would like to update the properties aswell as the name of that material. e.g. â I want to change the material name : âC12/15â to âC45/55-crackedâ. I know you can do that with an xml, but viktor doesnât allow us. The main problem is that materials in the scia file are looked up by name (nm attribute) FIRST and after that by using the object_id.
A code snippet of the model creation:
scia_model = SciaModel()
#C12/15 has an object ID of 315
material_cracked = scia_model.update_concrete_material(
315, C45/55, Concrete.ECPart.GENERAL, e_modulus=12000
)
will result in xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<project xmlns="http://www.scia.cz">
<def uri="viktor.xml.def"/>
<container id="{16B20277-A13B-4689-97D5-68F2BACF1318}" t="EP_MaterialEC.EP_MaterialHeaderEC_EN.1">
<table id="42334686-C9D2-463B-A9EC-C637F50EBD73" t="EP_MaterialEC.EP_MaterialCrtEC_EN.1">
<h>
<h0 t="Name"/>
<h1 t="Thermal expansion "/>
<h2 t="Unit mass"/>
<h3 t="Density in fresh state"/>
<h4 t="E modulus"/>
<h5 t="Poisson coeff."/>
<h6 t="Independent G modulus"/>
<h7 t="G modulus"/>
<h8 t="Log. decrement (non-uniform damping only)"/>
<h9 t="Specific heat"/>
<h10 t="Thermal conductivity"/>
<h11 t="Characteristic compressive cylinder strength fck(28)"/>
<h12 t="Calculated depended values"/>
</h>
<obj id="315" nm="C45/55">
<p0 v="C45/55"/>
<p4 v="36283188218.91413"/>
<p6 v="0"/>
<p12 v="0"/>
</obj>
</table>
</container>
</project>
As a result this will update the C45/55 properties at object_id: 322 and not (as expected) at 315!
The quickest fix is by removing the nm attribute from the xml and there by forcing a lookup by object_id. As an alternative you could also extend the âupdate_concrete_materialâ method with a âold_nameâ parameter, but Iâm afraid this will have some backwards compatibility issues.
The correct output xml should be:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<project xmlns="http://www.scia.cz">
<def uri="viktor.xml.def"/>
<container id="{16B20277-A13B-4689-97D5-68F2BACF1318}" t="EP_MaterialEC.EP_MaterialHeaderEC_EN.1">
<table id="42334686-C9D2-463B-A9EC-C637F50EBD73" t="EP_MaterialEC.EP_MaterialCrtEC_EN.1">
<h>
<h0 t="Name"/>
<h1 t="Thermal expansion "/>
<h2 t="Unit mass"/>
<h3 t="Density in fresh state"/>
<h4 t="E modulus"/>
<h5 t="Poisson coeff."/>
<h6 t="Independent G modulus"/>
<h7 t="G modulus"/>
<h8 t="Log. decrement (non-uniform damping only)"/>
<h9 t="Specific heat"/>
<h10 t="Thermal conductivity"/>
<h11 t="Characteristic compressive cylinder strength fck(28)"/>
<h12 t="Calculated depended values"/>
</h>
<obj id="315">
<p0 v="C45/55"/> <! -- NEW MATERIAL NAME -->
<p4 v="36283188218.91413"/>
<p6 v="0"/>
<p12 v="0"/>
</obj>
</table>
</container>
</project>
WORKAROUND:
As I workaround I will remove the nm attribute myself.