0% found this document useful (0 votes)
14 views7 pages

Meshing ExtrusionSetup

Uploaded by

Monu whatsapp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views7 pages

Meshing ExtrusionSetup

Uploaded by

Monu whatsapp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 7

'Author: MLB

'Date: 6/01/25

Option Explicit

'Copy and Paste data from mutiple sheets to one sheet in the same column

Sub CopyPasteData()

Application.ScreenUpdating = False

Dim ws, ws1, ws2, ws3, ws4, ws5, ws6, ws8, ws7, ws9, ws10 As Worksheet
Dim x As Long, y As Long
Dim x1, x2, x3, x4 As Long
Dim y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17,
y18, y19, y20, y21 As Long
Dim LastRow As Long
Dim myFileName, extruFilePath, extruFileName As String
Dim wsData As Variant
Dim FN As Integer

Dim septext As String


septext = ";"
Dim txt1, txt2, txt3, txt4, txt5, txt6, txt7, txt8, txt9, txt10, txt11, txt12,
txt13, txt14, txt15, txt16, txt17, txt18, txt19 As String
txt1 = "Inner Geometry"
txt2 = "Outer Outline"
txt3 = "Create Inner Block"
txt4 = "Inner grid size by column"
txt5 = "Inner grid size by row"
txt6 = "COW grid points"
txt7 = "In_Out COW edges"
txt8 = "Size of In_Out COW edges"
txt9 = "In_Out COW edges connections"
txt10 = "Size of COW edges connections"
txt11 = "Outer grid Points"
txt12 = "Outer grid Edges"
txt13 = "Size of Outer grid Edges"
txt14 = "Fill grid outline"
txt15 = "Fill boundary edges"
txt16 = "Size of Fill boundary edges"
txt17 = "Connection Edges"
txt18 = "Size of Connection Edges "
txt19 = "Save"

Set ws = Worksheets("Input_Points")
Set ws1 = Worksheets("InnerGeom")

Set ws3 = Worksheets("CreateBlocks")


Set ws4 = Worksheets("Zones")
Set ws5 = Worksheets("COW_Geom")
Set ws6 = Worksheets("OuterOutline")
Set ws8 = Worksheets("Fill_Geom")
Set ws9 = Worksheets("Connection_Geom")
Set ws10 = Worksheets("OuterBlocks_Saving")
Set ws7 = Worksheets("To.f3dat")

'Delete previous contents


'With Sheets("To.f3dat (2)")
' .Range(.Range("A15:B15"), .Range("A15:B15").End(xlDown)).Delete
'End With

ws7.Rows(15 & ":" & ws7.Rows.Count).Delete

''InnerGeom''
x = 13
y = 15
While ws1.Range("I" & x) <> ""
ws7.Range("B" & y) = ws1.Range("I" & x)
x = x + 1
y = y + 1
Wend

'add separate string between different data set


septext = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws7.Cells(septext, 2).Value = ";"

ws7.Range("A15").Value = txt1

x = 13
y1 = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
'MsgBox ("The number of rows " & y1)
While ws1.Range("W" & x) <> ""
ws7.Range("B" & y1) = ws1.Range("W" & x)
x = x + 1
y1 = y1 + 1
Wend

'add separate string between different data set


septext = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws7.Cells(septext, 2).Value = ";"

x = 13
y2 = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
While ws1.Range("AM" & x) <> ""
ws7.Range("B" & y2) = ws1.Range("AM" & x)
x = x + 1
y2 = y2 + 1
Wend

'add separate string between different data set


septext = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws7.Cells(septext, 2).Value = ";"

''CreateBlocks''
x2 = 12
y5 = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
While ws3.Range("F" & x2) <> ""
ws7.Range("B" & y5) = ws3.Range("F" & x2)
x2 = x2 + 1
y5 = y5 + 1
Wend

'add separate string between different data set


septext = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws7.Cells(septext, 2).Value = ";"

ws7.Range("A" & y9 + 1).Value = txt3

''Zones''
x3 = 23
y6 = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
''''''''''''''''''''''''''''''WS4
While ws4.Range("AD" & x3) <> ""
ws7.Range("B" & y6) = ws4.Range("AD" & x3)
x3 = x3 + 1
y6 = y6 + 1
Wend

'add separate string between different data set


septext = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws7.Cells(septext, 2).Value = ";"

ws7.Range("A" & y5 + 1).Value = txt4

x4 = 118
y7 = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
While ws4.Range("AD" & x4) <> ""
ws7.Range("B" & y7) = ws4.Range("AD" & x4)
x4 = x4 + 1
y7 = y7 + 1
Wend

'add separate string between different data set


septext = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws7.Cells(septext, 2).Value = ";"

ws7.Range("A" & y6 + 1).Value = txt5


''
''COW_Geom''

x = 9
y8 = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
While ws5.Range("F" & x) <> ""
ws7.Range("B" & y8) = ws5.Range("F" & x)
x = x + 1
y8 = y8 + 1
Wend

'add separate string between different data set


septext = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws7.Cells(septext, 2).Value = ";"

ws7.Range("A" & y7 + 1).Value = txt6

x = 9
y9 = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
While ws5.Range("P" & x) <> ""
ws7.Range("B" & y9) = ws5.Range("P" & x)
x = x + 1
y9 = y9 + 1
Wend

