🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

How can I convert implicit part to triangle mesh with python code using hwx library? (Inspire 2025)

User: "EnesKurt"
Altair Community Member

Hi there,

I created a body-centered cubic strut lattice using a simple cube. I want to convert this lattice structure to triangle mesh with python code. But I want to do this with the new feature “Create sharp edges and specift mesh size” option and “Average mesh size” value of 0.2 mm in Inspire 2025. I could not find the function I was looking for in the hwx library. There is a function called “convertToTriangleMesh()” but it does not allow me to enter the option and mesh size I want.

Code (without convert operation):

from hwx import inspire
model = inspire.getModel()
cube = model.createSolidBlock(x=10, y=10, z=10)
implicitPart = inspire.Implicit()
implicitPart.convertToImplicit(cube)
implicitBody = implicitPart.bodies[0]
implicitPart.strutLattice(body=implicitBody,strutDiameter=2, unitCellType='BODYCENTEREDCUBIC',uniform=False, cellSizeX=2, cellSizeY=2, cellSizeZ=2)
cube.visible = False
inspire.fitView()

image.png

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "SouravDas0306"
    Altair Employee
    Accepted Answer

    Hi Eneskurt,

    In Altair Inspire 2025, the current convertToTriangleMesh() function in the hwx Python API does not provide options to specify advanced meshing settings such as “Create sharp edges” or to set the “Average mesh size” directly through the script. These options are currently only accessible via the graphical user interface. Although you can convert your lattice structure to a triangle mesh using convertToTriangleMesh(), controlling mesh refinement and sharp edge detection programmatically is not yet supported in the API. One possible approach is to check if there are global or model-level meshing settings objects available in the API that allow you to adjust mesh parameters before conversion, but these are not well-documented or may not be exposed yet. Alternatively, you can perform the mesh conversion in your script and then manually refine or adjust mesh settings in the Inspire GUI. Using the built-in script recorder in Inspire while applying your desired mesh options could help reveal if any hidden or additional function calls are triggered that might be scriptable. For full control over these advanced meshing options via scripting, I recommend contacting Altair support to check on upcoming API enhancements or workarounds. If you want, I can help you explore the current API objects in your Inspire environment to look for possible mesh setting handles or assist in automating GUI workflows as a temporary solution.

    Regards,

    Sourav