# IFM O3D302 Ignition Integration

**URL:** <https://forum.inductiveautomation.com/t/ifm-o3d302-ignition-integration/99329>\
**Category:** General Discussion\
**Tags:** ignition81, vision, scripting\
**Created:** [December 2, 2024, 7:20pm UTC](https://forum.inductiveautomation.com/t/ifm-o3d302-ignition-integration/99329 "2024-12-02T19:20:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zachary\_Kacel1](https://avatars.discourse-cdn.com/v4/letter/z/ea666f/32.png) [@Zachary\_Kacel1](https://forum.inductiveautomation.com/u/Zachary_Kacel1)\
**Post date:** [December 2, 2024, 7:20pm UTC](https://forum.inductiveautomation.com/t/ifm-o3d302-ignition-integration/99329/1 "2024-12-02T19:20:27Z")

</div>

I had a project to get data from an IFM O3D302 3D Sensor into Ignition, and I figured I would share my solution so others can use it or provide feedback on how I might improve it.

I needed the camera to do two things: measure the height, width, and depth of a part, and compare the distance between two ROIs.

Getting the data into Ignition was the easy part. I simply set up a TCP Device with a Character-Based Delimiter, which allowed me to read the output string. The output string can be built in the IFM Vision Software. Mine includes the application number, a keyword, and the measurement values. I used a tag change script to take the current value of the tag and write out the values to their own tags.

Raw data tag example:  
**star;APP\_NUM:2;TOP;0.000;0.924;0.819;stop**

The hard part (for me, anyway) was triggering the camera and changing programs in it using Ignition. Luckily, IFM provides a Python package to interact with the camera. I just grabbed the part of the code I needed to send the trigger message, which was just the pcic client library that I added to my Project Library. I Then wrote a simple script to trigger both programs.

Example Script for switch application and triggering the sensor.

```python
def trigger():
	print('Processing')
	system.tag.writeBlocking('[Testing]o3d3xx/Status', 'PROCESSING')
	
	pcic = o3d3xx.client.PCICV3Client("192.168.0.209", 50010)
	
	app1 = pcic.sendCommand("a01") #Send Command to switch to Application 1
	answer1 = pcic.sendCommand("T?") #Send Trigger Command
	print(answer1) #Print answer
	
	 
	app2 = pcic.sendCommand("a02") #Send Command to switch to Application 2
	answer2 = pcic.sendCommand("T?") #Send Trigger Command
	print(answer2)     
	
	pcic.close()
	
	system.tag.writeBlocking('[Testing]o3d3xx/Status', 'READY')
	print('Completed')

```

IFM Device Ignition setup

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/0/c09fc03c5b7253a6e49d2f4daea28bd2b0ae7bcc.png)
