Click or drag to resize

IAnalysisModelItemDeleteService

[This is preliminary documentation and is subject to change.]

See IAnalysisModelItemDeleteService for technical documentation

This service is primarily used to delete an item and its related items from an AnalysisModel

This page was last updated 2021-12-03

Examples
Retrieve the service from the container
AnalysisDataModelBootstrapper bootstrapper = new AnalysisDataModelBootstrapper();

using (IScopedServiceProvider scope = bootstrapper.CreateThreadedScope())
{
  IAnalysisModelItemDeleteService service = scope.GetService<IAnalysisModelItemDeleteService>();
}
Delete an object along with its related objects from a model
AnalysisModel model = new AnalysisModel();
AnalysisDataModelBootstrapper bootstrapper = new AnalysisDataModelBootstrapper();

using(IScopedServiceProvider scope = bootstrapper.CreateThreadedScope())
{
  IAnalysisModelItemDeleteService service = scope.GetService<IAnalysisModelItemDeleteService>();

  var beamToDelete = model.OfType<StructuralCurveMember>().FirstOrDefault(x => x.Name == "B23");

  service.CascadingRemoveItemFromModel(model, beamToDelete);
}
Note Note

Use this service with caution, as it might remove objects you were planning on using again at a later stage.

The above example will produce the following result:

  • The beam is removed from the model

  • The cross-section of the beam is removed from the model, if the cross-section is not being used by another object in the model

  • The material of the cross-section of the beam is removed from the model, if the material is not being used by another object in the model

  • The nodes that define the beam are removed from the model, if the nodes are not being used by another object in the model

  • Any object that references the beam that was deleted, will also be deleted from the model.
    e.g. supports and/or hinges, line loads

See Also