Message 1 of 3
Browse a point cloud
Not applicable
04-07-2015
08:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I would like to browse a point cloud in order to retrieve coordinates of each points.
'Déclaration de l'éxécute
Dim nuage As PointCloudType
Dim nuageinst As PointCloudInstance
'Dim nuagecollect As PointCollection
nuage = PointCloudType.Create(doc, "rcs", "C:\nuage.rcs")
nuageinst = PointCloudInstance.Create(doc, nuage.Id, Transform.Identity)
t.Commit()
Dim boundingBox As BoundingBoxXYZ = nuageinst.BoundingBox(Nothing)
Dim planes As New List(Of Plane)()
Dim midpoint As XYZ = (boundingBox.Min + boundingBox.Max) / 2.0
' X boundaries
planes.Add(uidoc.Application.Application.Create.NewPlane(XYZ.BasisX, boundingBox.Min))
planes.Add(uidoc.Application.Application.Create.NewPlane(-XYZ.BasisX, midpoint))
' Y boundaries
planes.Add(uidoc.Application.Application.Create.NewPlane(XYZ.BasisY, boundingBox.Min))
planes.Add(uidoc.Application.Application.Create.NewPlane(-XYZ.BasisY, midpoint))
' Z boundaries
planes.Add(uidoc.Application.Application.Create.NewPlane(XYZ.BasisZ, boundingBox.Min))
planes.Add(uidoc.Application.Application.Create.NewPlane(-XYZ.BasisZ, midpoint))
' Create filter
Dim filter As PointCloudFilter = PointCloudFilterFactory.CreateMultiPlaneFilter(planes)
Dim tr As New Transaction(doc)
tr.Start("Balayage")
Using fichier As New StreamWriter("C:\points.txt", False)
' read points by iteration
Dim averageDistance As Double = 0.0001
Dim points As PointCollection = nuageinst.GetPoints(filter, averageDistance, 100000)
' Get points. Number of points is determined by the needs of the client
For Each point As CloudPoint In points
' Process each point
Dim color As System.Drawing.Color = System.Drawing.ColorTranslator.FromWin32(point.Color)
Dim pointDescription As [String] = [String].Format("({0}, {1}, {2}, {3}", point.X, point.Y, point.Z, color.ToString())
MsgBox(pointDescription)
Next
fichier.WriteLine(points.Count.ToString)
fichier.Close()
End Using
tr.Commit()The file "points.txt " shows 0 and i don't undestand why.
Thanks,