Tutorial: Import a file and convert it into an Implicit Geometry using the API Python in Inspire

Ximena
Ximena
Altair Employee
edited August 15 in Altair HyperWorks

The aim of this article is to show and provide a script which allows the user to import a file and then convert it into an Implicit Modeling using the API Python in Inspire. This script can be taken as a reference to be replicated in further and different workflows.

For this example, the model used is in the Demo Browser (F7) in Inspire and this is called “bolt.x_t”.

image

The script can be copied directly into the Python API to obtain the result of the following image.

----------------------------------------------------------------------------

from hwx import inspire
 
model = inspire.getModel()
print("parts:", model.parts)
 
filePath = inspire.getTutorialFilePath("Structures/bolt.x_t")
inspire.importFile(filePath)
print("parts:", model.parts)
 
bolt = model.parts[0]
nut = model.parts[1]
 
# Creating Implicit blank part for bolt.
implicitBolt = inspire.Implicit()
implicitBolt.name = "Implicit Bolt"
inspire.fitView()
 
# Creating Implicit blank part for nut.
implicitNut = inspire.Implicit()
implicitNut.name = "Implicit Nut"
inspire.fitView()
 
# Converting bolt and nut to implicit body.
implicitBolt.convertToImplicit(bolt)
implicitNut.convertToImplicit(nut)

--------------------------------------------------------------------------

image

 

Questions about this workflow? Feel free to contact us for further support.