<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Automation using excel sheet in AutoCAD Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-forum/automation-using-excel-sheet/m-p/9902246#M128469</link>
    <description>&lt;P&gt;It is not clear what you want to put into the cells of columns B, C, D,...&amp;nbsp; The first thing to do is create a sample Excel file with the data you want to capture and how that relates to the data you want to contain in the AutoCAD script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the file in my post the data was all in a single column so the program selects the cell at the top of the column (B2) and then assigns the contents of that cell to the variable &lt;STRONG&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;nWin&lt;/FONT&gt;&lt;/STRONG&gt;. The statement&amp;nbsp;&lt;STRONG&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;ActiveCell.Offset(1, 0).Select&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;selects the cell 1 row down and 0 cells across from the currently selected cell and assigns its contents to &lt;STRONG&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;widthWin&lt;/FONT&gt;&lt;/STRONG&gt;. The process is repeated going down a row at a time.&amp;nbsp; If you want to get values from the Excel worksheet by going across a row and down you could create a loop (For or While statement) to step across a row, column by column, and then step down a row to get more data column by column.&amp;nbsp; Again, you should start with the layout of your data in Excel.&lt;/P&gt;</description>
    <pubDate>Sun, 29 Nov 2020 14:29:28 GMT</pubDate>
    <dc:creator>leeminardi</dc:creator>
    <dc:date>2020-11-29T14:29:28Z</dc:date>
    <item>
      <title>Automation using excel sheet</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/automation-using-excel-sheet/m-p/9012884#M128465</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im looking for a way to automate my daily drawing routine. I was looking for a solution when i came up with excel and VBA. Basically what im trying to achieve is, based on user input to excel sheet, autocad will create the drawing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The drawing consist mostly from rectangles drawn at exact distances from each other see the attachment.&lt;/P&gt;&lt;P&gt;Is it possible to achieve the results im looking for with excel and VBA? If yes, are there any good resources where i can find in depth tutorials how to accomplish this task, all i could find is "Introduction to Visual Basic® for Applications for Autodesk® AutoCAD®" at autodesk pages.&lt;/P&gt;&lt;P&gt;Or is there any other way how i can automate this based on user input?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Sep 2019 18:35:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/automation-using-excel-sheet/m-p/9012884#M128465</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-09-08T18:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: Automation using excel sheet</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/automation-using-excel-sheet/m-p/9012997#M128466</link>
      <description>&lt;P&gt;&lt;FONT color="#999999"&gt;&lt;EM&gt;Or is there any other way how i can automate this based on user input?&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;For generating drawings based on parameters, &lt;A href="http://www.graytechnical.com/exceldraw/" target="_blank" rel="noopener"&gt;ExcelDraw&lt;/A&gt; may be something to consider.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Sep 2019 23:16:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/automation-using-excel-sheet/m-p/9012997#M128466</guid>
      <dc:creator>TerryDotson</dc:creator>
      <dc:date>2019-09-08T23:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Automation using excel sheet</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/automation-using-excel-sheet/m-p/9014362#M128467</link>
      <description>&lt;P&gt;There are a number of options open to use Excel to generate an AutoCAD drawing including vlisp,&amp;nbsp; AutoCAD/VBA and Excel/VBA.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I find it easier to use Excel/VBA to generate a script than using AutoCAD/VBA.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a sample that uses VBA/Excel to generate an AutoCAD script file.&amp;nbsp; Given the following data in Excel:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 314px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/675386iD4C8647A2B4B7145/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The following Excel/VBA macro will generate a script file for some of the elements in your drawing (I wasn't sure if the first window really had a different width than the rest so I assumed it didn't).&lt;/P&gt;&lt;PRE&gt;Sub main()
Dim nWin As Integer, widthWin As Double, heightWin As Double, dimOff As Double
Dim p1x As Double, p1y As Double, p2x As Double, p2y As Double
Dim dim1x As Double, dim1y As Double, dim2x As Double, dim2y As Double
Dim dim3x As Double, dim3y As Double, i As Integer
Dim msg As String
Dim fn_file
Application.ScreenUpdating = False
'get file name
fn_file = InputBox("Enter file name: ", , "Drawing-Data")
fn_file = fn_file &amp;amp; ".scr"
Open fn_file For Output As #2
' get window data
Range("b2:b2").Select
nWin = ActiveCell.Value
ActiveCell.Offset(1, 0).Select
widthWin = ActiveCell.Value
ActiveCell.Offset(1, 0).Select
heightWin = ActiveCell.Value
ActiveCell.Offset(1, 0).Select
dimOff = ActiveCell.Value ' offset value for dim text
p1x = 0
p1y = 0
p2y = p1y + heightWin
dim1x = p1x
dim1y = p2y
' create rectangle statements for each window
For i = 1 To nWin
    p2x = p1x + widthWin
    msg = "rectang " &amp;amp; p1x &amp;amp; "," &amp;amp; p1y &amp;amp; " " &amp;amp; p2x &amp;amp; "," &amp;amp; p2y
    p1x = p2x
    Print #2, msg