'add separate string between different data set


septext = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws7.Cells(septext, 2).Value = ";"

ws7.Range("A" & y8 + 1).Value = txt7

x = 9
y10 = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
While ws5.Range("AB" & x) <> ""
ws7.Range("B" & y10) = ws5.Range("AB" & x)
x = x + 1
y10 = y10 + 1
Wend

'add separate string between different data set


septext = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws7.Cells(septext, 2).Value = ";"

ws7.Range("A" & y9 + 1).Value = txt8

x = 9
y11 = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
While ws5.Range("AK" & x) <> ""
ws7.Range("B" & y11) = ws5.Range("AK" & x)
x = x + 1
y11 = y11 + 1
Wend

'add separate string between different data set


septext = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws7.Cells(septext, 2).Value = ";"

ws7.Range("A" & y10 + 1).Value = txt9

x = 9
y12 = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
While ws5.Range("AW" & x) <> ""
ws7.Range("B" & y12) = ws5.Range("AW" & x)
x = x + 1
y12 = y12 + 1
Wend

'add separate string between different data set


septext = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws7.Cells(septext, 2).Value = ";"

ws7.Range("A" & y11 + 1).Value = txt10

'
'
''
''OuterOutline''

x = 8
y13 = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
While ws6.Range("H" & x) <> ""
ws7.Range("B" & y13) = ws6.Range("H" & x)
x = x + 1
y13 = y13 + 1
Wend

'add separate string between different data set


septext = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws7.Cells(septext, 2).Value = ";"

ws7.Range("A" & y12 + 1).Value = txt11

x = 8
y14 = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
While ws6.Range("O" & x) <> ""
ws7.Range("B" & y14) = ws6.Range("O" & x)
x = x + 1
y14 = y14 + 1
Wend

'add separate string between different data set


septext = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws7.Cells(septext, 2).Value = ";"

ws7.Range("A" & y13 + 1).Value = txt12

x = 8
y15 = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
While ws6.Range("AA" & x) <> ""
ws7.Range("B" & y15) = ws6.Range("AA" & x)
x = x + 1
y15 = y15 + 1
Wend

'add separate string between different data set


septext = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws7.Cells(septext, 2).Value = ";"

ws7.Range("A" & y14 + 1).Value = txt13

''Fill_Geom''
x = 9
y16 = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
While ws8.Range("G" & x) <> ""
ws7.Range("B" & y16) = ws8.Range("G" & x)
x = x + 1
y16 = y16 + 1
Wend

'add separate string between different data set


septext = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws7.Cells(septext, 2).Value = ";"

ws7.Range("A" & y15 + 1).Value = txt14

x = 9
y17 = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
While ws8.Range("P" & x) <> ""
ws7.Range("B" & y17) = ws8.Range("P" & x)
x = x + 1
y17 = y17 + 1
Wend

'add separate string between different data set


septext = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws7.Cells(septext, 2).Value = ";"

ws7.Range("A" & y16 + 1).Value = txt15

x = 9
y18 = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
While ws8.Range("AA" & x) <> ""
ws7.Range("B" & y18) = ws8.Range("AA" & x)
x = x + 1
y18 = y18 + 1
Wend

'add separate string between different data set


septext = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws7.Cells(septext, 2).Value = ";"

ws7.Range("A" & y17 + 1).Value = txt16


''
''Connection_Geom''
x = 9
y19 = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
While ws9.Range("U" & x) <> ""
ws7.Range("B" & y19) = ws9.Range("U" & x)
x = x + 1
y19 = y19 + 1
Wend

'add separate string between different data set


septext = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws7.Cells(septext, 2).Value = ";"

ws7.Range("A" & y18 + 1).Value = txt17

x = 9
y20 = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
While ws9.Range("AF" & x) <> ""
ws7.Range("B" & y20) = ws9.Range("AF" & x)
x = x + 1
y20 = y20 + 1
Wend

'add separate string between different data set


septext = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws7.Cells(septext, 2).Value = ";"

ws7.Range("A" & y19 + 1).Value = txt18


''
''OuterBlocks_Saving''
x = 51
y21 = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
While ws10.Range("B" & x) <> ""
ws7.Range("B" & y21) = ws10.Range("B" & x)
x = x + 1
y21 = y21 + 1
Wend

'add separate string between different data set


septext = ws7.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws7.Cells(septext, 2).Value = ";"

ws7.Range("A" & y20 + 1).Value = txt19

Application.CutCopyMode = False

ws7.Activate

Range("A:A").Interior.Color = RGB(255, 242, 204)

'Creating data from To.f3dat to extrusion.dat file

extruFilePath = ws.Range("K20").Value
extruFileName = ws.Range("K22").Value

myFileName = extruFilePath & "\" & extruFileName

FN = FreeFile
Open myFileName For Output As #FN
LastRow = ws7.Cells(Rows.Count, 2).End(xlUp).Row

For x = 1 To LastRow
wsData = ws7.Cells(x, 2).Value
Print #FN, wsData 'use write will create double quotation
marks while Print will not

Next x

If wsData = "" Then Exit Sub

Close #FN

Application.ScreenUpdating = True

End Sub

You might also like