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: 

GET CONTENT OF A SHEET

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
rodrigohbm
939 Views, 5 Replies

GET CONTENT OF A SHEET

 

Hello
How can I get the contents of a sheet by api.

 

I appreciate the information

regards

5 REPLIES 5
Message 2 of 6
matthew_taylor
in reply to: rodrigohbm

Hi @rodrigohbm,

You need to look at ViewSheet.GetAllPlacedViews.

The remarks for this function state:

'Schedules on the sheet are not returned by this method. Use ScheduleSheetInstance.OwnerViewId to find the sheet on which a schedule is placed.'

 

You may also get the contents of a sheet using the filteredelementcollector overload that allows you to specify a view elementId. (This is another way to get the ScheduleSheetInstance/s and hence their ScheduleSheetInstance.ScheduleId.


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
Message 3 of 6
rodrigohbm
in reply to: matthew_taylor

Thank you

I found the following code   But it produces an error

 

I am working revit 2015 and sharpdevelop

 

Sub Button4Click(sender As Object, e As EventArgs)
        
        Dim doc As Document = commandData.Application.ActiveUIDocument.Document
        
    Dim data As String = ""
    For Each v As View In New FilteredElementCollector(doc).OfClass(GetType(View))
        Dim thisSheet As String = ""
        For Each vs As ViewSheet In New FilteredElementCollector(doc).OfClass(GetType(ViewSheet)).Cast(Of ViewSheet)()
            For Each view As View In vs.Views
                If view.Id = v.Id Then
                    thisSheet += vs.Name + " - " + vs.SheetNumber + ", "
                    Exit For
                End If
            Next
        Next
        If thisSheet <> "" Then
            data += v.ViewType + " - " + v.Name + ": " + thisSheet.TrimEnd(" "C, ","C) + Environment.NewLine + Environment.NewLine
        End If
    Next
    TaskDialog.Show("Sheet Report", data)
        
    End Sub

 

Message 4 of 6
matthew_taylor
in reply to: rodrigohbm

Hi @rodrigohbm,

It's helpful to separate your UI/form from the rest of your code. You will then be able to re-use your UI/form for other applications.

This method will also fix what I believe is going on. It looks like a namespace issue. System.Windows.Forms.View is clashing with Autodesk.Revit.DB.View.

If you change the two instances of 'View' that are underlined in red, and a third on line 453, with Autodesk.Revit.DB.View, you should be fine.

 

That all said, I don't believe your code suits your post subject.

What are you actually trying to do? Specifically.


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
Message 5 of 6
rodrigohbm
in reply to: matthew_taylor

I am trying to generate a sheet report

 

The code itself I got it from a web page but this was in C#

 

But when transforming it to vb.net

 

Generate version errors

 

And that's where I'm locked

 

 

Message 6 of 6
matthew_taylor
in reply to: rodrigohbm

Gotcha.
Use a converter like this:
http://converter.telerik.com/
Then, all you need are import statements for
Autodesk.Revit.Db
Autodesk.Revit.ui

Use a vb.Net visual studio template from thebuildingcoder.
http://thebuildingcoder.typepad.com/blog/wizard/
That'll take care of the smaller details like implementing iexternalcommand
There are probably revit 2015 ones around on that link somewhere.
If you haven't read through the first two posts on this forum, they are a must read!!!

Good luck.

Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?

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