Cancel
Showing results for 
Search instead for 
Did you mean: 

Using Com-Interface

Experimenter
Experimenter

Hello everybody,

 

I would like to control Plant using a Python script. For that matter I try to use the COM-Interface.

 

The interface seems to work in general. It's possible to excute a simtalk statement with ExecuteSimtalk.

 

My Script looks like that:

 

import win32com.client as win32
xl = win32.Dispatch("Tecnomatix.PlantSimulation.RemoteControl.13.0")
xl.ExecuteSimTalk(".Modelle.Netzwerk.Ereignisverwalter.reset")

 

I get the error: Unknown identifier Modelle. But I'm sure the path is correct. Also other commands like loadModel an quit are not working.

 

Is it because I'm using the Test Version without the Interface Package or do I have to use another path?

 

thanks in advance

 

Johannes

 

 

1 REPLY 1

Re: Using Com-Interface

Phenom
Phenom

It seems you haven't loaded a model

 

here's some readable code ( in VBA)  which works

 

Exchange "c:\temp\yyy.spp" with your model path

 

please check if the object ".modelle.netzwerk.ereignisverwalter"

 

exists in your model.

 

Sub main()

    Dim Plantsimulation As Object
    
    Set Plantsimulation = CreateObject("Tecnomatix.PlantSimulation.RemoteControl.13.0")
    
    If Plantsimulation Is Nothing Then
    
        Debug.Print "error"
    
        Stop
    
    End If
    
    Plantsimulation.loadmodel ("c:\temp\yyy.spp")
    
    Plantsimulation.executeSimtalk (".modelle.netzwerk.ereignisverwalter.reset")

End Sub