none
Open Other Application (Plantsimulation) RRS feed

  • Question

  • Hello All, 

    How can i open plantsimulation software and load model by c#?  I wrote following code but its not working..

    using System;
    using System.Runtime.InteropServices;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace remotecontrol
    {
        public class Program
        {

            static void Main()
            {
                //object psi;
                Console.WriteLine("Open plantsimulation");
                
                dynamic psi = Activator.CreateInstance(Type.GetTypeFromProgID("Tecnomatix.PlantSimulation.RemoteControl.13.0"));
                //psi = CreateObject("Tecnomatix.PlantSimulation.RemoteControl.13.0");
                System.Threading.Thread.Sleep(500);
                // try loading the model and if it works execute the SimTalk commands
                try
                {
                    psi.LoadModel("D:\\Plantsim_Remotecontrol\\test.spp");
                }
                catch (System.Runtime.InteropServices.COMException)
                {
                    Console.WriteLine("Failed loading the model");
                }
                psi.setVisible(true);
               // psi.Visible= true;
               
            }

        }
    }

    Wednesday, August 28, 2019 12:33 PM

All replies

  • What do you mean by "not working"?  Can you create the COM object?  What error do you get?

    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Wednesday, August 28, 2019 7:20 PM
  • Hi Open other Application(Plantsimulation), 

    Thank you for posting here.

    Could you provide more details about the exception or error with which line of the code thrown the exception or errors and some code about psi.LoadModel()? It will help us to analyze your problem and make a test.

    Besides, you can use Process.Start method to open an application.  

    We are waiting for your update.

    Best Regards,

    Xingyu Zhao



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Thursday, August 29, 2019 10:00 AM
    Moderator