Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello
How can I get the contents of a sheet by api.
I appreciate the information
regards
Solved! Go to Solution.
Hello
How can I get the contents of a sheet by api.
I appreciate the information
regards
Solved! Go to Solution.
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.
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
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.
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