본문 바로가기
  • You find inspiration to create your own path !
업무 자동화/python & CAD

Get Feature Names from Creo Models

by ToolBOX01 2025. 9. 6.
반응형

The script connects to Creo via Creoson, retrieves all features (including unnamed ones) from the currently active model, prints their name, type, and ID, and then disconnects. 

this script’s process (connect → get features → print → disconnect)?

▣ Python code : 

import creopyson
import json

# Connect to the Creoson server
client = creopyson.Client()
client.connect()

# Retrieve the feature list of the currently active model
features = client.feature_list(
    file_=None,  # Use the currently active model
    inc_unnamed=True  # Include unnamed features
)

# Output feature names
print("List the model's features:")
for feature in features:
    print(f"Feature Name: {feature.get('name', 'Unnamed')}, Type: {feature['type']}, ID: {feature['feat_id']}")

# Close the connection
client.disconnect()

 

Feature name creo model
List the model's features:
Feature Name: RIGHT, Type: DATUM PLANE, ID: 1
Feature Name: TOP, Type: DATUM PLANE, ID: 3
Feature Name: FRONT, Type: DATUM PLANE, ID: 5
Feature Name: 축, Type: GROUP HEAD, ID: 19185
Feature Name: X, Type: DATUM AXIS, ID: 46
Feature Name: Y, Type: DATUM AXIS, ID: 39
Feature Name: Z, Type: DATUM AXIS, ID: 50
Feature Name: ORG, Type: COORDINATE SYSTEM, ID: 7
Feature Name: , Type: PROTRUSION, ID: 19417
Feature Name: , Type: ROUND, ID: 19440
Feature Name: , Type: CHAMFER, ID: 19536

Extrude1, round1, chamfer1 are not user-defined feature names.

by korealionkk@gmail.com


반응형