Message 1 of 21
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
In a revit drawing, I need to be able to find the full path of the point cloud files (all of them, rcp AND rcs
The following bit of code (VB.NET) allows me to get the cloud instances and the file names but NOt the file path:
Public Function Execute(
ByVal commandData As ExternalCommandData,
ByRef message As String,
ByVal elements As ElementSet) _
As Result Implements IExternalCommand.Execute
Dim uiapp As UIApplication = commandData.Application
Dim uidoc As UIDocument = uiapp.ActiveUIDocument
Dim doc As Document = uidoc.Document
Using file As New StreamWriter("c:\temp\result.txt", False)
Dim clouds As FilteredElementCollector = New FilteredElementCollector(doc).OfClass(GetType(PointCloudInstance))
For Each cloud As PointCloudInstance In clouds
file.WriteLine("Found instance: " & cloud.Id.IntegerValue)
file.WriteLine(vbTab & "Name= " & cloud.Name) ' Seems to contain the filename of the rcp/rcs attached
Dim files As IList(Of String) = cloud.GetScans() ' if the point cloud is a rcp, then it contains the list of rcs, otherwise, it contains the rcs
file.WriteLine(vbTab & "Files:")
For Each filename As String In files
file.WriteLine(vbTab & vbTab & filename)
Next
file.WriteLine(vbCrLf & vbCrLf)
Next
End Using
Process.Start("c:\temp\result.txt")
Return Result.Succeeded
End Function
The result is:
Found instance: 2304 Name= pumpNoInvalidPoints.rcp Files: pumpNoInvalidPoints_1 pumpNoInvalidPoints_2 pumpNoInvalidPoints_3 pumpNoInvalidPoints_4 pumpNoInvalidPoints_5 Found instance: 2312 Name= tester.rcs Files: tester
Any idea ?
Solved! Go to Solution.