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: 

Can't find all instances of Revision notes in my project

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
479 Views, 4 Replies

Can't find all instances of Revision notes in my project

Our Sheets use instances of "Manual_Revision" annotation symbols to document revision date, notes etc.

 

RevisionNotes.JPG

 

This code extract returns some, but not all, of these revisions.

 

Does anybody have any idea why I'm not picking them all up?

 

    Public Shared Function GetRevisions(doc As Document, frm As frmSheets) As String
        ' Creates a FamilyInstance filter for elements that are family instances of the given family symbol in the document

        ' Find all family symbols whose name is "Manual_Revision"
        Dim collector As New FilteredElementCollector(doc)
        collector = collector.OfClass(GetType(FamilySymbol))

        ' Get Element Id for family symbol which will be used to find family instances
        Dim query = From element In collector Where element.Name = "Manual_Revision"
        Dim famSyms As List(Of Element) = query.ToList() '(Of Element)()
        Dim symbolId As ElementId = famSyms(0).Id

        ' Create a FamilyInstance filter with the FamilySymbol Id
        Dim filter As New FamilyInstanceFilter(doc, symbolId)

        ' Apply the filter to the elements in the active document
        collector = New FilteredElementCollector(doc)
        Dim familyInstances As ICollection(Of Element) = collector.WherePasses(filter).ToElements()

        ' Prompt typical revision 
        ParseRevisions(frm, familyInstances(0), True)

        For Each ele As Element In familyInstances
            ParseRevisions(frm, ele, False)
        Next
        Return "Found " & familyInstances.Count & " Revisions in Project"
    End Function

 

4 REPLIES 4
Message 2 of 5
augusto.goncalves
in reply to: Anonymous

The famSyms list alaways has only 1 element? Or do you have a .rtv with this? Which Revit version are you using?

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
Message 3 of 5
Anonymous
in reply to: augusto.goncalves

My code finds 173 revision notes and I write them to a database but when I check them I can see that there are many missing.

I can provide the .rvt file if you would like to look at it. I'm an experienced AutoCAD and .net Programmer but I'm a total newbie to Revit and haven't really got my head round the object model and structure.

Steve
CZWG Architects
Message 4 of 5
peterjegan
in reply to: Anonymous

I agree with Augusto, it looks like you only do one type. I suggest

 

Public Shared Function GetRevisions(doc As Document, frm As frmSheets) As String
        ' Creates a FamilyInstance filter for elements that are family instances of the given family symbol in the document

        ' Find all family symbols whose name is "Manual_Revision"
        Dim collector As New FilteredElementCollector(doc)
        collector = collector.OfClass(GetType(FamilySymbol))

        ' Get Element Id for family symbol which will be used to find family instances
        Dim query = From element In collector Where element.Name = "Manual_Revision"
        Dim famSyms As List(Of Element) = query.ToList() '(Of Element)()
        
	foreach symbolId As ELementId in famSyms
	'Dim symbolId As ElementId = famSyms(0).Id

        ' Create a FamilyInstance filter with the FamilySymbol Id
        Dim filter As New FamilyInstanceFilter(doc, symbolId)

        ' Apply the filter to the elements in the active document
        collector = New FilteredElementCollector(doc)
        Dim familyInstances As ICollection(Of Element) = collector.WherePasses(filter).ToElements()

        ' Prompt typical revision 
        ParseRevisions(frm, familyInstances(0), True)

        For Each ele As Element In familyInstances
            ParseRevisions(frm, ele, False)
        Next
	Next
        Return "Found " & familyInstances.Count & " Revisions in Project"
    End Function

 

Message 5 of 5
Anonymous
in reply to: peterjegan

Thanks for the suggestion. I simplified my code and inserted a loop over my filtered list of famsyms with name "Manual_Revision" as shown.

 

    Public Shared Function GetRevisions(doc As Document) As String
	    Dim iRevisions As Integer = 0
	    ' Creates a FamilyInstance filter for elements that are 
	    'family instances of the given family symbol in the document
	    Dim faminsts As ICollection(Of Element)
	
	    ' Find all family symbols whose name is "Manual_Revision"
	    Dim collector As New FilteredElementCollector(doc)
	    collector = collector.OfClass(GetType(FamilySymbol))
	
	    ' Get Element Id for family symbol which will be used to find family instances
	    Dim query = From element In collector Where element.Name = "Manual_Revision"
	    Dim famSyms As List(Of Element) = query.ToList() '(Of Element)()
	
	    'famsyms.count is 1 so the For each symbol loop is only passed once
	    Debug.Print("Found " & famSyms.Count & " family symbols where element.Name = 'Manual_Revision'")
	    For Each symbol As Element In famSyms
	
	        ' Create a FamilyInstance filter with the FamilySymbol Id
	        Dim filter As New FamilyInstanceFilter(doc, symbol.Id)
	
	        ' Apply the filter to the elements in the active document
	        collector = New FilteredElementCollector(doc)
	        faminsts = collector.WherePasses(filter).ToElements()
	
	        For Each ele As Element In faminsts
	            'ParseRevisions(frm, ele, False)
	            iRevisions += 1
	        Next
	    Next
	    Return "Found " & iRevisions & " instances of FamilySymbol Manual_revision"
	    
	End Function    

 

This made no difference as there was only one match:

 

 

Found 1 family symbols where element.Name = 'Manual_Revision'
Found 173 instances of FamilySymbol Manual_revision

 

The 172 instances I found only included, for instance about 3 of the notes on this sheet snip. There was no revision with [Revision No] parameter value "C05" found in the entire project.

 

5RevisionNotes.JPG

 

I'm missing something pretty obvious in my parsing of the Revit project!

 

Your assistance is appreciated!

 

Steve

CZWG Architects LLP

LONDON

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