使用方程式外部链接文件用UI来参数化装配体

" Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'获得外部参数
Length = TextBox1.Text
Width_1 = TextBox2.Text
Higth = TextBox3.Text
Shell = TextBox4.Text
DE_X = TextBox5.Text
DE_Y = TextBox6.Text
' 生成方程式字符串
Dim aa As String = """长"" = " + Length
Dim bb As String = """宽"" = " + Width_1
Dim cc As String = """高"" = " + Higth
Dim dd As String = """厚"" = " + Shell
Dim ee As String = """吊耳位置水平"" = " + DE_X
Dim ff As String = """吊耳位置竖直"" = " + DE_Y
EText = {aa, bb, cc, dd, ee, ff}
swApp = CreateObject("SldWorks.Application")
Part = CType(swApp.ActiveDoc, ModelDoc2)
'装配体所放位置,讲路径改为自己的位置
Part = swApp.OpenDoc6("E:\迅雷下载\液压油箱\毕业设计.sldasm", 2, 0, "", longstatus, longwarnings)
Dim swAssembly As Object
swAssembly = Part
swApp.ActivateDoc2("毕业设计.sldasm", False, longstatus)
Part = swApp.ActiveDoc

    'My.Computer.FileSystem.WriteAllText("C:\Users\weigan\Desktop\G代码\equation.txt", "EText", False, System.Text.Encoding.Default)

    '方程式链接文件位置,讲路径改为自己方程式链接文件位置
    File.WriteAllLines("C:\Users\weigan\Desktop\equations.txt", EText, System.Text.Encoding.Default)

End Sub"

你可能感兴趣的:(使用方程式外部链接文件用UI来参数化装配体)