Danco911
Messages postés1Date d'inscriptionmercredi 22 mai 2019StatutMembreDernière intervention22 mai 2019
-
22 mai 2019 à 15:17
vb95
Messages postés3440Date d'inscriptionsamedi 11 janvier 2014StatutContributeurDernière intervention29 novembre 2023
-
24 mai 2019 à 01:35
Bonjour,
Je veux manipulé les variables dans mon fichier solid edge.
Je réussi très bien avec un .par mais quand viens le temps pour un psm part sheet métal la sa fonctionne plus.
Comment déclarer le SolidegePart.sheetmetalDocument
voici un peu de code
--------------------------------------
imports SolidEdgeAssembly
Imports System.Runtime.InteropServices
Imports SolidEdgePart
Imports SolidEdgeFramework
Public Class Form1
Public Shared oSEApp As SolidEdgeFramework.Application
Public Shared oSEDoc As SolidEdgeFramework.SolidEdgeDocument
Public Shared oDocP As SolidEdgePart.SheetMetalDocument
Public Shared oType As Type
Public Shared lmetric
Public Shared lConnected
Public Shared lDocOpened
Public Shared lStartHere
Public Shared oFSO 'As Scripting.FileSystemObject
Public Shared tb_source = Nothing
Public Shared tb_cible = Nothing
Const seLinkTypeAll = 0
Const seLinkTypeNormal = 1
Const seLinkTypeInterpart = 2
fonction ouverture du fichier
Public Shared Function SeFileOpen(sFile)
Dim lEssai2
lEssai2 = False
SeFileOpen = False
On Error Resume Next
Err.Clear()
oSEApp.Visible = True
oSEApp.Documents.Open(sFile)
If Err.Number <> 0 Then
'Code is faster than solid edge at time, need to wait it out
If FileExists(sFile) Then
lEssai2 = True
Threading.Thread.Sleep(1000)
Call oSEApp.DoIdle()
Err.Clear()
'oSEDoc.Open(sFile)
oSEApp.Documents.Open(sFile)
End If
End If
If Err.Number <> 0 Then
MessageBox.Show("Dessin non ouvert ")
'Stop
Else
oSEDoc = oSEApp.ActiveDocument
lDocOpened = True
SeFileOpen = True
End If
End Function
Fonction de manipulation de variables
Sub SEPieceChangeVariable(sVariable, xValeur)
' Get a reference to the active document
' Valeur toujours en metres (donc faut convertir la valeur)
Dim objPart = oSEApp.ActiveDocument
Dim objVariables As SolidEdgeFramework.Variables = Nothing
Dim objVariable As SolidEdgeFramework.variable = Nothing
objVariables = objPart.Variables
objVariable = objVariables.Translate(sVariable)
objVariable.Value = xValeur
' Vide les objets
objPart = Nothing
objVariables = Nothing
objVariable = Nothing
End Sub
Merci de votre aide
A voir également:
The projects in the reactor contain a cyclic reference: edge between