Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Getting material onDocumentChanged

1 REPLY 1
SOLVED
Reply
Message 1 of 2
cgnk
418 Views, 1 Reply

Getting material onDocumentChanged

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.

 

1 REPLY 1
Message 2 of 2
Revitalizer
in reply to: cgnk

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





Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community