<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Need Python Code Example for SMIEngine - Communications				            </title>
            <link>https://www.animatics.com/forum/communications/need-python-code-example-for-smiengine/</link>
            <description>Animatics Distributor Locator Discussion Board</description>
            <language>en-US</language>
            <lastBuildDate>Mon, 09 Mar 2026 14:55:43 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>Need Python Code Example for SMIEngine</title>
                        <link>https://www.animatics.com/forum/communications/need-python-code-example-for-smiengine/#post-1265</link>
                        <pubDate>Mon, 08 Oct 2018 12:58:18 +0000</pubDate>
                        <description><![CDATA[I am not sure I understand your problem.  Are you trying to use the serial port or the CANbus port with the Kvaser adaptrer?

It should be possible to just send animatics commands over the...]]></description>
                        <content:encoded><![CDATA[I am not sure I understand your problem.  Are you trying to use the serial port or the CANbus port with the Kvaser adaptrer?

It should be possible to just send animatics commands over the interface.

e.g.
<pre>
"""
Using comtypes to access Animatics Smart Motor library
"""
import comtypes.client as cc

smiHost = cc.CreateObject('SMIEngine.SMIHost')
cc.GetModule('IntegMotorInterface.dll')
import comtypes.gen.INTEGMOTORINTERFACELib as commLib
smiCom = smiHost.QueryInterface(commLib.ISMIComm)
smiCom.InitCANOpen(3)
smiCom.BaudRate = 125000
smiCom.OpenPort('CANopen')
##        findMotor = smiCom.DetectCANOpenMotors(5, 0)
##        print('Found motors = ', findMotor)
##        numMotor = smiCom.NoOfMotors
##        print('Motor number = ', numMotor)
numMotor = 1
smiCom.DefaultMotor = numMotor       
command = 'RUN'
response = smiCom.GetResponseOf(command)
</pre>]]></content:encoded>
						                            <category domain="https://www.animatics.com/forum/communications/">Communications</category>                        <dc:creator>stephenmoore</dc:creator>
                        <guid isPermaLink="true">https://www.animatics.com/forum/communications/need-python-code-example-for-smiengine/#post-1265</guid>
                    </item>
				                    <item>
                        <title>Need Python Code Example for SMIEngine</title>
                        <link>https://www.animatics.com/forum/communications/need-python-code-example-for-smiengine/#post-1256</link>
                        <pubDate>Sat, 08 Sep 2018 15:41:00 +0000</pubDate>
                        <description><![CDATA[Yes it is really neede]]></description>
                        <content:encoded><![CDATA[Yes it is really neede]]></content:encoded>
						                            <category domain="https://www.animatics.com/forum/communications/">Communications</category>                        <dc:creator>pedro6</dc:creator>
                        <guid isPermaLink="true">https://www.animatics.com/forum/communications/need-python-code-example-for-smiengine/#post-1256</guid>
                    </item>
				                    <item>
                        <title>Need Python Code Example for SMIEngine</title>
                        <link>https://www.animatics.com/forum/communications/need-python-code-example-for-smiengine/#post-1195</link>
                        <pubDate>Tue, 12 Jan 2016 22:31:07 +0000</pubDate>
                        <description><![CDATA[I have tried this and it works.
I have a query to how to send the commands from python to the SMI interface. Now i am writing directly to the com port .]]></description>
                        <content:encoded><![CDATA[I have tried this and it works.
I have a query to how to send the commands from python to the SMI interface. Now i am writing directly to the com port .]]></content:encoded>
						                            <category domain="https://www.animatics.com/forum/communications/">Communications</category>                        <dc:creator>bikramaditya</dc:creator>
                        <guid isPermaLink="true">https://www.animatics.com/forum/communications/need-python-code-example-for-smiengine/#post-1195</guid>
                    </item>
				                    <item>
                        <title>Need Python Code Example for SMIEngine</title>
                        <link>https://www.animatics.com/forum/communications/need-python-code-example-for-smiengine/#post-1042</link>
                        <pubDate>Fri, 27 Mar 2015 12:48:13 +0000</pubDate>
                        <description><![CDATA[This works just fine with the Kvaser CAN interface...




import comtypes.client as cc

def main():

    &quot;&quot;&quot;
    CAN communications.
    &quot;&quot;&quot;
    smiHost = cc.CreateObject(&#039;SMIEng...]]></description>
                        <content:encoded><![CDATA[This works just fine with the Kvaser CAN interface...

<pre>


import comtypes.client as cc

def main():

    """
    CAN communications.
    """
    smiHost = cc.CreateObject('SMIEngine.SMIHost')
    cc.GetModule('IntegMotorInterface.dll')
    import comtypes.gen.INTEGMOTORINTERFACELib as commLib
    smiCom = smiHost.QueryInterface(commLib.ISMIComm)
    smiCom.InitCANOpen(3)
    smiCom.BaudRate = 125000
    smiCom.OpenPort('CANopen')
    findMotor = smiCom.DetectCANOpenMotors(5, 0)
    print('Found motors = ', findMotor)
    numMotor = smiCom.NoOfMotors
    smiCom.DefaultMotor = numMotor
    print('Number of motor = ', numMotor)
    cmd = 'RSP2'
    print('Sending SMI command = ' + cmd)    
    response = smiCom.GetResponseOf(cmd)
    print('Motor response = ' + response)
    
            

if __name__ == "__main__":
    main()

</pre>

Thank you for your help.  My Python HMI was completely re-usable with the CAN interface.  This really streamlines our development.

Regards,

sm]]></content:encoded>
						                            <category domain="https://www.animatics.com/forum/communications/">Communications</category>                        <dc:creator>stephenmoore</dc:creator>
                        <guid isPermaLink="true">https://www.animatics.com/forum/communications/need-python-code-example-for-smiengine/#post-1042</guid>
                    </item>
				                    <item>
                        <title>Need Python Code Example for SMIEngine</title>
                        <link>https://www.animatics.com/forum/communications/need-python-code-example-for-smiengine/#post-1041</link>
                        <pubDate>Wed, 25 Mar 2015 19:01:12 +0000</pubDate>
                        <description><![CDATA[Great!  Please let us know how it goes.]]></description>
                        <content:encoded><![CDATA[Great!  Please let us know how it goes.]]></content:encoded>
						                            <category domain="https://www.animatics.com/forum/communications/">Communications</category>                        <dc:creator>csearcy</dc:creator>
                        <guid isPermaLink="true">https://www.animatics.com/forum/communications/need-python-code-example-for-smiengine/#post-1041</guid>
                    </item>
				                    <item>
                        <title>Need Python Code Example for SMIEngine</title>
                        <link>https://www.animatics.com/forum/communications/need-python-code-example-for-smiengine/#post-1040</link>
                        <pubDate>Wed, 25 Mar 2015 18:48:11 +0000</pubDate>
                        <description><![CDATA[It works, so far.  When I get back to my lab I will test it out with our HMI

import comtypes.client as cc

def main():

    &quot;&quot;&quot;
    CAN communications.
    &quot;&quot;&quot;
    smi = cc.CreateO...]]></description>
                        <content:encoded><![CDATA[It works, so far.  When I get back to my lab I will test it out with our HMI
<pre>
import comtypes.client as cc

def main():

    """
    CAN communications.
    """
    smi = cc.CreateObject('SMIEngine.SMIHost')
    cc.GetModule('IntegMotorInterface.dll')
    import comtypes.gen.INTEGMOTORINTERFACELib as commLib
    smiCom = smi.QueryInterface(commLib.ISMIComm)
    smiCom.OpenPort('can0')
            

if __name__ == "__main__":
    main()
</pre>]]></content:encoded>
						                            <category domain="https://www.animatics.com/forum/communications/">Communications</category>                        <dc:creator>stephenmoore</dc:creator>
                        <guid isPermaLink="true">https://www.animatics.com/forum/communications/need-python-code-example-for-smiengine/#post-1040</guid>
                    </item>
				                    <item>
                        <title>Need Python Code Example for SMIEngine</title>
                        <link>https://www.animatics.com/forum/communications/need-python-code-example-for-smiengine/#post-1039</link>
                        <pubDate>Wed, 25 Mar 2015 16:56:15 +0000</pubDate>
                        <description><![CDATA[Hey that&#039;s good stuff.  I&#039;ll go ahead and download the comtypes (Python2.x) module and give it a try.]]></description>
                        <content:encoded><![CDATA[Hey that's good stuff.  I'll go ahead and download the comtypes (Python2.x) module and give it a try.]]></content:encoded>
						                            <category domain="https://www.animatics.com/forum/communications/">Communications</category>                        <dc:creator>stephenmoore</dc:creator>
                        <guid isPermaLink="true">https://www.animatics.com/forum/communications/need-python-code-example-for-smiengine/#post-1039</guid>
                    </item>
				                    <item>
                        <title>Need Python Code Example for SMIEngine</title>
                        <link>https://www.animatics.com/forum/communications/need-python-code-example-for-smiengine/#post-1038</link>
                        <pubDate>Wed, 25 Mar 2015 15:44:42 +0000</pubDate>
                        <description><![CDATA[Sorry I can&#039;t offer much more.
Here are the only notes I have on Python.
 
There are two ways of using COM from Python.
One is Python Win32 extension, and is popular.
The other is comty...]]></description>
                        <content:encoded><![CDATA[Sorry I can't offer much more.
Here are the only notes I have on Python.
 
There are two ways of using COM from Python.
One is Python Win32 extension, and is popular.
The other is comtypes.
These are not Python's native library (module Python calls it).
So you must get it from source forge.
PythonWin32Extension needs IDispatch interface, but SMIEngine doesn't provide it.
So I tried comtypes.
Below is how to create an instance of SMIEnginer.SMIHost, get ISMIComm interface
and open it with 'COM1'. 
 
&gt;&gt;&gt; import comtypes.client as cc
&gt;&gt;&gt; smi = cc.CreateObject('SMIEngine.SMIHost')
&gt;&gt;&gt; cc.GetModule('IntegMotorInterface.dll')
&gt;&gt;&gt; import comtypes.gen.INTEGMOTORINTERFACELib
&gt;&gt;&gt; smiCom = smi.QueryInterface(comtypes.gen.INTEGMOTORINTERFACELib.ISMIComm)
&gt;&gt;&gt; smiCom.OpenPort('COM1')]]></content:encoded>
						                            <category domain="https://www.animatics.com/forum/communications/">Communications</category>                        <dc:creator>csearcy</dc:creator>
                        <guid isPermaLink="true">https://www.animatics.com/forum/communications/need-python-code-example-for-smiengine/#post-1038</guid>
                    </item>
				                    <item>
                        <title>Need Python Code Example for SMIEngine</title>
                        <link>https://www.animatics.com/forum/communications/need-python-code-example-for-smiengine/#post-1037</link>
                        <pubDate>Wed, 25 Mar 2015 15:36:28 +0000</pubDate>
                        <description><![CDATA[Thanks.  I am actually using the RS-485 to talk to an ADAM-4024 module (with Andy Barret&#039;s help).  

I also am talking to Kvaser directly to see what we might be able to do in Python.  Tho...]]></description>
                        <content:encoded><![CDATA[Thanks.  I am actually using the RS-485 to talk to an ADAM-4024 module (with Andy Barret's help).  

I also am talking to Kvaser directly to see what we might be able to do in Python.  Though VB will work for our HMI and I am converti ng over to it, we do alot of code development in Python and it would be good to have ability to access the dll.

I do not want to re-invent the wheel but even a single frame build method to to access Smart Motor command strings (COB-ID 2501 I think) would work.  However, I know very little about CAN communications.

Regards,

sm]]></content:encoded>
						                            <category domain="https://www.animatics.com/forum/communications/">Communications</category>                        <dc:creator>stephenmoore</dc:creator>
                        <guid isPermaLink="true">https://www.animatics.com/forum/communications/need-python-code-example-for-smiengine/#post-1037</guid>
                    </item>
				                    <item>
                        <title>Need Python Code Example for SMIEngine</title>
                        <link>https://www.animatics.com/forum/communications/need-python-code-example-for-smiengine/#post-1036</link>
                        <pubDate>Wed, 25 Mar 2015 14:25:01 +0000</pubDate>
                        <description><![CDATA[I don&#039;t have any code examples, but you may have another option.
You can open an RS485 port on I/O ports 4 and 5 (with respect to pin13) on the 15pin D-Sub.
If opened in command mode, you ...]]></description>
                        <content:encoded><![CDATA[I don't have any code examples, but you may have another option.
You can open an RS485 port on I/O ports 4 and 5 (with respect to pin13) on the 15pin D-Sub.
If opened in command mode, you can download/debug over this port also.

OCHN(RS4,1,N,9600,1,8,C) 'Open RS485 port at 9600]]></content:encoded>
						                            <category domain="https://www.animatics.com/forum/communications/">Communications</category>                        <dc:creator>csearcy</dc:creator>
                        <guid isPermaLink="true">https://www.animatics.com/forum/communications/need-python-code-example-for-smiengine/#post-1036</guid>
                    </item>
							        </channel>
        </rss>
		