Merge References

That's all I have done and working, but if I want all the elements to be moved to a new empty blank project, I am an error, that the elements do not exist, how to be?

 private void MergeRefernces(object sender, EventArgs e)
{
            micro = new MicroStationDGN.Application();
           designFile = micro.ActiveDesignFile;
            MicroStationDGN.ElementScanCriteria scan = new MicroStationDGN.ElementScanCriteria();
scan.IncludeOnlyVisible();
MicroStationDGN.ElementEnumerator enumer =micro.ActiveDesignFile.DefaultModelReference.Attachments[1].Scan(scan);
while (enumer.MoveNext())
{
designFile.Models[1].Activate();
MicroStationDGN._Element sourceElem = enumer.Current;
designFile.DefaultModelReference.AddElement(sourceElem);
}
designFile.Views[1].Redraw();
designFile.DefaultModelReference.Attachments.Remove(1);

}


Parents
  • Ostanin said:
    I want all the elements to be moved to a new empty blank project

    What do you mean by 'empty blank project'? 

    You can copy elements into an empty DGN model.  Copy your favourite DGN seed file to the new file name, then open that empty file and run your code.  Application.CreateDesignFile does the work for you.

    designFile = micro.CreateDesignFile ("seed2d.dgn", "Ostanin.dgn", True);

    designFile is now the ActiveDesignFile.

     
    Regards, Jon Summers
    LA Solutions

Reply
  • Ostanin said:
    I want all the elements to be moved to a new empty blank project

    What do you mean by 'empty blank project'? 

    You can copy elements into an empty DGN model.  Copy your favourite DGN seed file to the new file name, then open that empty file and run your code.  Application.CreateDesignFile does the work for you.

    designFile = micro.CreateDesignFile ("seed2d.dgn", "Ostanin.dgn", True);

    designFile is now the ActiveDesignFile.

     
    Regards, Jon Summers
    LA Solutions

Children
No Data