兰州人 发表于 2007-11-5 09:43

Auto CAD+Excel使用技巧与压力容器设计

<p>&nbsp;通过本人对压力容器三维模型程序的研究,得出的结论是:AutoCAD+Excel技术是机械类设计工作者的必须掌握的基本工具,也是必须掌握生存手段之一。下图是本人采用Auto CAD+ Excel&nbsp; 作为绘图手段的作品之一。</p><p>&nbsp;</p><p></p><p></p><p></p><p></p><p></p><p></p><p>http://ftp.mjtd.com/20071012-001.swf</p>

兰州人 发表于 2007-11-5 11:01

<p>压力容器设计关键就是数据准备,采用交互式方法直接画图是目前通用的作法。几何形状相同尺寸有变化的压力容器零部件设计时,采用AutoCAD+Excel的手段参数化设计压力容器设计要比交互式AutoCAD设计,工作效率高,出图质量高是无庸质疑的结论。</p><p>1、AutoCAD</p><p>1.1 学习成本:AutoCad比其它制图软件应用要广泛的多,有广泛的群众基础,学习这个软件要比其它软件要方便的多,有老师教,同事之间可以相互交流,结论学习成本要比学其它软件低的多。</p><p>1.2 通用性:AutoCAD图形文件到全国各地任意工程单位都能打开,不需要转换,所谓比AutoCAD先进的软件(也不过是在某些特定行业,特定功能应用上),都必须要向AutoCAD靠拢,必须要有dwg输出格式。结论,dwg文件格式是当今通用的工程制图标准模式。</p><p>2、Excel</p><p>2.1&nbsp;学习成本:在当今社会,不会Excel简直就不可能在这个行道有生存空间,设计就是天天和数据表格打交道。结论:数据表格处理,Excel是当今无论比学习成本最低的应用软件。</p><p>2.2 通用性,是台电脑就可以运行Excel,现在就连手机都可以用Excel.</p><p>结论:采用AutoCAD+Excel手段进行参数化设计,无论从学习成本和通用性角度出发,都是最优的选择。</p>

兰州人 发表于 2007-11-7 08:30

本帖最后由 作者 于 2007-11-7 8:48:20 编辑


计算如图所示的换热器管板交点(换热管开孔),可用以下程序解决。程序自动读出线段,并计算出交点的坐标。




Sub Example_IntersectWith()
    Dim xlApp As Object    ' This Line ,Not set Excel , run Excel
    'Dim xlsheet As Object
   
    ' 发生错误时跳到下一个语句继续执行
    On Error Resume Next
    ' 连接Excel应用程序
    Set xlApp = GetObject(, "Excel.Application")
   
    If Err.Number <> 0 Then
      Set xlApp = CreateObject("Excel.Application")
      xlApp.Visible = True
      xlApp.Workbooks.Add
    End If
    ' 返回当前活动的工作表
    'Set xlsheet = xlApp.ActiveSheet
    Set xlSheet = xlApp.sheets(1)
    ' This example creates a line and circle and finds the points at
    ' which they intersect.
    Dim oBject As AcadEntity, oBject1 As AcadEntity
    Dim ii As Integer, jj As Integer
    Dim Ppt As Variant
    nn = 1
    For ii = 0 To ThisDrawing.ModelSpace.Count - 1
      
      Set oBject = ThisDrawing.ModelSpace.Item(ii)
      
      For jj = 0 To ThisDrawing.ModelSpace.Count - 1
      Set oBject1 = ThisDrawing.ModelSpace.Item(jj)
      
      Ppt = oBject1.IntersectWith(oBject, acExtendOtherEntity)
      xlSheet.Cells(nn, 1).Value = Format(Ppt(0), "0.0")
      xlSheet.Cells(nn, 2).Value = Format(Ppt(1), "0.0")
      xlSheet.Cells(nn, 3).Value = Ppt(2)
      Debug.Print Ppt(0), Ppt(1), Ppt(2)
      Debug.Print nn, oBject.Handle, oBject1.Handle
      xlSheet.Cells(nn, 4).Value = nn
      nn = nn + 1
      Next jj
    Next ii
   
End Sub
在Excel中计算的结果。
交点坐标顺序X点Y点Z点第1点-743-37.60第2点-739-86.10第3点-738.6-300第4点-732.5-130.20第5点-724.1-1710第6点-721.300第7点-714-209.10第8点-706.6-300第9点-704300

兰州人 发表于 2007-11-7 21:24

<p>上面程序运行在Excel结果如下。</p><p><table cellspacing="0" cellpadding="0" width="216" border="0" style="WIDTH: 162pt; BORDER-COLLAPSE: collapse;"><colgroup><col span="3" width="72" style="WIDTH: 54pt;"></col></colgroup><tbody><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl22" width="72" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 54pt; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td><td class="xl22" width="72" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext 0.5pt solid; BORDER-LEFT: windowtext; WIDTH: 54pt; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td><td class="xl22" width="72" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext 0.5pt solid; BORDER-LEFT: windowtext; WIDTH: 54pt; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl22" align="right" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">928.1</font></td><td class="xl22" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">201.2</font></td><td class="xl22" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">0</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl22" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td><td class="xl22" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td><td class="xl22" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl22" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td><td class="xl22" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td><td class="xl22" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl22" align="right" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">666.4</font></td><td class="xl22" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">472.8</font></td><td class="xl22" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">0</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl22" align="right" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">819.6</font></td><td class="xl22" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">313.7</font></td><td class="xl22" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">0</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl22" align="right" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">928.1</font></td><td class="xl22" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">201.2</font></td><td class="xl22" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">0</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl22" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td><td class="xl22" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td><td class="xl22" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl22" align="right" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">1239.2</font></td><td class="xl22" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">593</font></td><td class="xl22" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">0</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl22" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td><td class="xl22" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td><td class="xl22" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl22" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td><td class="xl22" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td><td class="xl22" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl22" align="right" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">1051.1</font></td><td class="xl22" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">356.1</font></td><td class="xl22" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">0</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl22" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td><td class="xl22" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td><td class="xl22" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl22" align="right" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">1239.2</font></td><td class="xl22" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">593</font></td><td class="xl22" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">0</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl22" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td><td class="xl22" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td><td class="xl22" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2"> </font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl22" align="right" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">1002.6</font></td><td class="xl22" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">765.5</font></td><td class="xl22" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">0</font></td></tr></tbody></table></p><p>采用SQL - Select进行不重复数据处理。</p><p>Sub ls()<br/>&nbsp; Dim Sql$&nbsp;&nbsp; ', Cnn As ADODB.Connection<br/>&nbsp; Dim Rst As ADODB.Recordset<br/>&nbsp; Set Cnn = CreateObject("ADODB.Connection")<br/>&nbsp; Cnn.Open "Provider = MicroSoft.Jet.OLEDB.4.0; Extended Properties = Excel 8.0; Data Source = " &amp; "k:\ls.xls"<br/>&nbsp; <br/>&nbsp; Sql = "Select distinct * from "<br/>&nbsp; Set Rst = Cnn.Execute(Sql)<br/>&nbsp; Sheets(2).Range("A1").CopyFromRecordset Rst<br/>&nbsp; <br/>End Sub</p><p></p><p><table cellspacing="0" cellpadding="0" width="216" border="0" style="WIDTH: 162pt; BORDER-COLLAPSE: collapse;"><colgroup><col span="3" width="72" style="WIDTH: 54pt;"></col></colgroup><tbody><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl24" align="right" width="72" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 54pt; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">646.8</font></td><td class="xl24" align="right" width="72" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext 0.5pt solid; BORDER-LEFT: windowtext; WIDTH: 54pt; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">282.1</font></td><td class="xl24" align="right" width="72" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext 0.5pt solid; BORDER-LEFT: windowtext; WIDTH: 54pt; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">0</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl24" align="right" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">666.4</font></td><td class="xl24" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">472.8</font></td><td class="xl24" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">0</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl24" align="right" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">693.6</font></td><td class="xl24" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">737.8</font></td><td class="xl24" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">0</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl24" align="right" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">819.6</font></td><td class="xl24" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">313.7</font></td><td class="xl24" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">0</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl24" align="right" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">928.1</font></td><td class="xl24" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">201.2</font></td><td class="xl24" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">0</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl24" align="right" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">1002.6</font></td><td class="xl24" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">765.5</font></td><td class="xl24" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">0</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl24" align="right" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">1051.1</font></td><td class="xl24" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">356.1</font></td><td class="xl24" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">0</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl24" align="right" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">1239.2</font></td><td class="xl24" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">593</font></td><td class="xl24" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">0</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl24" align="right" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">1239.2</font></td><td class="xl24" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">593</font></td><td class="xl24" align="right" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体" size="2">0</font></td></tr></tbody></table></p><p><br/></p>

