Showing results for 
Search instead for 
Did you mean: 


Valued Contributor
Valued Contributor


Hi, I want write a program which could first open the part file and then update the variables, but now i have a problem . . . i wrote this program and i dont know what is wrong, thanks for help


Imports System.Runtime.InteropServices

Public Class Form1

    Dim objApplication As SolidEdgeFramework.Application = Nothing

    Dim objPart As SolidEdgePart.PartDocument = Nothing

    Dim objVariables As SolidEdgeFramework.Variables = Nothing

    Dim objVariable As SolidEdgeFramework.variable = Nothing

    Dim objDocuments As SolidEdgeFramework.Documents

    Dim objApp As SolidEdgeFramework.Application


    Dim val1 As String

    Dim strValue As String

    Dim strName As String


    Const TESTFILE = "E:\VBA\part_2.par"




    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load



    End Sub


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click



        objDocuments = objApp.Documents

        Call objDocuments.Open(Filename:=TESTFILE)



        objApplication = Marshal.GetActiveObject("SolidEdge.Application")



        objPart = objApplication.ActiveDocument

        objVariables = objPart.Variables



        val1 = Val(TextBox1.Text)

        strValue = (val1 - 130) / 2

        strName = "tworz_1"




        objVariables.Edit(strName, strValue)

    End Sub



Posted by: Rafa P
Post date: 3/25/2010 10:16:25 AM