Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Reading STL binary files
- Dim pointsstring() As Byte
- Dim filelocation() As String = OpenFileDialog1.FileNames
- For i2 = 0 To filelocation.Length - 1
- If System.IO.File.Exists(filelocation(i2)) = True Then
- GC.Collect()
- pointsstring = System.IO.File.ReadAllBytes(filelocation(i2))
- GC.Collect()
- normals(objectcount) = New List(Of Vector3)
- points(objectcount) = New List(Of Vector3)
- Dim pointcount As UInt32 = BitConverter.ToUInt32(pointsstring, 80)
- Dim NX, NY, NZ, X1, X2, X3, Y1, Y2, Y3, Z1, Z2, Z3 As Single
- For i = 84 To pointsstring.Length - 1 Step 50
- NX = BitConverter.ToSingle(pointsstring, i + 0)
- NY = BitConverter.ToSingle(pointsstring, i + 4)
- NZ = BitConverter.ToSingle(pointsstring, i + 8)
- normals(objectcount).Add(New Vector3(NX, NY, NZ))
- X1 = BitConverter.ToSingle(pointsstring, i + 12)
- Y1 = BitConverter.ToSingle(pointsstring, i + 16)
- Z1 = BitConverter.ToSingle(pointsstring, i + 20)
- points(objectcount).Add(New Vector3(X1, Y1, Z1))
- X2 = BitConverter.ToSingle(pointsstring, i + 24)
- Y2 = BitConverter.ToSingle(pointsstring, i + 28)
- Z2 = BitConverter.ToSingle(pointsstring, i + 32)
- points(objectcount).Add(New Vector3(X2, Y2, Z2))
- X3 = BitConverter.ToSingle(pointsstring, i + 36)
- Y3 = BitConverter.ToSingle(pointsstring, i + 40)
- Z3 = BitConverter.ToSingle(pointsstring, i + 44)
- points(objectcount).Add(New Vector3(X3, Y3, Z3))
- Next
- objectcount = objectcount + 1
- End If
- Next
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement