我需要一个简单的解决方案来存储来自对象的变量

时间:2014-11-12 12:02:50

标签: vb.net

我为Solid Edge开发了一个小宏,它存储了字体有多大,宽度等等的值,并在另一个对象上使用它们。两个功能都可以通过buttonclick执行。第一个按钮保存值,第二个按钮执行它们。问题是我不知道应该使用哪些方法或函数来存储值。有人能帮助我吗?

enter code Public Class Form1
Dim solidedge As SolidEdge.Framework.Interop.Application
Dim line As SolidEdge.Framework.Interop.SelectSet
Dim item As SolidEdge.FrameworkSupport.Interop.Line2d
Dim style As SolidEdge.FrameworkSupport.Interop.GeometryStyle2d
Dim breite As Double
Dim dashname As String
Dim autophase As Boolean
Dim dashgapcount As Integer
Dim dashstrokepercent As Double
Dim color As Integer
Dim linearname As String
Dim units As Integer
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
    solidedge = GetObject(, "SolidEdge.Application")
    line = solidedge.ActiveSelectSet
    item = line.Item(1)
    style = item.Style
    breite = style.Width
    autophase = style.AutoPhase
    dashgapcount = style.DashGapCount
    dashstrokepercent = style.DashStrokePercent
    color = style.LinearColor
    linearname = style.LinearName
    units = style.Units
    dashname = style.DashName

End Sub

结束类别

1 个答案:

答案 0 :(得分:0)

我不熟悉Solid Edge,但根据您发布的代码,您可以尝试这样的事情:

Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
    solidedge = GetObject(, "SolidEdge.Application")
    line = solidedge.ActiveSelectSet
    item = line.Item(2)
    item.Style = style
End Sub