Your location:Tech News>Tips>CAD>How to use excel plot the data connection AutoAutoCAD practical tutorial

Latest News

How to use excel plot the data connection AutoAutoCAD practical tutorial

Author:fsadmin

Views:

  As shown, to complete today is shown below how to draw the graphic coordinates AutoAutoCAD.

  Of course, if later learned this after drawing the way, you can also change the data in a more advanced graphics.

  怎样运用AutoAutoCAD连接excel进行数据绘图  三联

  Specific steps are as follows:

  1, open the Visual Basic Editor under Macro in AutoCAD Tools menu, create a new module, enter the following code:

  Dim xlapp As Excel.Application

  Dim xlbook As Excel.workbook

  Dim xlsheet As Excel.worksheet

  Sub aa () ''Macro name

  Set xlapp = CreateObject ( "excel.application ")

  Set xlbook = xlapp.workbooks.Open ( "D: AutoCADvbafzcp.xls ") ''open path EXCEL

  xlapp.Visible = False

  Set xlsheet = xlbook.worksheets ( "sj") ''opens EXCEL worksheets

  i = xlsheet.Cells (1, 6) ''i is the line number of lines

  m = xlsheet.Cells (2, 6) ''here represents the row 2, column 6

  n = xlsheet.Cells (3, 6)

  t = xlsheet.Cells (4, 6)

  For p = 0 To i - 2 Step 1

  p = p

  k1 = xlsheet.Cells (2 + p, 1)

  h1 = xlsheet.Cells (2 + p, 2)

  k3 = xlsheet.Cells (2 + p, 3)

  k2 = xlsheet.Cells (3 + p, 1)

  h2 = xlsheet.Cells (3 + p, 2)

  h3 = xlsheet.Cells (3 + p, 3)

  Dim Point As AAutoCADLine

  Dim the starting point (2) As Double

  Dim endpoint (2) As Double

  The starting point (0) = k1 + m

  The starting point (1) = h1 + n

  Starting point (2) = k3 + t

  Endpoint (0) = k2 + m

  Endpoint (1) = h2 + n

  Endpoint (2) = h3 + t

  Set point = ThisDrawing.ModelSpace.AddLine (starting point, end point)

  Next

  xlbook.Close

  xlapp.Quit

  Set xlapp = Nothing

  End Sub

  

  2, while the reference to open the Tools menu editor, locate Microsoft Excel 11.0 Object Library, if not this, visit the open EXCEL file to start.

  After doing this a few steps to save the changes, and then you can close the editor.

  

  3, after returning AutoCAD shortcut keys Alt + F8 start the macro, and then start the name for the macro-aa, this time on the AutoCAD drawing will automatically be good.

  

  4, the following is the code used in the arc Videos:

  Private Sub CommandButton1_Click ()

  Dim curves (0 To 1) As AAutoCADEntity

  Dim centerpoint (0 To 2) As Double

  Dim radius As Double

  Dim startangle As Double

  Dim endangle As Double

  centerpoint (0) = (X coordinate of center): centerpoint (1) = (Y coordinate of center): centerpoint (2) = (Z coordinate of the center) ''} {center coordinates

  radius = (the radius of the arc of a circle drawn) ''} {radius

  startangle = (starting point of an arc drawn radians) ''angle / 3 * 180.141592653.

  endangle = (arc drawn by the end of radians)

  Set curves (0) = ThisDrawing.ModelSpace.AddArc (centerpoint, radius, startangle, endangle)

  End Sub

  Precautions

  When this may not be completely comprehensive approach to carrying out the coordinates of the drawing, you only need to re-appropriate simple fix on the line, in general, it can save a lot of time for us, and can make it easier for us to carry out mapping and operation, and accuracy is reserved conducted by the value you enter.

  www.29jc.com

Recommend article

Relate article