Sometimes investing is about closing your eyes and ears to the near-term lousy news and focusing on the long term. That's pretty much how investors need to think about buying stock in machine vision company Cognex Corporation (CGNX -0.99%) and industrial software stock PTC (PTC -1.88%).

It's not just that these stocks are likely to recover from some problematic conditions. Many of the issues causing the problems (supply chain difficulties and logistics) will encourage companies to adopt solutions from these companies.

A buy button on a keyboard.

Image source: Getty Images.

Near-term problems, long-term opportunity

It's no secret that the industrial sector is in the middle of a difficult period. Raw material prices have risen more than most people expected going into the third quarter. In addition, supply chain difficulties have created difficulties in obtaining crucial products, and logistics issues continue to plague the sector.

It gets worse. Companies like FedEx (FDX 0.18%) have already warned of severe labor shortages caused by the ongoing impact of the COVID-19 pandemic. FedEx took a $450 million hit due to these issues. Management discussed workers having safety issues and the difficulty of hiring workers who don't have child care access when daycare centers and schools are closed.

It's likely to hold back some near-term investment as companies are busy fighting rising costs and logistics issues.

History suggests that when business leaders receive a shock, they start to make long-term plans to guard against the risk of it happening again. As such, it's reasonable to expect investment in automation and digitization to accelerate.

Cognex's machine vision

Cognex makes machine vision systems and barcode readers used in automated factory production and logistics. Traditionally its key end markets are automotive (car makers are usually early adopters of automation) and consumer electronics (its largest customer in recent years is Apple). It also has a fast-growing and highly profitable logistics business (scanning and tracking orders, often used in e-fulfillment centers).

Packages on a conveyor belt.

Image source: Getty Images.

Cognex certainly faces some near-term headwinds, not least due to automotive customers cutting back production plans due to semiconductor shortages and the supply chain issues that companies face worldwide.

Meanwhile, CEO Rob Willett said on the second-quarter earnings call in August, "We continue to believe revenue from consumer electronics for 2021 will be modestly below the level we recorded last year" due to "lower levels of investment in smartphone manufacturing and in devices needed for online learning."

However, given the problems with keeping plants open during the COVID-19 pandemic, it's highly likely that automakers and consumer electronics companies will invest in more automated processes when conditions normalize. Similarly, Cognex's solutions make logistics operations more efficient, and they also imply less human participation.

A car body on a conveyor belt surrounded by robotic arms.

Image source: Getty Images.

In the end, the key factor in Cognex's long-term growth will be an increase in the rate of adoption of machine vision. That's something likely to increase after the current difficult period is worked through. There's no slowing of the long-term need for investment in e-fulfillment centers, production lines for electric vehicles, and the process of aligning layers of screens on consumer devices using machine vision.

PTC and the fourth industrial revolution

It's been a somewhat frustrating year for shareholders in industrial software company PTC. This was supposed to be the year when customers started to significantly adopt its growth product group solutions (Internet of Things and augmented reality). However, for reference, PTC's core products (computer-aided design and product lifecycle management) are performing pretty much as expected.

Discussing the growth products group performance, CEO Jim Heppelmann said he believes that customers are conservative around committing investment on IoT "in factories and in general as they come back to speed following COVID." Given the supply chain issues many factories face right now, PTC could see the conservatism extend into the second half of 2021.

That said, just as with Cognex, it's highly likely that companies will be more willing to invest in digitizing their factories when conditions normalize. IoT connects physical assets to the digital world to generate actionable insights to improve performance. Meanwhile, AR allows the servicing of equipment without a technician being physically present. In addition, AR digitally enhances the ability of a technician to quickly service equipment.

A technician holds a tablet with a 3D model of a car engine.

Image source: Getty Images.

PTC's core product group is likely to grow as its computer-aided design and product lifecycle management solutions are increasingly adopted as a software-as-a-service option rather than an on-premise option. That's something likely to increase in the post-pandemic world as workers are more used to working remotely and desire to access their work through various devices.

Stocks to buy?

Both stocks are attractive, but near-term conditions for both companies' customers are complicated, and it's impossible to predict when they will start to improve. As a result, the upcoming earnings season will undoubtedly contain a host of companies giving profit warnings. Nevertheless, the resulting fallout could create excellent buying opportunities in companies like Cognex and PTC because their long-term growth prospects are likely to emerge even stronger when the pandemic's influence subsides.