Scia.external update_concrete_material - non-intuitive way of using updated material

When using the update_concrete_material method using the newly updated material directly inside a cross section object will result in a (vague) error. E.g.:

    mode = Model()
    material = scia_model.update_concrete_material(
                    315, "C30/37", Concrete.ECPart.GENERAL, e_modulus=12000 * 1e6
                )
    cross_section = model.create_circular_cross_section('concrete_pile', material, pile_diameter)

    model.generate_xml_input()

will result in the following error:

Exception: Input file could not be generated, please check your model

which is not very clear.

I found out that If you want this to work you have the change the snippet to this:

    mode = Model()
    material = scia_model.update_concrete_material(
                    315, "C30/37", Concrete.ECPart.GENERAL, e_modulus=12000 * 1e6
                )
    material = Material(material.object_id,material.name)
    cross_section = model.create_circular_cross_section('concrete_pile', material, pile_diameter)

    model.generate_xml_input()

Which I think is very strange. I assume that (as Concrete is not a subclass of Material) there is a check if the material is an instance of Material, and the xml generating is failing there?

Although this workaround works fine there are two things not that great: a. the error message is not informative. b. this should just work because the only thing you need for css creation is the name and object_id of the material.

I hope you can improve this.

Thanks,
Wichard

Hi Wichard,

Thanks for the notice, this indeed seems like the error message could at least be specified a little bit more. I’ll include this in our issue tracker.

Just to make sure, are you sure the material was already present in the model before you updated it? If not could possibly make sense that you have to re-state the material before you are able to use it in the cross_section

If I understand your question correctly: I cannot generate the XML in viktor, so i’m not even ‘in’ SCIA yet.

The viktor.external.scia.Model() object doesn’t need the material inside the object (the workaround is not adding it to the object (as far as I know but @khameeteman will know that for sure) It just mimics a scia material with a name and ID.

Your second snippet is indeed correct. The update_concrete_material method returns a Concrete type object, while the create_circular_cross_section method requires a Material type object. However, after seeing this it indeed makes sense to me to directly pass the Concrete type to your cross-section(s).