Error: running idea example from documentation

I am working on a new application used the ideaRcs worker v4.12.0 and Idea v21.1.
Using the example code link SDK

I placed all code under one DownloadButton. How come I cannot generate the Idea model? It says: “please check correctness of input file” however I am using the example code

    def download_idea_file(self, params: Munch, entity_id: int, **kwargs) -> DownloadResult:
                model = idea.OpenModel()  # empty model, or optionally pass ProjectData and/or CodeSettings

        # Create the concrete section.
        mat = model.create_matconcrete_ec2(idea.ConcreteMaterial.C12_15)
        cs = model.create_cross_section_parameter(name='cs', cross_section_type=idea.CrossSectionType.RECT, material=mat,
                                                  Width=2.0, Height=2.0)

        # Create the reinforced cross section.
        rcs = model.create_reinforced_cross_section(name='rcs', cross_section=cs)

        # Create bars (and stirrups) as desired
        mat_reinf = model.create_matreinforcement_ec2(idea.ReinforcementMaterial.B_400A)

        bar_locations = [(-0.101, -0.175), (0.101, -0.175), (0.101, 0.175), (-0.101, 0.175)]
        bar_diameters = [0.016, 0.016, 0.016, 0.016]

        for coords, diameter in zip(bar_locations, bar_diameters):
            rcs.create_bar(coords, diameter, mat_reinf)

        # Create a CheckMember.
        member = model.create_check_member1d()

        # 'Assign' the CheckMember to a CheckSection with the previously defined reinforced section and add extremes.
        check_section = model.add_check_section(description='S 1', check_member=member, reinf_section=rcs)
        freq = idea.LoadingSLS(idea.ResultOfInternalForces(N=-100000, My=210000))
        fund = idea.LoadingULS(idea.ResultOfInternalForces(N=-99999, My=200000))
        check_section.create_extreme(frequent=freq, fundamental=fund)

        # 'Assign' the necessary additional data to the CheckMember.
        model.add_member_data_ec2(member, idea.MemberType.BEAM_SLAB, idea.TwoWaySlabType.SHELL_AS_PLATE)
        input_xml = model.generate_xml_input()
        # Generate the input XML file.
        idea_analysis = idea.IdeaRcsAnalysis(input_file=input_xml, return_result_xml=True, return_rcs_file=True)
        idea_analysis.execute(timeout=500)
        xml_file = idea_analysis.get_output_file()
        print(xml_file.getvalue().decode(encoding="utf-16"))
        # return DownloadResult(xml_file.getvalue(), f"{params.name}_idea.xml")

        rcs_file = idea_analysis.get_idea_rcs_file(as_file=True)
        return DownloadResult(rcs_file.getvalue_binary(), f"idea.rcs")
1 Like

Can you open the generated input file manually in IDEA?

@bvanderhulst Nope, it says it fails also, but as the common error message for OpenModel is unclear. I usually start with the example code of the documentation and slowly edit the file.
No idea why it isn’t working though as I basicly use the example code.

@bvanderhulst I’ve tried to run Idea using an existing, working, application. However I receive the same error:

image

Regarding the manually input in IDEA how can I import an .xml file? I used the extra’s of the worker before, but with the new version I cannot find this .exe file to check the xml-file for IDEA.

Information:

  • Worker v4.12.0
  • Idea v21.1.3.1420
  • Input xml zie code boven. Voorbeeld uit Viktor SDK

I promised to deliver the IDEA module by this Friday. I will start om some other Issue first. Is there a possiblity to check the OpenModel from the SDK or the corresponding generated xml shown below?

If there is anything I can do to assist, give me a call.

input_idea.xml (8.6 KB)

EDIT: @bvanderhulst after updating to v12.10 of the Viktor SDK the loops goes well. I can download the .rcs file but I cannot open it in IDEA. It returns:
image

Hopefully this additional information helps.

Output
output_idea.xml (53.1 KB)

Corresponding input
input_idea.xml (8.6 KB)

Corresponding .rcs file
idea.rcs (36.3 KB)

What has been changed between the ‘working’ app and the ‘not working’ app, is it the IDEA version? Can you check whether you refer to the correct IDEA version in the worker config file? If this is correct, is it possible for you to install / use an older version of IDEA?

Solution:

  • First of all: I wrote file_name.rcs instead of file_name.ideaRcs which is an old extension of IDEA. That caused the problem of "Data at the root level is invalid. Line 1, position 1.
  • Secondly: The tool I used for checking the validation of the input xml was based on an older version (probably v20), which was present at the older worker (v4.10). This tool wasn’t present at v4.12.0. The tool doesn’t work for newer versions.
  • Lastly: The Failed creating model - error was caused on our server. Reason unknown, could be due to license errors. Versions are equal as local. The error suggests the input.xml is incorrect. Which doesn’t seem to be the problem. The error message is therefor a bit misleading.
1 Like

The tool (IdeaRcsControllerTest.exe) is only available in v10. It is (as far as I know) not possible in >=v20 to directly test/load the open model input file. You’ll need the worker to generate an ideaRcs file to open it manually in IDEA.

To add to that; if you initialize IdeaRcsAnalysis with return_result_xml=False and return_rcs_file=True the worker will only load the input xml and convert it to an .ideaRcs file without performing a calculation