⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 用于实现ptx文件电云模型的转换
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form1 
   AutoRedraw      =   -1  'True
   Caption         =   "Form1"
   ClientHeight    =   2205
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   7065
   LinkTopic       =   "Form1"
   ScaleHeight     =   147
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   471
   StartUpPosition =   3  'Windows Default
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   5760
      TabIndex        =   7
      Text            =   "1.5"
      Top             =   360
      Width           =   855
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Exit"
      Height          =   375
      Left            =   4080
      TabIndex        =   6
      Top             =   360
      Width           =   855
   End
   Begin MSComDlg.CommonDialog Dlg1 
      Left            =   120
      Top             =   2640
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Open"
      Height          =   375
      Left            =   3120
      TabIndex        =   1
      Top             =   360
      Width           =   855
   End
   Begin MSComctlLib.ProgressBar ProgressBar1 
      Height          =   255
      Left            =   120
      TabIndex        =   0
      Top             =   1440
      Width           =   6615
      _ExtentX        =   11668
      _ExtentY        =   450
      _Version        =   393216
      Appearance      =   1
   End
   Begin VB.Label Label6 
      Caption         =   "Point cloud"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   495
      Left            =   240
      TabIndex        =   9
      Top             =   960
      Width           =   5655
   End
   Begin VB.Label Label5 
      Caption         =   "Factor:"
      ForeColor       =   &H000000C0&
      Height          =   495
      Left            =   5160
      TabIndex        =   8
      Top             =   360
      Width           =   975
   End
   Begin VB.Label Label4 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      Left            =   1920
      TabIndex        =   5
      Top             =   2640
      Width           =   1215
   End
   Begin VB.Label Label3 
      Appearance      =   0  'Flat
      BackColor       =   &H000000FF&
      ForeColor       =   &H00C0E0FF&
      Height          =   375
      Left            =   240
      TabIndex        =   4
      Top             =   2640
      Width           =   855
   End
   Begin VB.Label Label2 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H80000008&
      Height          =   375
      Left            =   240
      TabIndex        =   3
      Top             =   2640
      Width           =   4215
   End
   Begin VB.Label Label1 
      Caption         =   "Ptx灰度增强程序"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   375
      Left            =   240
      TabIndex        =   2
      Top             =   360
      Width           =   3015
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim GFactor As Single

Private Sub Command1_Click()
  Dim s As String, s1 As String, i As Long, j As Long, k As Long, N As Integer
  Dim x As Single, y As Single, z As Single, gray As Single, percent As Single
  Dim Sx As Single, Sy As Single, Sz As Single, Js As Integer, Js1 As Integer
  Dim row As Long, col As Long
   Label3.Width = 0.1
   GFactor = Val(Trim(Text1))
   If GFactor <= 0 Then MsgBox ("Wrong Factor!!!"): Exit Sub
   
   k = 0
   Label4.Caption = ""
   Dlg1.Filter = "Ptx文件( *.Ptx) |*.ptx"
   Dlg1.ShowOpen
   
   s = Dlg1.FileName
   If s = "" Then MsgBox (" please choose a Ptx file!"):  Exit Sub
      
      Dlg1.ShowSave
     s1 = Dlg1.FileName
     If s = s1 Then MsgBox ("Please Change a FileName!"): Exit Sub
   Open s For Input As #1
      Open s1 For Output As #2
      Js1 = 0
  Do While Not EOF(1)
    Js1 = Js1 + 1
      Input #1, row: Print #2, row
      Input #1, col: Print #2, col
     Label6.Caption = "Operating " & row & " X " & col & " Cloud!"
  ProgressBar1.Max = row * col
   ProgressBar1.Value = 0
     For i = 1 To 8
        Line Input #1, s
        Print #2, s
     Next i
    
    ProgressBar1.Visible = True
 Line Input #1, s
  Js = 0: N = 1
  Do
    N = InStr(N + 1, s, " ")
    If N > 0 Then
       Js = Js + 1
    Else
       Exit Do
    End If
 Loop
  k = 0
If Js > 3 Then
    For i = 1 To row * col - 1
       k = k + 1
       Input #1, x, y, z, gray, Sx, Sy, Sz
       Print #2, x & Space(1) & y & Space(1) & z & Space(1) & Format(2 * gray, "0.00######") & Space(1) & Sx & Space(1) & Sy & Space(1) & Sz
      ProgressBar1.Value = k
       DoEvents

  Next i
  
Else
  For i = 1 To row * col - 1
       k = k + 1
       Input #1, x, y, z, gray
       Print #2, x & Space(1) & y & Space(1) & z & Space(1) & Format(2 * gray, "0.00######")
       
      ProgressBar1.Value = k
       DoEvents

  Next i
  
End If
  
    Loop
  Close #1
Close #2
    
    ProgressBar1.Visible = False
    Label6.Caption = "Operating " & Js1 & " blocks of PointClouds in Total!"
     MsgBox ("转换完毕!")
    
End Sub



Private Sub Command2_Click()
  
 End
End Sub

Private Sub Form_Load()

  ProgressBar1.Visible = False
  Label3.Width = 0.1
  DrawBar Me, 120
  
End Sub


Sub DrawBar(dstForm As Form, yPos As Single)
    
    For i = yPos To yPos + 22 Step 2
        dstForm.Line (0, i)-(dstForm.ScaleWidth, i), vb3DHighlight
        dstForm.Line (0, i + 1)-(dstForm.ScaleWidth, i + 1), vb3DShadow
    Next i
    
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -