vb中如何给txt程序中的变量赋值

我在做ansys的二次开发,用vb输入参数后怎么把这些输入的参数赋给ansys中的apdl语言中,求程序代码,急需!!!... 我在做ansys的二次开发,用vb输入参数后怎么把这些输入的参数赋给ansys中的apdl语言中,求程序代码,急需!!! 展开
 我来答
百度网友135709b
2010-06-01 · TA获得超过115个赞
知道答主
回答量:109
采纳率:0%
帮助的人:78.9万
展开全部
我曾经练习过一个 创建圆环体的程序 可以输入圆环体的个数,距离两个值 你看看 下面的程序有用不

Sub CreateCylinder(iCount As Integer, iDis As Integer)
' --------------------------------------------------------------
' 连接到CATIA,如果CATIA未启动,启动它
' --------------------------------------------------------------
Dim CATIA As Object
On Error Resume Next
Set CATIA = GetObject(, "CATIA.Application")
If Err.Number <> 0 Then
Set CATIA = CreateObject("CATIA.Application")
CATIA.Visible = True
End If
On Error GoTo 0
' --------------------------------------------------------------
' 创建一个零件文档
' --------------------------------------------------------------
Set documents1 = CATIA.Documents
Set partDocument1 = documents1.Add("Part")
Set part1 = partDocument1.Part
Set bodies1 = part1.Bodies
Set body1 = bodies1.Item("零部件几何体")
Set sketches1 = body1.Sketches
Set originElements1 = part1.OriginElements
Set reference1 = originElements1.PlaneXY
Set sketch1 = sketches1.Add(reference1)
Dim arrayOfVariantOfDouble1(8)
arrayOfVariantOfDouble1(0) = 0#
arrayOfVariantOfDouble1(1) = 0#
arrayOfVariantOfDouble1(2) = 0#
arrayOfVariantOfDouble1(3) = 1#
arrayOfVariantOfDouble1(4) = 0#
arrayOfVariantOfDouble1(5) = 0#
arrayOfVariantOfDouble1(6) = 0#
arrayOfVariantOfDouble1(7) = 1#
arrayOfVariantOfDouble1(8) = 0#
sketch1.SetAbsoluteAxisData arrayOfVariantOfDouble1
part1.InWorkObject = sketch1
Set factory2D1 = sketch1.OpenEdition()
Set geometricElements1 = sketch1.GeometricElements
Set axis2D1 = geometricElements1.Item("绝对轴")
Set line2D1 = axis2D1.GetItem("横向")
line2D1.ReportName = 1
Set line2D2 = axis2D1.GetItem("纵向")
line2D2.ReportName = 2
X = 0
For I = 1 To iCount
Set circle2D1 = factory2D1.CreateClosedCircle(X, 0#, 50)
Set circle2D2 = factory2D1.CreateClosedCircle(X, 0#, 70)
X = X + iDis
Next
sketch1.CloseEdition
part1.InWorkObject = body1
part1.Update
part1.InWorkObject = body1
Set shapeFactory1 = part1.ShapeFactory
Set pad1 = shapeFactory1.AddNewPad(sketch1, 20#)
part1.Update
Set specsAndGeomWindow1 = CATIA.ActiveWindow
Set viewer3D1 = specsAndGeomWindow1.ActiveViewer
Set viewpoint3D1 = viewer3D1.Viewpoint3D
End Sub
' ***********************************************************************
' Purpose: 单击按纽,以文本框中的数值来创建圆柱体
' Inputs: txtCount.Text
' txtDis.Text
' ***********************************************************************
Private Sub cmdCreate_Click()
CreateCylinder Val(txtCount.Text), Val(txtDis.Text)
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式