Next i
' compute points for dimension line and add it
dim2x = p2x
dim3x = (dim1x + dim2x) / 2
dim3y = p2y + dimOff
msg = "dimlinear " &amp;amp; dim1x &amp;amp; "," &amp;amp; dim1y &amp;amp; " " &amp;amp; dim2x &amp;amp; "," &amp;amp; dim1y &amp;amp; " " &amp;amp; dim3x &amp;amp; "," &amp;amp; dim3y
Print #2, msg
Close #2
Application.ScreenUpdating = True
End Sub&lt;/PRE&gt;&lt;P&gt;Arrays could be used to store the coordinates of points which might make the coding more efficient but this should give you a feel for one way to generate a drawing from Excel data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 15:37:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/automation-using-excel-sheet/m-p/9014362#M128467</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2019-09-09T15:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: Automation using excel sheet</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/automation-using-excel-sheet/m-p/9901420#M128468</link>
      <description>&lt;P&gt;A year and a bit more I found this discussion useful. Feels like shot in the dark, but here it goes -&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;your comment and added file was wonderfully useful and easy to understand for a person who just now starts to search for easier life.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have unsuccessfully searched what and how I have to edit your code to continue the pattern&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;(information about different windows continuous in B, C, D... Q) and what would I need to change to add names to the parts?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If there is anyone - help.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Nov 2020 21:52:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/automation-using-excel-sheet/m-p/9901420#M128468</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-28T21:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: Automation using excel sheet</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/automation-using-excel-sheet/m-p/9902246#M128469</link>
      <description>&lt;P&gt;It is not clear what you want to put into the cells of columns B, C, D,...&amp;nbsp; The first thing to do is create a sample Excel file with the data you want to capture and how that relates to the data you want to contain in the AutoCAD script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the file in my post the data was all in a single column so the program selects the cell at the top of the column (B2) and then assigns the contents of that cell to the variable &lt;STRONG&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;nWin&lt;/FONT&gt;&lt;/STRONG&gt;. The statement&amp;nbsp;&lt;STRONG&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;ActiveCell.Offset(1, 0).Select&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;selects the cell 1 row down and 0 cells across from the currently selected cell and assigns its contents to &lt;STRONG&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;widthWin&lt;/FONT&gt;&lt;/STRONG&gt;. The process is repeated going down a row at a time.&amp;nbsp; If you want to get values from the Excel worksheet by going across a row and down you could create a loop (For or While statement) to step across a row, column by column, and then step down a row to get more data column by column.&amp;nbsp; Again, you should start with the layout of your data in Excel.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Nov 2020 14:29:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/automation-using-excel-sheet/m-p/9902246#M128469</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2020-11-29T14:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: Automation using excel sheet</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/automation-using-excel-sheet/m-p/9902326#M128470</link>
      <description>&lt;P&gt;Thanks for taking time replaying. I do not know the best keywords to find information about this specific VBA AutoCad deal.. yet. So research done today and your replay now and before helps a great deal.&amp;nbsp;&lt;BR /&gt;The idea is to make script from excel table what would look in the end with rectangle shape and it's label as shown in the sketch below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="SketchOfExcelLayoutForAutoCadScript.png" style="width: 589px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/849866i15EC0367E3547ECE/image-dimensions/589x252?v=v2" width="589" height="252" role="button" title="SketchOfExcelLayoutForAutoCadScript.png" alt="SketchOfExcelLayoutForAutoCadScript.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Nov 2020 15:33:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/automation-using-excel-sheet/m-p/9902326#M128470</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-29T15:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: Automation using excel sheet</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/automation-using-excel-sheet/m-p/9903143#M128471</link>
      <description>&lt;P&gt;I think the attached Excel file with VBA program will do what you want, or close to it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Give a worksheet that looks like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 645px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/850012iDF590360DB642220/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It will generate a script that looks like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 544px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/850014i942B69614AD0D46E/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here's the result in AutoCAD:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/850016i5513496BE08B682A/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the code:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub main()
' Creates AutoCAD script to make window drawings
'  LRM  12/29/2020
'
Dim nWin As Integer, widthWin As Double, heightWin As Double, dimOff As Double
Dim p1x As Double, p1y As Double, p2x As Double, p2y As Double
Dim dim1x As Double, dim1y As Double, dim2x As Double, dim2y As Double
Dim dim3x As Double, dim3y As Double, i As Integer
Dim msg As String
Dim fn_file
Application.ScreenUpdating = False
'get file name
fn_file = InputBox("Enter file name: ", , "Drawing-Data")
fn_file = fn_file &amp;amp; ".scr"
Open fn_file For Output As #2
' get window data
Range("b2:b2").Select
msg = ""
p1x = 0
p1y = 0
deltax = 500 ' distance between windows
labely = -200 ' distance label is below window

While ActiveCell.Value &amp;lt;&amp;gt; ""
    nWin = ActiveCell.Value
    ActiveCell.Offset(1, 0).Select
    widthWin = ActiveCell.Value
    ActiveCell.Offset(1, 0).Select
    heightWin = ActiveCell.Value
    ActiveCell.Offset(1, 0).Select
    dimOff = ActiveCell.Value ' offset value for dim text
    ActiveCell.Offset(1, 0).Select
    glasslabel = ActiveCell.Value
    p2y = p1y + heightWin
    dim1x = p1x
    dim1y = p2y
    ' create rectangle statements for each window
    For i = 1 To nWin
        p2x = p1x + widthWin
        msg = "rectang " &amp;amp; p1x &amp;amp; "," &amp;amp; p1y &amp;amp; " " &amp;amp; p2x &amp;amp; "," &amp;amp; p2y
        p1x = p2x
        Print #2, msg
    Next i
    ' compute point for horizontal dimension line and add it
    dim2x = p2x
    dim3x = (dim1x + dim2x) / 2
    dim3y = p2y + dimOff
    msg = "dimlinear " &amp;amp; dim1x &amp;amp; "," &amp;amp; dim1y &amp;amp; " " &amp;amp; dim2x &amp;amp; "," &amp;amp; dim1y &amp;amp; " " &amp;amp; dim3x &amp;amp; "," &amp;amp; dim3y
    Print #2, msg
    ' compute point for vertical dimension line and add it
    dim4x = p2x
    dim5x = p2x + dimOff
    dim5y = (dim1y + dim2y) / 2
    msg = "dimlinear " &amp;amp; dim4x &amp;amp; "," &amp;amp; dim1y &amp;amp; " " &amp;amp; dim4x &amp;amp; "," &amp;amp; dim2y &amp;amp; " " &amp;amp; dim5x &amp;amp; "," &amp;amp; dim5y
    Print #2, msg
    ylabel = p1y - 4 * dimOff
    ' create labe text
    msg = "(command " &amp;amp; Chr(34) &amp;amp; "_.TEXT" &amp;amp; Chr(34) &amp;amp; " " &amp;amp; Chr(34) &amp;amp; dim1x &amp;amp; "," &amp;amp; ylabel &amp;amp; Chr(34) &amp;amp; " " &amp;amp; _
       Chr(34) &amp;amp; Chr(34) &amp;amp; " " &amp;amp; Chr(34) &amp;amp; Chr(34) &amp;amp; " " &amp;amp; Chr(34) &amp;amp; glasslabel &amp;amp; Chr(34) &amp;amp; ")"
    Print #2, msg
    ActiveCell.Offset(-4, 1).Select
    p1x = p1x + deltax
Wend
Close #2
Application.ScreenUpdating = True
End Sub
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had a hard time getting the text command to work.&amp;nbsp; There is probably a better way.&amp;nbsp; I used Chr to create quotes that are needed by the VLISP statement to avoid confusion with the VBA processing of quotes for text.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Be sure to set text height and dimension style size accordingly before running the script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 02:34:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/automation-using-excel-sheet/m-p/9903143#M128471</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2020-11-30T02:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: Automation using excel sheet</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/automation-using-excel-sheet/m-p/9913340#M128472</link>
      <description>&lt;P&gt;Worked like a charm. Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 18:18:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/automation-using-excel-sheet/m-p/9913340#M128472</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-12-03T18:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: Automation using excel sheet</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/automation-using-excel-sheet/m-p/13345797#M128473</link>
      <description>&lt;P&gt;Can the excel data be saved as dxf file?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2025 18:36:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/automation-using-excel-sheet/m-p/13345797#M128473</guid>
      <dc:creator>HomerMTY</dc:creator>
      <dc:date>2025-02-28T18:36:14Z</dc:date>
    </item>
  </channel>
</rss>

