idea-statica / iom-examples

Examples of using IDEA StatiCa IOM API
MIT License
8 stars 4 forks source link

[QUESTION] Minimal IOM create/import example #44

Closed MohamedMoussaTTW closed 3 years ago

MohamedMoussaTTW commented 4 years ago

What is the minimal amount of code required to create an empty IOM file and convert it to a project?

I assume the following is not sufficient, as I'm getting a confusing exception that does not point to the problem.

class Program
{
    static void Main(string[] args)
    {
        var ideaStaticaDir = @"C:\Program Files\IDEA StatiCa\StatiCa 20.0\";

        var model = new OpenModel();
        var result = new OpenModelResult();

        var modelXml = @"C:\TEMP\example.xml";
        var resultsXml = @"C:\TEMP\example.xmlR";
        var modelPrj = @"C:\TEMP\example.ideaCon";

        model.SaveToXmlFile(modelXml);
        result.SaveToXmlFile(resultsXml);

        var calcFactory = new ConnHiddenClientFactory(ideaStaticaDir);
        var client = calcFactory.Create();
        client.CreateConProjFromIOM(modelXml, resultsXml, modelPrj);
        client.OpenProject(@"C:\TEMP\example.ideaCon");
    }
}

The exception I get is the following. I would like to understand what this means, and how can I get more information of the actual error.

System.ServiceModel.FaultException: The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.

mpospisil commented 4 years ago

which method from your thows the exception ?

MohamedMoussaTTW commented 4 years ago

which method from your thows the exception ?

Open project does, the line client.OpenProject(@"C:\TEMP\example.ideaCon");

mpospisil commented 4 years ago

send me your IOM file and generated ideaCon

MohamedMoussaTTW commented 4 years ago

I'm sorry, I gave you the wrong information. It's actually the CreateConProjFromIOM call that fails.

This XML file will fail to convert in your sample "Hidden Calculation" application when I try to import it. I get the same 'server unable to process request due to internal error' exception.

https://gist.github.com/MohamedMoussaTTW/617f73e40ce580fe18b6e97441b50659

Note that if I change CountryCode from AUS to ECEN, it will import.

paolobia commented 3 years ago

Hi, I have the same problem calling CreateConProjFromIOM How to solve ?

mpospisil commented 3 years ago

Hi Mohamed,

threrea are several issues - the firs issue is your XML file is not UNICODE and it keeps crashing when we try to open it on oure side.

The second issue is that the design esign code for Australia is not AUS but Australia

But I have also found the bug in our code - Australian code can not be imported - there is cash. It will be in the next patch (IS v20.1.2) - probably the next month. If you want I can send you unofficial setup for your testing - let me know.

I have added a new example how to create IOM for australian design code

you can find it here https://github.com/idea-statica/iom-examples/blob/master/IOM_SteelFrame1/IOM.GeneratorExample/SimpleFrameAUS.cs

(but it will crash with the current version)

mpospisil commented 3 years ago

it was fixed in IDEA STATICA 20.1.4367.1 see https://www.ideastatica.com/product-downloads you will also need to update our nuget packages in you application (same as it in our updated examples )