AnsweredAssumed Answered

Can't use COM object for PartLibrary Manager

Question asked by issaccohen1 on Aug 4, 2019



I'm trying to use COM object for PartLibrary Manager, the purpose is to do some automation. I coded the following code in C# but it seems it doesn't work :


Public PartEditor (string partsLibraryPath)


PartsLibraryPath = partsLibraryPath;

Type type = Type.GetTypeFromProgID("MGCPCBLibraries.PartsEditorDlg");

_partsEditorDlg = (IMGCPDBPartsEditorDlg)Activator.CreateInstance(type);

Type licType = Type.GetTypeFromProgID("MGCPCBAutomationLicensing.Application"); MGCPCBAutomationLicensing.Application licServer = (MGCPCBAutomationLicensing.Application)Activator.CreateInstance(licType);

int key = _partsEditorDlg .Validate(0);

int token = licServer.GetToken(key);

_partsEditorDlg .Validate(token);



I of course added the needed dll files but as I mentioned above it doesn't work.

I'd like to get an assistance if possible and if you don't support C# I'd be more than happy to get more examples and explanation how to make this working in different languages (I read the PartLibrary automation dll example in VBScript and I tried to code using the example and this is what I have come with).


P.S, The exception I get while I run this code : "Object reference not set to an instance of an object"


Best regards, Issac.