Exel for civil engineer

Page 241

To run the script above, firstly, open your AutoCAD, then type scr in command prompt or via Tools > Run Script. From the Select Script File dialog box, select myScript.scr, then the line segments with the coordinates as in the script file will be created in AutoCAD. Example 3 In creating line, it is highly recommended to create a table of joints so creating lines to be more convenient, especially when it comprises many segments and not all of them are continuous. See the previous examples in Chapter 1. Next is an example of worksheet data for creating lines. Now, it has an input to add a new folder to make your files storage tidy.

The code: Dim npt, nln, i Dim myFolder, myFile myFolder = Cells(1, 10) myFile = Cells(2, 10) npt = Cells(5, 10) nln = Cells(6, 10) ReDim x(npt), y(npt) ReDim x1(nln), y1(nln), x2(nln), y2(nln)

'Read joint coord For i = 1 To npt x(i) = Cells(4 + i, 2) y(i) = Cells(4 + i, 3) Next i

'Read lines data For i = 1 To nln

An Introduction to Excel for Civil Engineers

234


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.