Je suis en train d’écrie quelque macro VBA (Excel) afin d’automatisé quelque tache grâce a l’API.
Mais je bloque au niveau de la modification de matière des pièces.
J’arrive bien à récupéré la matière d’une pièce (code ci-dessous), mai je n’arrive pas a la modifier.
Quelqu’un aurai t’il un indice pour me faire avancer sur mon problème.
Merci d’avance.
Code utilisé pour récupéré la matière d’une pièce :
Code : Tout sélectionner
Sub TestModifMat()
Dim TopApp As TopSolid.Application
Dim TopDoc As TopSolid.DocumentDesign
Dim Doc As TopSolid.Document
Dim Element As TopSolid.Element
Dim VbName As String
Dim VbDensity As Double
Dim VbYoungModulus As Double
Dim VbPoissonRatio As Double
Dim VbExpansion As Double
Dim VbElasticLimit As Double
Dim VbShearModulus As Double
Dim VbShrinkageFactor As Double
Dim VbShrinkageFactorMin As Double
Dim VbShrinkageFactorMax As Double
Dim VbInjectionPressureMin As Double
Dim VbInjectionPressureMax As Double
Dim VbConductivity As Double
Dim VbThermicInertia As Double
Set TopApp = New TopSolid.Application
TopApp.Visible = True
'Ouverture du fichier test
Set Doc = TopApp.Documents.Open("C:\Perso Topsolid\Documentation\API et LIP\VB6\Macro VBA\Fichier test\P01.top")
Set Element = Doc.Elements.Item("@60")
If (Element Is Nothing) Then
MsgBox "Pas d'élément trouvé"
Else
Element.GetMatter VbName, VbDensity, VbYoungModulus, VbPoissonRatio, VbExpansion, VbElasticLimit, VbShearModulus, VbShrinkageFactor, VbShrinkageFactorMin, VbShrinkageFactorMax, VbInjectionPressureMin, VbInjectionPressureMax, VbConductivity, VbThermicInertia
MsgBox "Matiére : " & VbMatter
End If
'libérer la mémoire
Set TopDoc = Nothing
Set TopApp = Nothing
Set Doc = Nothing
Set Element = Nothing
End Sub