When I add following line:
IBOMProperties properties = bomLevel1.Properties;
to my code it works only once, 2-nd run crash at line getting TopApp.
Is this a bug in API, or I do something wrong?
C# code:
Code: Select all
using System;
using System.Collections.Generic;
using System.Text;
using TopSolid;
namespace TestTopSolidBOM
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Start");
TopSolid.Application TopApp = new TopSolid.Application();
Console.WriteLine("TopSolid.Application");
IDocument doc = TopApp.Documents.Load(@"C:\Projects\Samples\NewStepperLuxe\StepperLuxe.top", false, true, true);
Console.WriteLine("TopSolid.IDocument");
IDocumentDesign docDes = (IDocumentDesign)doc;
IElement TopElt = (IElement)docDes.Assembly;
BOM TopBom = doc.GetBOM(TopElt,@"C:\Missler\V68\bin\IdxDesRefMatCom.bom", true);
IBOMLevels subl = TopBom.SubLevels;
BOMLevel bomLevel1 = subl[1];
//When I start program, first time all works fine, but
/* Uncommenting next lines cause crash of this program,
when I start it for 2-nd time, at line getting TopSolid.Application.
after restart of TopSolid it runs again - only first time*/
//IBOMProperties properties = bomLevel1.Properties;
//IBOMProperty pr1 = properties[2];
//Console.WriteLine(pr1.Value);
Console.WriteLine("Press any key to continue...");
Console.ReadKey();
}
}
}
Code: Select all
Start
TopSolid.Application
TopSolid.IDocument
Biellette
Press any key to continue...
Code: Select all
Start
Retrieving the COM class factory for component with CLSID {96DAB3E1-B2C2-4F2A-A175-91AA0275A714} failed due to the following error: 80010108.