What's new

Why won't GUI less initialize?

I'm doing this in VB, like the example in Getting Started of AlibreAPIHelp.chm:

Dim hook As IAutomationHook hook = New AlibreX.AutomationHook Call hook.Initialize("", "", "", True, 0)

But it throws an exception:

System.Runtime.InteropServices.COMException
"The type initializer for 'com.alibre.design.app.AtomDesignProfilePrototype' threw an exception."
ErrorCode -2147418113


What's wrong? This is after running registerCOMdlls.bat as administrator. It works fine in GUI mode initializing with

hook = Marshal.GetActiveObject("AlibreX.AutomationHook")
 
Yes, I ran Alibre Atom 27 as administrator, then ran registerCOMdlls.BAT also as administrator. I just did those two steps again and it still doesn't work. I've never installed any other version of Alibre Design. I also removed all the /s and > bits from the .BAT file and ran it again and it said that each command was successful, just a warning about the last one not being signed.

That exception happened when I called rootObj.OpenFile(partFileName) which works OK in GUI mode. If I don't do anything with it and just release the hook, it throws:

System.ArgumentException
The object's type must be __ComObject or derived from __ComObject.
Parameter name: o
HResult -2147024809
 

stepalibre

Alibre Super User
Headless mode requires registered AlibreX COM dlls to work properly. You can simulate headless mode in your program by hiding the GUI.
 

stepalibre

Alibre Super User
You should get an answer about Atom3D and API access. I don't know if it's officially supported.
 

stepalibre

Alibre Super User
I was curious so I installed Atom3D. Headless mode worked first attempt. I would still get confirmation regarding whether Atom3D API access is supported. I'm not an Atom3D user and am unsure if there are any limitations via the API.
1704299845136.png
- Windows 11 VM
- Alibre Atom3D v27.0.1 - 27039

I created a new .Net framework console application, changed the target CPU to x64 and referenced C:\Program Files\Alibre Atom3D 27.0.1.27039\Program\AlibreX.dll. I didn't do anything else.
 

stepalibre

Alibre Super User
I ran a simple script and it didn't work. I didn't dig deeper, but from what I can tell API dev isn't supported.
Maybe someone with knowledge will chime in.

[ edit ]
GUI code does appear to work, headless code does not.
 
Last edited:
I've solved this problem and it now works in both Atom3D and Design Pro.

The thread in my application had its culture set to the invariant culture. You have to set it to one with with a region (eg. "en-US" but not "en").
I hadn't noticed before but there was an exception thrown and caught in Alibre which explained this:

Code:
An exception of type System.ArgumentException  was caught.
Reason: There is no region associated with the Invariant Culture (Culture ID: 0x7F).
 

stepalibre

Alibre Super User
I've solved this problem and it now works in both Atom3D and Design Pro.

The thread in my application had its culture set to the invariant culture. You have to set it to one with with a region (eg. "en-US" but not "en").
I hadn't noticed before but there was an exception thrown and caught in Alibre which explained this:

Code:
An exception of type System.ArgumentException  was caught.
Reason: There is no region associated with the Invariant Culture (Culture ID: 0x7F).
I wonder now if headless mode code doesn't work in VMs since my script didn't work. I don't use it for development so maybe I need to change a setting, the region, or set the time zone. Thanks for the update. The VM is Win11.

I recall:
It initializes but calling a method failed. I may have called a method that's not available in Atom3D.
 
Last edited:
Are you able to see a caught exception like I did? In your case, it might be something completely different. I don't think you can set "no region" in Windows so there should be something there by default unless you explicitly set your program to no region like I had been doing.
 

stepalibre

Alibre Super User
Yes I meant the time zone or a setting in the VM. It's for testing Windows 11 and there's only 10GB free. I don't really use it for work.
Are you able to see a caught exception like I did?
No, I copied a script made for Expert without thinking about the methods or properties called in the script.

Side note:
I assumed Atom3D wouldn't have access to certain methods in the API if the support is missing.
1705890180244.png
Example:
1705889892670.png
Atom3D doesn't support IGES export so I would assume that the method ExportIGES would fail under Atom3D. It's possible the dlls/code are included with Atom3D and Alibre don't restrict API calls to them. Can you export IGES or Parasolid with Atom3D? Do you have Pro and Atom3D installed on the same machine? What version of Pro? AlibreX is registered so it wouldn't matter depending on setup.

If there's no difference between Atom3D, Pro and Expert installations then it's likely the full API is available to all. Atom3D's Export feature (using the GUI) omits IGES and Parasolid, but they're accessible from the API?

I searched for atom3d api and found this:
and this:

I uninstalled Atom3D to try Alibre Expert in the VM to test performance. I'll buy and reinstall Atom3D when I'm done.

Another thought is that IGES and Parasolid require a translator of some kind to work. If the code dlls/code used for exporting are included and Alibre does not restrict API calls to them (when only Atom3D is installed) then you would have full API access with Atom3D. Any missing dlls/code would fail when called.

This is my limited understanding of how things work.
 
Top