Imports Microsoft.VisualBasic
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
'Add any initialization after the InitializeComponent() call
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents groupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents groupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents groupBox3 As System.Windows.Forms.GroupBox
Friend WithEvents groupBox4 As System.Windows.Forms.GroupBox
Friend WithEvents groupBox5 As System.Windows.Forms.GroupBox
Friend WithEvents radioButton1 As System.Windows.Forms.radioButton
Friend WithEvents radioButton2 As System.Windows.Forms.radioButton
Friend WithEvents radioButton3 As System.Windows.Forms.radioButton
Friend WithEvents radioBtnNX8 As System.Windows.Forms.radioButton
Friend WithEvents radioBtnNX85 As System.Windows.Forms.radioButton
Friend WithEvents cbox1 As System.Windows.Forms.checkbox
Friend WithEvents cbox2 As System.Windows.Forms.checkbox
Friend WithEvents cbox3 As System.Windows.Forms.checkbox
Friend WithEvents cbox4 As System.Windows.Forms.checkbox
Friend WithEvents cbox5 As System.Windows.Forms.checkbox
Friend WithEvents cbox6 As System.Windows.Forms.checkbox
Friend WithEvents cbox7 As System.Windows.Forms.checkbox
Friend WithEvents cbox8 As System.Windows.Forms.checkbox
Friend WithEvents cbox9 As System.Windows.Forms.checkbox
Friend WithEvents cbox10 As System.Windows.Forms.checkbox
Friend WithEvents lbox As System.Windows.Forms.listbox
Friend WithEvents lbox2 As System.Windows.Forms.listbox
Friend WithEvents label1 As System.Windows.Forms.label
Friend WithEvents label2 As System.Windows.Forms.label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.groupBox1 = New System.Windows.Forms.GroupBox()
Me.groupBox2 = New System.Windows.Forms.GroupBox()
Me.groupBox3 = New System.Windows.Forms.GroupBox()
Me.groupBox4 = New System.Windows.Forms.GroupBox()
Me.groupBox5 = New System.Windows.Forms.GroupBox()
Me.radioButton2 = New System.Windows.Forms.RadioButton()
Me.radioButton1 = New System.Windows.Forms.RadioButton()
Me.radioButton3 = New System.Windows.Forms.RadioButton()
Me.radioBtnNX85 = New System.Windows.Forms.RadioButton()
Me.radioBtnNX8 = New System.Windows.Forms.RadioButton()
Me.cbox1 = New System.Windows.Forms.CheckBox()
Me.cbox2 = New System.Windows.Forms.CheckBox()
Me.cbox3 = New System.Windows.Forms.CheckBox()
Me.cbox4 = New System.Windows.Forms.CheckBox()
Me.cbox5 = New System.Windows.Forms.CheckBox()
Me.cbox6 = New System.Windows.Forms.CheckBox()
Me.cbox7 = New System.Windows.Forms.CheckBox()
Me.cbox8 = New System.Windows.Forms.CheckBox()
Me.cbox9 = New System.Windows.Forms.CheckBox()
Me.cbox10 = New System.Windows.Forms.CheckBox()
Me.Button1 = New System.Windows.Forms.Button()
Me.Button2 = New System.Windows.Forms.Button()
Me.Button3 = New System.Windows.Forms.Button()
Me.lbox = New System.Windows.Forms.Listbox()
Me.lbox2 = New System.Windows.Forms.Listbox()
Me.label1 = New System.Windows.Forms.Label()
Me.label2 = New System.Windows.Forms.Label()
groupBox1.Controls.Add(Me.radioButton2)
groupBox1.Controls.Add(Me.radioButton1)
groupBox1.Controls.Add(radioButton1)
groupBox1.Location = New System.Drawing.Point(190, 20)
groupBox1.Size = New System.Drawing.Size(300, 90)
groupBox1.Text = "Assembly Load Options"
Me.radioButton2.Location = New System.Drawing.Point(200, 60)
Me.radioButton2.Size = New System.Drawing.Size(250, 17)
Me.radioButton2.Text = "Search Part's Folder and Subdirectories"
Me.radioButton1.Location = New System.Drawing.Point(200, 40)
Me.radioButton1.Name = "radioButton1"
Me.radioButton1.Size = New System.Drawing.Size(250, 17)
Me.radioButton1.Text = "As Saved"
Me.radioButton3.Location = New System.Drawing.Point(200, 80)
Me.radioButton3.Size = New System.Drawing.Size(280, 17)
Me.radioButton3.Text = "Search Part's PROJECT Folder and Subdirectories"
Me.radiobutton3.checked = True
groupBox2.Controls.Add(Me.cbox1)
groupBox2.Controls.Add(Me.cbox2)
groupBox2.Controls.Add(cbox3)
groupBox2.Controls.Add(cbox4)
groupBox2.Controls.Add(cbox5)
groupBox2.Controls.Add(cbox5)
groupBox2.Location = New System.Drawing.Point(40, 20)
groupBox2.Size = New System.Drawing.Size(140, 150)
groupBox2.Text = "Export File Types"
Me.cBox1.Location = New System.Drawing.Point(50, 40)
Me.CBox1.Size = New System.Drawing.Size(120, 17)
Me.cBox1.Text = "STEP (.stp)"
If Not file.exists(stp_exp) Then
Me.cBox1.enabled = False
Me.cBox1.checked = False
End If
Me.cBox2.Location = New System.Drawing.Point(50, 60)
Me.CBox2.Size = New System.Drawing.Size(120, 17)
Me.cBox2.Text = "IGES (.igs)"
If Not file.exists(igs_exp) Then
Me.cBox2.enabled = False
Me.cBox2.checked = False
End If
Me.cBox3.Location = New System.Drawing.Point(50, 80)
Me.CBox3.Size = New System.Drawing.Size(120, 17)
Me.cBox3.Text = "JT (.jt)"
If Not file.exists(jt_exp) Then
Me.cBox3.enabled = False
Me.cBox3.checked = False
End If
Me.cBox4.Location = New System.Drawing.Point(50, 100)
Me.CBox4.Size = New System.Drawing.Size(120, 17)
Me.cBox4.Text = "Parasolid (.x_t)"
Me.cBox5.Location = New System.Drawing.Point(50, 120)
Me.CBox5.Size = New System.Drawing.Size(120, 17)
Me.cBox5.Text = "Plot/PDF (.plt/.pdf)"
Me.cBox6.Location = New System.Drawing.Point(50, 140)
Me.CBox6.Size = New System.Drawing.Size(128, 17)
Me.cBox6.Text = "DCS Log (-filelog.txt)"
Me.cBox7.Location = New System.Drawing.Point(225, 115)
Me.CBox7.Size = New System.Drawing.Size(200, 23)
Me.cBox7.Text = "Compress Exported Files"
Me.cBox7.Checked = True
If Not file.exists(seven_zip) Then
Me.cBox7.enabled = False
Me.cBox7.checked = False
End If
Me.cBox8.Location = New System.Drawing.Point(225, 140)
Me.CBox8.Size = New System.Drawing.Size(200, 23)
Me.cBox8.Text = "Generate File List for Transmittal"
Me.cBox8.Checked = False
Me.cBox9.Location = New System.Drawing.Point(225, 165)
Me.CBox9.Size = New System.Drawing.Size(250, 23)
Me.cBox9.Text = "Export Sheet Bodies (STP/IGS/Parasolid)"
Me.cBox9.Checked = False
Me.cBox10.Location = New System.Drawing.Point(225, 190)
Me.CBox10.Size = New System.Drawing.Size(300, 30)
Me.cBox10.Text = "Split DWG CAD LH/RH (ONLY works if drawing file is linked to BOTH LH+RH parts)"
Me.cBox10.Checked = False
Me.lbox.Location = New System.Drawing.Point(230, 240)
Me.lbox.Size = New System.Drawing.Size(300, 110)
Me.lbox.horizontalscrollbar = True
Me.lbox.selectionmode = selectionmode.multiextended
Me.lbox2.Location = New System.Drawing.Point(50, 200)
Me.lbox2.Size = New System.Drawing.Size(60, 180)
Me.lbox2.horizontalscrollbar = True
Me.lbox2.selectionmode = selectionmode.multiextended
For i As Integer = 1 To 254
Me.lbox2.items.add(i)
Next
Me.label1.Location = New System.Drawing.Point(115, 210)
Me.label1.Name = "Button1"
Me.label1.Size = New System.Drawing.Size(90, 23)
Me.label1.TabIndex = 1
Me.label1.Text = "Selected Layers:"
Me.label2.Location = New System.Drawing.Point(115, 235)
Me.label2.Name = "Button1"
Me.label2.Size = New System.Drawing.Size(90, 150)
Me.label2.TabIndex = 1
Me.label2.Text = "1"
groupBox3.Controls.Add(Me.lbox2)
groupBox3.Controls.Add(Me.label1)
groupBox3.Controls.Add(Me.label2)
groupBox3.Location = New System.Drawing.Point(40, 180)
groupBox3.Size = New System.Drawing.Size(170, 210)
groupBox3.Text = "Export Layers"
Me.Button1.Location = New System.Drawing.Point(220, 460)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(96, 23)
Me.Button1.TabIndex = 1
Me.Button1.Text = "Export"
Me.Button2.Location = New System.Drawing.Point(230, 355)
Me.Button2.Name = "Button1"
Me.Button2.Size = New System.Drawing.Size(96, 23)
Me.Button2.TabIndex = 1
Me.Button2.Text = "Add File(s)"
Me.Button3.Location = New System.Drawing.Point(330, 355)
Me.Button3.Name = "Button1"
Me.Button3.Size = New System.Drawing.Size(96, 23)
Me.Button3.TabIndex = 1
Me.Button3.Text = "Remove File(s)"
groupBox4.Controls.Add(Me.lbox)
groupBox4.Controls.Add(Me.Button2)
groupBox4.Controls.Add(Me.Button3)
groupBox4.Location = New System.Drawing.Point(220, 220)
groupBox4.Size = New System.Drawing.Size(320, 170)
groupBox4.Text = "Files to Export"
groupBox5.Controls.Add(Me.radioBtnNX85)
groupBox5.Controls.Add(Me.radioBtnNX8)
'groupBox5.Controls.Add(radioBtnNX8)
'groupBox5.Controls.Add(radioBtnNX85)
groupBox5.Location = New System.Drawing.Point(40, 400)
groupBox5.Size = New System.Drawing.Size(500, 50)
groupBox5.Text = "NX VERSION"
Me.radioBtnNX8.Location = New System.Drawing.Point(45, 425)
Me.radioBtnNX8.Size = New System.Drawing.Size(195, 17)
Me.radioBtnNX8.Text = "NX 8"
Me.radioBtnNX85.Location = New System.Drawing.Point(230, 425)
Me.radioBtnNX85.Size = New System.Drawing.Size(250, 17)
Me.radioBtnNX85.Text = "NX 8.5"
Me.radioBtnNX8.checked = True
Me.SuspendLayout()
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(550, 500)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.label1, Me.label2, Me.lbox, Me.lbox2, Me.groupbox3, Me.Button1, Me.button2, Me.button3, Me.groupbox4, Me.cBox1, Me.cbox2, Me.cBox3, Me.cbox4, Me.cbox5, Me.cbox6, Me.cbox7, Me.cbox8, Me.cbox9, Me.cbox10, Me.radiobutton1, Me.radiobutton2, Me.radiobutton3, Me.groupbox1, Me.groupbox2, Me.groupbox5, Me.radioBtnNX85, Me.radioBtnNX8})
'***
Me.Controls.Add(groupBox5)
groupBox5.Controls.Add(radioBtnNX85)
'groupBox5.Controls.Add(radioBtnNX8)
'***
Me.Name = "Form1"
Me.Text = "MTC NX Batch Export"
Me.ResumeLayout(False)
Me.Controlbox = False
Me.topmost = True
Me.StartPosition = FormStartPosition.CenterScreen
Me.lbox2.setselected(0, True)
End Sub
#End Region
Private Sub lBox2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lBox2.SelectedIndexChanged
lstr = ""
If lbox2.selecteditems.count = 0 Then
lbox2.setselected(0, True)
End If
ReDim llst(lbox2.selecteditems.count - 1)
For i As Integer = 0 To lbox2.selecteditems.count - 1
lstr = lstr + lbox2.selecteditems(i).tostring + ", "
llst(i) = lbox2.selecteditems(i).tostring
Next
lstr = strings.left(lstr, lstr.length - 2)
label2.text = lstr
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim fstr() As String = file.readalllines(EXPDAT)
If fstr(0) = "1" And Me.cbox1.enabled Then cbox1.checked = True
If fstr(1) = "1" And Me.cbox2.enabled Then cbox2.checked = True
If fstr(2) = "1" And Me.cbox3.enabled Then cbox3.checked = True
If fstr(3) = "1" Then cbox4.checked = True
If fstr(4) = "1" Then cbox5.checked = True
If fstr(6) = "1" Then cbox6.checked = True
console.write("Program Loaded" + VBCRLF + VBCRLF)
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim fstr() As String = file.readalllines(EXPDAT)
If ((cbox1.checked Or cbox2.checked Or cbox3.checked Or cbox4.checked Or cbox5.checked Or cbox6.checked Or cbox8.checked) And lbox.items.count > 0) Then
fstr(0) = CType(-CType(cbox1.checked, Integer), String)
fstr(1) = CType(-CType(cbox2.checked, Integer), String)
fstr(2) = CType(-CType(cbox3.checked, Integer), String)
fstr(3) = CType(-CType(cbox4.checked, Integer), String)
fstr(4) = CType(-CType(cbox5.checked, Integer), String)
fstr(6) = CType(-CType(cbox6.checked, Integer), String)
fstr(7) = CType(-CType(cbox7.checked, Integer), String)
If Me.radiobutton1.checked = True Then
fstr(5) = "1"
ElseIf Me.radiobutton2.checked = True Then
fstr(5) = "2"
ElseIf Me.radiobutton3.checked = True Then
fstr(5) = "3"
End If
'Check for version
If Me.radiobtnNX8.checked = True Then
NXversion = 8
ElseIf Me.radiobtnNX85.checked = True Then
NXversion = 85
End If
file.WriteAllLines(EXPDAT, fstr)
lbox.items.copyto(prts, 0)
If cbox8.checked Then
efl = 1
End If
If cbox9.checked Then
sts = 1
stprd(16) = "MODULES_MASK=Solids,Surfaces,Wireframe"
igsrd(48) = "UGI_SOLID_MASK=Solid Bodies,Sheet Bodies"
Else
sts = 0
stprd(16) = "MODULES_MASK=Solids,Wireframe"
igsrd(48) = "UGI_SOLID_MASK=Solid Bodies"
End If
file.writealllines(stpdef, stprd)
file.writealllines(igsdef, igsrd)
ReDim Preserve prts(lbox.items.count - 1)
If cbox10.checked Then
splt = 1
End If
Me.Close()
Else
msgbox("Choose Export Type and Files to Export")
End If
End Sub
Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim fdlg As OpenFileDialog = New OpenFileDialog()
fdlg.autoupgradeenabled = False
If dir = "" Then
fdlg.InitialDirectory = Initdir
Else
fdlg.initialdirectory = dir
End If
fdlg.multiselect = True
fdlg.Filter = "Part Files (*.prt)|*.prt"
Dim fils() As String
If fdlg.ShowDialog() = DialogResult.OK Then
fils = fdlg.FileNames
Me.lbox.items.addrange(fils)
dir = System.IO.Path.GetDirectoryName(fils(0))
End If
End Sub
Private Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
While lbox.SelectedItems.Count > 0
lbox.Items.Remove(lBox.SelectedItem)
End While
End Sub
End Class