Hi all,
This is my code. I've edited it to retrieve properties from a single object that I select. Suppose I've selected multiple objects from the Line Number Tag category. All of them have common properties such as status, material, line name, etc. However, I don't know how to retrieve common properties when sweeping objects in the Line Number Tag category.
So, can someone help me edit this code so that I can retrieve common properties of selected objects, not just a single object?
[CommandMethod("GetP")]
public void GetPipingProperties()
{
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
PromptEntityResult res = ed.GetEntity("Pick Object obtain properties : ");
if (res.Status == PromptStatus.OK)
{
PlantProject currentProj = PlantApplication.CurrentProject;
PipingProject pipingProj = (PipingProject)currentProj.ProjectParts["Piping"];
DataLinksManager dlm = pipingProj.DataLinksManager;
int rowId = dlm.FindAcPpRowId(res.ObjectId);
List<KeyValuePair<string, string>> allProperties = dlm.GetAllProperties(rowId, true);
PipingProperties selectedProperties = new PipingProperties();
foreach (var property in allProperties)
{
if (property.Key.Equals("Status", StringComparison.OrdinalIgnoreCase))
{
selectedProperties.Size = property.Value;
}
else if (property.Key.Equals("Material", StringComparison.OrdinalIgnoreCase))
{
selectedProperties.Spec = property.Value;
}
else if (property.Key.Equals("LineNumberTag", StringComparison.OrdinalIgnoreCase))
{
selectedProperties.LineNumberTag = property.Value;
}
}
ed.WriteMessage("\nStatus: " + selectedProperties.Size);
ed.WriteMessage("\nMaterial: " + selectedProperties.Spec);
ed.WriteMessage("\nLineNumberTag: " + selectedProperties.LineNumberTag);
}
}