I have text file which contains name of the parts and path to respective part child geometries.
Is it possible to create parts and import geometries under respective parts by text file input.
Your Products have been synced, click here to refresh
I have text file which contains name of the parts and path to respective part child geometries.
Is it possible to create parts and import geometries under respective parts by text file input.
One option would be to create a python script that parses part_list.txt and then calls the Parts.createRigidBody() and Adams.read_parasolid_file() function. See the Adams Python Classes Reference, available in the Documentation:
Adams Basic Package > Adams View > Adams Python Interface > Adams python classes reference
Here is an example:
import Adams file_name = 'part_list.txt' with open(file_name) as f: lines=f.readlines() part_names = [line.strip() for line in lines[::2]] #every other line from elem0 paths = [line.strip() for line in lines[1::2]] #every other line from elem1 m = Adams.getCurrentModel() for part_name, path in zip(part_names, paths): m.Parts.createRigidBody(name=part_name) Adams.read_parasolid_file(file_name=path, part_name=part_name)
thanks for reply
One question what is command for step file or other cad formats.
I don't know if that exists. But you can always use the
Adams.execute_cmd("file geometry read geometry_type = ..... ")
In addition to using Adams.execute_cmd(), there is also Adams.read_geometry_file(file_name="test.stp", type_of_geometry="stp", part_name="PART_2")
I didn't read close enough...
:-) I just noticed it a few days ago!
this works for different types of geometry format.
© 2025 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |