Solid edge

Danco911 Messages postés 1 Date d'inscription mercredi 22 mai 2019 Statut Membre Dernière intervention 22 mai 2019 - 22 mai 2019 à 15:17
vb95 Messages postés 3472 Date d'inscription samedi 11 janvier 2014 Statut Contributeur Dernière intervention 13 avril 2024 - 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

1 réponse

vb95 Messages postés 3472 Date d'inscription samedi 11 janvier 2014 Statut Contributeur Dernière intervention 13 avril 2024 169
24 mai 2019 à 01:35
Bonjour
Merci d'appliquer ce qui suit : votre code sera plus facile à lire
https://codes-sources.commentcamarche.net/faq/11288-les-balises-de-code
0
Rejoignez-nous