兰州人 发表于 2007-11-17 11:03

<p>ADO+EXCEL通用程序样版。</p><p>Sub ADORecordset()<br/>&nbsp;&nbsp;&nbsp; Dim Sql$<br/>&nbsp;&nbsp;&nbsp; Dim RST As New ADODB.Recordset '若要使用 RST.RecordCount 计算记录个数,此项必须,故一定要设置引用:<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'VBE 中菜单“工具-引用-Microsoft ActiveX Data Objects 2.0 Library”<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(1)定义对象<br/>&nbsp;&nbsp;&nbsp; Set Conn = CreateObject("adodb.connection")&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(2)设置 connection 对象<br/>&nbsp;&nbsp;&nbsp; Set RST = CreateObject("Adodb.Recordset")&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(3)设置 Recordset 对象<br/>&nbsp;&nbsp;&nbsp; Conn.Open "provider=microsoft.jet.oledb.4.0;extended properties=excel 8.0;data source=" &amp; ThisWorkbook.FullName<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(4)打开连接<br/>&nbsp;&nbsp;&nbsp; Sql = "Select * from where 字段='020009' or 字段='050023' or 字段='010024'"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(5)设置 Sql 语句<br/>&nbsp;&nbsp;&nbsp; RST.Open Sql, Conn, adOpenStatic&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'adOpenStatic静态指针,以便计算记录个数<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(6)执行 Sql 语句<br/>&nbsp;&nbsp;&nbsp; MsgBox "找到" &amp; RST.RecordCount &amp; "个记录"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(7)可使用 RST.RecordCount 得到记录个数<br/>&nbsp;&nbsp;&nbsp; Sheets(2).Range("a2").CopyFromRecordset RST&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(8)结果放置<br/>&nbsp;&nbsp;&nbsp; Sheets(2).Activate<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; RST.Close: Conn.Close&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(9)关闭连接<br/>&nbsp;&nbsp;&nbsp; Set RST = Nothing: Set Conn = Nothing&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(10)对象置空<br/>End Sub</p><p>'使用 ADO-SQL 处理 EXCEL 文件的程序架构一</p><p>Sub ADOConn()<br/>&nbsp;&nbsp;&nbsp; Dim Sql$<br/>&nbsp;&nbsp;&nbsp; Set Conn = CreateObject("adodb.connection")<br/>&nbsp;&nbsp;&nbsp; Conn.Open "provider=microsoft.jet.oledb.4.0;extended properties=excel 8.0;data source=" &amp; ThisWorkbook.FullName<br/>&nbsp;&nbsp;&nbsp; 'Sql = "select * from where Part NO#='020009' or Part NO#='050023' or Part NO#='010024'"<br/>&nbsp;&nbsp;&nbsp; 'Sql = "select PartNO from where PartNO='020009'"<br/>&nbsp;&nbsp;&nbsp; Sql = "Select * from where 字段='020009' or 字段='050023' or 字段='010024'"<br/>&nbsp;&nbsp;&nbsp; Sheets(2).Range("a2").CopyFromRecordset Conn.Execute(Sql)<br/>&nbsp;&nbsp;&nbsp; Sheets(2).Activate<br/>&nbsp;&nbsp;&nbsp; Conn.Close<br/>&nbsp;&nbsp;&nbsp; Set Conn = Nothing<br/>End Sub<br/></p>

qxfeng 发表于 2007-11-25 20:02

赞兰州人,压力容器的设计确需要动脑筋。不知三维软件INVENTOR有没有研究过?也许能帮得上忙。

liushuaijie 发表于 2009-12-29 19:41

<p>有图纸说明的吗?</p>

kent1968 发表于 2010-10-15 14:41

学习了

254619324 发表于 2013-6-19 10:31

兰州人,对压力容器以及相关软件的开发,确实厉害,有你的好几个软件,在学习呢
页: [1]
查看完整版本: Auto CAD+Excel使用技巧与压力容器设计