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")