1

Ia loading multiple step files into the model, but they are not visible. However when loading the step files one by one, they are visible. What is the problem...

protected override void OnLoad(EventArgs e)
{
    List<ReadSTEP> stp_list = new List<ReadSTEP>();

    string Path = @"----directory----";
    System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(Path);

    foreach (var item in di.GetFiles())
    {
        stp_list.Add(new ReadSTEP(item.Name));                
    }

    for (int i = 0; i < stp_list.Count; i++)
    {                
        if (true)
        {
            stp_list[i].DoWork();
            stp_list[i].AddToScene(model1);
            Trace.WriteLine(stp_list[i].FileName + " is loaded");
        }
    }  

    model1.Invalidate();
    model1.ZoomFit();
}
openshac
  • 4,966
  • 5
  • 46
  • 77
이인석
  • 11
  • 1
  • I tried your code and it works fine after replacing item.Name with item.FullName, in this way: stp_list.Add(new ReadSTEP(item.FullName)). – ilCosmico May 14 '21 at 07:21

1 Answers1

1

Step files can contain Blocks with the same name, so you can try in this way: https://devdept.zendesk.com/hc/en-us/articles/360017314360-Add-to-scene-as-single-object

ilCosmico
  • 1,319
  • 15
  • 26