CUI managed API - Cannot open cuix file from standalone .NET app

CUI managed API - Cannot open cuix file from standalone .NET app

Anonymous
Not applicable
969 Views
4 Replies
Message 1 of 5

CUI managed API - Cannot open cuix file from standalone .NET app

Anonymous
Not applicable

I've read in documentation that CUI managed API is possible to access and edit .cuix file from standalone .net application.

Following instructions from documentation (https://help.autodesk.com/view/OARX/2021/ENU/?guid=GUID-577EDC34-0A10-4D63-BED4-ECA4570355A3), I attempted to do some very simple thing: just to load .cuix file, and write number of Workspaces.

Here is the very simple method:

 

 

CustomizationSection customizationSection = new CustomizationSection("[path to .cuix file on disk]");
Console.WriteLine(customizationSection.Workspaces.Count);

 

 

Details of my app:

- It is very simple 64 bit console app in .NET 4.8.

- Added references to AcCui.dll, as noted in documentation.

 

If I set property for assembly "local copy" to "False", as instructed, then will get an error:

 

System.IO.FileNotFoundException: Could not load file or assembly 'AcCui, Version=24.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

 

If I set property for assembly "local copy" to "True",  then will get an error:

 

System.InvalidProgramException: Common Language Runtime detected an invalid program.

 

Can you, please, help me and tell me what I did wrong here? Are documentation wrong, or incomplete, or i miss something important to perform such a simple operation?

 

Thanks.

 

0 Likes
Accepted solutions (1)
970 Views
4 Replies
Replies (4)
Message 2 of 5

Alexander.Rivilis
Mentor
Mentor
Accepted solution

Try to put your exe-file in directory with acad.exe

I haven't tested it for a long time, but about ten years ago, accui.dll could be used that way. In recent versions, accui.dll depends on acdbmgd.dll. So not sure what will work.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes
Message 3 of 5

Anonymous
Not applicable

Thanks, Alexander,

 

If I copy my application exe file in the same folder where acad.exe is, then it will work (at least, can read CUIX file, will now attempt to manipulate - to create some UI elements).

However, that doesn't sound as right way to use it, but will do the job.

If there is no other way, then it would be good to mention this in documentation of Managed .NET Developer's guide.

 

Cheers!

0 Likes
Message 4 of 5

Alexander.Rivilis
Mentor
Mentor

https://adndevblog.typepad.com/autocad/2012/07/using-accuidll-cui-api-outside-autocad.html

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes
Message 5 of 5

dgorsman
Consultant
Consultant

CUIx files are a ZIP of several other files, including a CUI file, which is XML.  You're responsible for handling the "dirty work" in that case, but it's a lot more straight forward - especially if  you're just reading content like workspace names.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes