Getting material onDocumentChanged

Getting material onDocumentChanged

Anonymous
Not applicable
526 Views
1 Reply
Message 1 of 2

Getting material onDocumentChanged

Anonymous
Not applicable

I am currently using the OnDocumentChanged method to find out when an object in the project has been modified which seems to be working for me so far.

 

I can get the list of modified element ids, and the associated geometry, but I can't figure out how to make the next jump to find what

Material is on this geometry.

 

this is what I'm doing so far:

foreach (var modified in in_e.GetModifiedElementIds())

{

    Autodesk.Revit.DB.Element elem = in_e.GetDocument().GetElement(modified);

 

    Autodesk.Revit.DB.Options opt = new Autodesk.Revit.DB.Options();

    Autodesk.Revit.DB.GeometryElement geomElem = elem.get_Geometry(opt);

}

 

Also, is there an easy way to figure out exactly what was modified about the modified elements?  I don't want to reprocess the geometry or the material if they haven't changed.

 

0 Likes
Accepted solutions (1)
527 Views
1 Reply
Reply (1)
Message 2 of 2

Revitalizer
Advisor
Advisor
Accepted solution

Hi cgnk,

 

if you have the geometry, e.g. Solids, then you could get MaterialElementId from each of their Faces.

 

I would recommend to implement an IUpdater.

You can define its behaviour by setting its ChangeType properly, e.g. Element.GetChangeTypeGeometry, Element.GetChangeTypeParameter etc.

You also can combine these ChangeTypes to omit unnecessary change notifications.

 

 

Best regards,

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine