Initial API call fails

All topics about specific development with COM interface, LIP language, API in VB, ...

Moderators: remi77, jacs, Daniel

bellmik
Private
Private
Posts: 3
Joined: Thu Aug 29, 2019 2:07 pm
TopSolid Module: TopSolid'Design
TopSolid Version: 6.18

Initial API call fails

Unread post by bellmik »

Hi TopSolid,

First real post here.

I am using the API to programatically create a consistently formatted .top file that matches our sales order. Our engineers will then use this .top file to add their materials and draw from.

Not having a great start as the code is failing after on my initial API call.

My code is below. The initial popup I get after a few seconds is:

Standalone licenses

Cannot locate protection key.
Check the key connection and driver installation.

Software will run in demonstration mode.

I am using a shared license, and I can load and run TopSolid from my desktop without issues. Do I need a standalone license to use the API?

After a few more seconds I get the error message located at the bottom of this message.

Here is my code (written in C#, I can provide the VB.NET equivalent if need be.)

private TopSolid.Application TopApp;
.
.
.
TopApp = new TopSolid.Application();
ITopDocument topDocument = TopApp.Documents.Add("Test");
ITopDocument doc = topDocument;
doc.SaveAs("S:\\Orderstream\\Test.top");

It errors out on the line:

TopApp = new TopSolid.Application();

with the message

System.Runtime.InteropServices.COMException
HResult=0x80080005
Message=Retrieving the COM class factory for component with CLSID {96DAB3E1-B2C2-4F2A-A175-91AA0275A714} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
Source=mscorlib
StackTrace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at WindowsFormsApp1.Form1.Button2_Click(Object sender, EventArgs e) in C:\Users\Michael.Bell\source\repos\WindowsFormsApp1\WindowsFormsApp1\Form1.cs:line 63
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at WindowsFormsApp1.Program.Main() in C:\Users\Michael.Bell\source\repos\WindowsFormsApp1\WindowsFormsApp1\Program.cs:line 19

Thanks,

Mike
Last edited by bellmik on Thu Sep 19, 2019 10:44 pm, edited 1 time in total.
bellmik
Private
Private
Posts: 3
Joined: Thu Aug 29, 2019 2:07 pm
TopSolid Module: TopSolid'Design
TopSolid Version: 6.18

Re: Initial API call fails

Unread post by bellmik »

Well after a month of frustration, I finally found out what to do. There is a top.cod file that must contain the module parameters that you need to use up a license for.

It should mirror the parameters that are part of your desktop shortcut.

In our case it was:

PolePpsA/35/6.18
Missler/228/6.18
Missler/227/6.18
Missler/84/6.18
Missler/18/6.18
Missler/9/6.18
Post Reply