### Install Creopyson from Source Source: https://creopyson.readthedocs.io/en/latest/_sources/installation.rst.txt Install Creopyson after downloading the source code using the setup.py script. ```console $ python setup.py install ``` -------------------------------- ### Install Dependencies with Pipenv Source: https://creopyson.readthedocs.io/en/latest/contributing.html Navigate to the cloned directory and install the project's development dependencies using pipenv. ```bash cd creopyson/ pipenv install --dev ``` -------------------------------- ### Install Creopyson from Source Source: https://creopyson.readthedocs.io/en/latest/installation.html After obtaining the source code (either by cloning or downloading the tarball), use this command to install Creopyson. ```bash $ python setup.py install ``` -------------------------------- ### Start Creo Application Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/connection.html Executes a batch file to start Creo and then attempts to connect to it. Includes options for retries and using the desktop shortcut. ```python client.start_creo(path=Path("C:/Program Files/Creo 7.0/Common Files/Creo 7.0.0.0/Parametric/bin/nitro_proe_remote.bat"), retries=0, use_desktop=False) ``` -------------------------------- ### Creoson Logging Output Example Source: https://creopyson.readthedocs.io/en/latest/_sources/usage.rst.txt Example console output when Creoson logging is enabled, showing request and response details. ```text DEBUG:creopyson.connection:request: {'sessionId': '', 'command': 'connection', 'function': 'connect', 'data': None} DEBUG:creopyson.connection:response: {'status': {'error': False}, 'sessionId': '-8685569143476874454'} DEBUG:creopyson.connection:request: {'sessionId': '-8685569143476874454', 'command': 'file', 'function': 'open', 'data': {'display': True, 'activate': True, 'file': 'my_file.prt'}} DEBUG:creopyson.connection:response: {'status': {'error': False}, 'data': {'revision': 1, 'files': ['MY_FILE.prt'], 'dirname': 'C:/your/working/path/'}} ``` -------------------------------- ### Install Stable Release with Pip Source: https://creopyson.readthedocs.io/en/latest/_sources/installation.rst.txt Use this command to install the latest stable version of Creopyson. Ensure pip is installed. ```console $ pip install creopyson ``` -------------------------------- ### start_creo Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/connection.html Starts a Creo session. This method allows specifying the path to a batch file for starting Creo, the number of retries for connection, and whether to use the desktop environment. ```APIDOC ## start_creo ### Description Starts a Creo session using a specified batch file. This function configures the Creo startup environment by defining the command to execute and the directory to start from. It also supports retries for connection establishment and an option to use the desktop for launching Creo. ### Method POST ### Endpoint /connection/start_creo ### Parameters #### Request Body - **path** (string) - Required - Path to the .bat file (must be full path). This will be split into 'start_command' and 'start_dir'. - **retries** (int) - Optional - Number of retries to make when connecting. Defaults to 0. - **use_desktop** (boolean) - Optional - Whether to use the desktop to start Creo rather than the java runtime. Should only be used if the runtime method doesn't work. Defaults to False. ### Response #### Success Response (200) None #### Error Handling Raises: Warning: error message from creoson. ``` -------------------------------- ### Start Creo Session Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/connection.html Starts a Creo session using a specified batch file. Allows configuration of retries and whether to use the desktop environment. Ensure the batch file path is absolute and correctly configured. ```python path_obj = Path(path) start_command = path_obj.name start_dir = str(path_obj.parents[0]) data = { "start_dir": start_dir, "start_command": start_command, "retries": retries, "use_desktop": use_desktop, } return self._creoson_post("connection", "start_creo", data) ``` -------------------------------- ### Creoson Response Data Example Source: https://creopyson.readthedocs.io/en/latest/_sources/usage.rst.txt Example of the data part of a Creoson response, typically returned after a command execution. ```json {"dirname": "C:/your/working/path/", "files": ["my_file.prt"], "revision": 1} ``` -------------------------------- ### start_creo Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/connection.html Executes an external batch file to start Creo and then attempts to connect to it. ```APIDOC ## start_creo ### Description Starts the Creo application by executing a specified batch file (e.g., `nitro_proe_remote.bat`). It then attempts to establish a connection. Connection retries are configurable, with pauses between attempts. If `retries` is 0, connection attempts are skipped. ### Method POST ### Endpoint /creoson ### Parameters #### Request Body - **sessionId** (string) - The current session ID. - **command** (string) - Must be "connection". - **function** (string) - Must be "start_creo". - **data** (object) - Contains parameters for starting Creo: - **path** (string) - Required. The path to the batch file used to start Creo. - **retries** (integer) - Optional. The number of connection retries after startup. Defaults to 0. - **use_desktop** (boolean) - Optional. Whether to use the desktop environment for starting Creo. Defaults to False. ### Request Example ```json { "sessionId": "your_unique_session_id", "command": "connection", "function": "start_creo", "data": { "path": "C:\\Path\\To\\nitro_proe_remote.bat", "retries": 3, "use_desktop": true } } ``` ### Response #### Success Response (200) - The response indicates successful execution of the start command. Connection status may be inferred from subsequent `is_creo_running` calls. #### Response Example ```json { "status": { "error": false, "message": "" } } ``` ``` -------------------------------- ### Launch Creo Source: https://creopyson.readthedocs.io/en/latest/_sources/usage.rst.txt Start the Creo application using the provided path to the remote batch file. ```python c.start_creo("path to nitro_proe_remote.bat") ``` -------------------------------- ### start_creo Source: https://creopyson.readthedocs.io/en/latest/creopyson.html Executes an external batch file to start Creo and then attempts to connect to it. This function provides control over the Creo startup process, including retries and desktop usage. ```APIDOC ## start_creo ### Description Execute an external .bat file to start Creo. Then attempts to connect to Creo. ### Method Not specified (assumed to be a function call within the creopyson client) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Args * **path** (string): path to the .bat file (must be full path) will be split in ‘start_command’ and ‘start_dir’. * **retries** (int, optional): Number of retries to make when connecting (default 0). * **use_desktop** (boolean, optional): Whether to use the desktop to start creo rather than the java runtime. Should only be used if the runtime method doesn’t work. Default is False. ### Raises * Warning: error message from creoson. ### Returns None ``` -------------------------------- ### creopyson.server.pwd Source: https://creopyson.readthedocs.io/en/latest/modules.html Gets the current working directory on the server. ```APIDOC ## creopyson.server.pwd ### Description Gets the current working directory on the server. ### Method Not specified (assumed to be a function call within the library). ### Endpoint Not applicable (SDK function). ### Parameters Not specified in the source text. ### Request Example ```python creopyson.server.pwd() ``` ### Response Not specified in the source text. ``` -------------------------------- ### list_ Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/file.html Gets a list of files in the current Creo session that match specified patterns. ```APIDOC ## list_ ### Description Gets a list of files in the current Creo session that match specified patterns. ### Method POST ### Endpoint /creoson/file/list ### Parameters #### Query Parameters - **file_** (str, optional) - The name of the file. Defaults to the currently active model. ``` -------------------------------- ### Get Parent Instances Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/familytable.html Retrieves a list of parent instance names for a given model in a nested family table. The list starts with the immediate parent and goes back to the root. ```python def get_parents(client, file_=None): """Get the parent instances of a model in a nested family table. Args: client (obj): creopyson Client. `file_` (str, optional): File name. Defaults is currently active model. Returns: (list:str): List of parent instance names, starting with the immediate parent and working back. """ data = {} if file_ is not None: data["file"] = file_ else: active_file = client.file_get_active() if active_file: data["file"] = active_file["file"] return client._creoson_post("familytable", "get_parents", data, "parents") ``` -------------------------------- ### Get File Information Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/file.html Opens file information for a specified model. Use this to retrieve the directory name, file name, and revision number of a Creo model. ```python def get_fileinfo(client, file_=None): """Open one or more files in memory or from the drive. Args: client (obj): creopyson Client. `file_` (str, optional): File name. Defaults is currently active model. Returns: (dict): dirname (str): Directory name of the file. file (str): File name. revision (int): Revision number of file. (Not availlable if the file is in Windchill) """ data = {} if file_ is not None: data["file"] = file_ else: active_file = client.file_get_active() if active_file: data["file"] = active_file["file"] return client._creoson_post("file", "get_fileinfo", data) ``` -------------------------------- ### List Creo Session Files Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/file.html Retrieves a list of files currently open in the Creo session that match specified patterns. Use this to get an overview of available models. ```python def list_(client, file_=None): """Get a list of files in the current Creo session that match patterns. Args: client (obj): creopyson Client. ``` -------------------------------- ### Initialize Creopyson Client Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/connection.html Instantiates a Client object to interact with the Creoson server. Defaults to localhost and port 9056 if not specified. ```python from creopyson.connection import Client client = Client(ip_adress="127.0.0.1", port=9056) ``` -------------------------------- ### Connect to Creoson Source: https://creopyson.readthedocs.io/en/latest/_sources/usage.rst.txt Create a Client object and establish a connection with the Creoson server. ```python c = creopyson.Client() c.connect() ``` -------------------------------- ### creopyson.familytable.get_header Source: https://creopyson.readthedocs.io/en/latest/creopyson.html Gets the header of a family table. ```APIDOC ## creopyson.familytable.get_header ### Description Gets the header of a family table. ### Method get_header ### Parameters #### Arguments - **client** (obj) - creopyson Client. - **file_** (str, optional) - File name. Defaults is currently active model. ### Returns (list:dict): colid (str): Column ID. value (depends on date type): Cell value. datatype (str): Data type. Valid values: STRING, DOUBLE, INTEGER, BOOL, NOTE. coltype (str): Column Type; a string corresponding to the Creo column type. ``` -------------------------------- ### connect Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/connection.html Establishes a connection to the CREOSON server and obtains a session ID. This is a crucial first step before executing other commands. ```APIDOC ## connect ### Description Connects to the CREOSON server and sets the `sessionId` attribute. If the server is not reachable, the connection will fail. ### Method POST ### Endpoint /creoson ### Parameters #### Request Body - **sessionId** (string) - The current session ID (empty for initial connection). - **command** (string) - Must be "connection". - **function** (string) - Must be "connect". - **data** (object) - Optional. No data is required for this function. ### Request Example ```json { "sessionId": "", "command": "connection", "function": "connect", "data": null } ``` ### Response #### Success Response (200) - **sessionId** (string) - The unique session ID for the established connection. #### Response Example ```json { "sessionId": "your_unique_session_id", "status": { "error": false, "message": "" } } ``` ``` -------------------------------- ### drawing_get_num_sheets Source: https://creopyson.readthedocs.io/en/latest/creopyson.html Gets the number of sheets on a drawing. ```APIDOC ## drawing_get_num_sheets ### Description Get the number of sheets on a drawing. ### Method (Not specified, assumed to be a function call) ### Parameters #### Path Parameters (None) #### Query Parameters (None) #### Request Body - **_drawing_** (str, optional) - Drawing name. Defaults: current active drawing. ### Request Example (Not specified) ### Response #### Success Response - **(int)** - Number of sheets. #### Response Example (Not specified) ``` -------------------------------- ### open_ Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/file.html Opens one or more files in memory or from the drive. Supports various options for display, activation, and window management. ```APIDOC ## open_ ### Description Open one or more files in memory or from the drive. ### Method POST ### Endpoint /api/v1/file/open ### Parameters #### Query Parameters - **file_** (str|list:str) - Required - File name or List of file names. - **dirname** (str) - Optional - Directory name. Defaults to Creo's current working directory. - **generic** (str) - Optional - Generic model name (if file name represents an instance). - **display** (bool) - Optional - Display the model after opening. Defaults to True. - **activate** (bool) - Optional - Activate the model after opening. Defaults to True. - **new_window** (bool) - Optional - Open model in a new window. Defaults to False. - **regen_force** (bool) - Optional - Force regeneration after opening. Defaults to False. ### Response #### Success Response (200) - **dirname** (str) - Directory name of opened file(s). - **files** (list:str) - File names that were opened. - **revision** (int) - Revision of file that was opened; if more than one file was opened, this field is not returned. ### Request Example ```json { "file": "my_part.prt", "dirname": "/path/to/models", "display": true, "activate": true, "new_window": false, "regen_force": false } ``` ### Response Example ```json { "dirname": "/path/to/models", "files": ["my_part.prt"], "revision": 1 } ``` ``` -------------------------------- ### drawing_get_cur_model Source: https://creopyson.readthedocs.io/en/latest/creopyson.html Gets the active model on a drawing. ```APIDOC ## drawing_get_cur_model ### Description Get the active model on a drawing. ### Method (Not specified, assumed to be a function call) ### Parameters #### Path Parameters (None) #### Query Parameters (None) #### Request Body - **_drawing_** (str, optional) - Drawing name. Defaults: current active drawing. ### Request Example (Not specified) ### Response #### Success Response - **(str)** - Model name. #### Response Example (Not specified) ``` -------------------------------- ### get_header Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/familytable.html Gets the header of a family table. ```APIDOC ## get_header ### Description Gets the header of a family table. ### Method POST ### Endpoint /creoson/familytable/get_header ### Parameters #### Request Body - **file_** (str, optional) - File name. Defaults to the currently active model. ### Response #### Success Response (200) - **colid** (str) - Column ID. - **value** (depends on date type) - Cell value. - **datatype** (str) - Data type. Valid values: STRING, DOUBLE, INTEGER, BOOL, NOTE. - **coltype** (str) - Column Type. ### Request Example ```json { "file_": "my_model.prt" } ``` ``` -------------------------------- ### creopyson.familytable.get_row Source: https://creopyson.readthedocs.io/en/latest/creopyson.html Gets one row of a family table. ```APIDOC ## creopyson.familytable.get_row ### Description Gets one row of a family table. ### Method get_row ### Parameters #### Arguments - **client** (obj) - creopyson Client. - **instance** (str) - Instance name. - **file_** (str, optional) - File name. Defaults is currently active model. ### Returns (dict): colid (str): Column ID. value (depends on datatype): Cell value. datatype (str): Data type. coltype (str): Column Type; a string corresponding to the Creo column type. ``` -------------------------------- ### Import Creopyson Source: https://creopyson.readthedocs.io/en/latest/_sources/usage.rst.txt Import the Creopyson library to begin using its functionalities. ```python import creopyson ``` -------------------------------- ### creopyson.familytable.get_cell Source: https://creopyson.readthedocs.io/en/latest/creopyson.html Gets one cell of a family table. ```APIDOC ## creopyson.familytable.get_cell ### Description Gets one cell of a family table. ### Method get_cell ### Parameters #### Arguments - **client** (obj) - creopyson Client. - **instance** (str) - Instance name. - **colid** (str) - Colimn ID. - **file_** (str, optional) - File name. Defaults is currently active model. ### Returns (dict): instance (str): Family Table instance name. colid (str): Column ID. value (depends on datatype): Cell value. datatype (str): Data type. coltype (str): Column Type; a string corresponding to the Creo column type. ``` -------------------------------- ### Connect to Creoson Server Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/connection.html Establishes a connection to the Creoson server and retrieves a session ID. Raises ConnectionError if the server is unreachable. ```python client.connect() ``` -------------------------------- ### Deploy Creopyson to PyPI Source: https://creopyson.readthedocs.io/en/latest/contributing.html Maintainers can deploy new versions to PyPI by committing changes, updating the version using bumpversion, tagging the release, and pushing tags. Travis CI handles the deployment if tests pass. ```bash bumpversion patch # possible: major / minor / patch git tag -a vx.x.x -m "my version vx.x.x" # add the tag manualy if you don't use git-flow git push --tags ``` -------------------------------- ### get_cell Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/familytable.html Gets one cell of a family table. ```APIDOC ## get_cell ### Description Gets one cell of a family table. ### Method POST ### Endpoint /creoson/familytable/get_cell ### Parameters #### Request Body - **instance** (str) - Required - Instance name. - **colid** (str) - Required - Column ID. - **file_** (str, optional) - File name. Defaults to the currently active model. ### Response #### Success Response (200) - **instance** (str) - Family Table instance name. - **colid** (str) - Column ID. - **value** (depends on datatype) - Cell value. - **datatype** (str) - Data type. - **coltype** (str) - Column Type; a string corresponding to the Creo column type. ### Request Example ```json { "instance": "instance_name", "colid": "column_id", "file_": "my_model.prt" } ``` ``` -------------------------------- ### Clone Creopyson Repository Source: https://creopyson.readthedocs.io/en/latest/contributing.html Clone your forked Creopyson repository to your local machine to begin development. ```bash $ git clone git@github.com:your_name_here/creopyson.git ``` -------------------------------- ### creopyson.familytable.list_tree Source: https://creopyson.readthedocs.io/en/latest/creopyson.html Gets a hierarchical structure of a nested family table. ```APIDOC ## creopyson.familytable.list_tree ### Description Gets a hierarchical structure of a nested family table. ### Method list_tree ### Parameters #### Arguments - **client** (obj) - creopyson Client. - **file_** (str, optional) - File name. Defaults is currently active model. - **erase** (boolean, optional) - Erase model and non-displayed models afterwards. Defaults is False. ### Returns (list:str): List of child instances total (int): Count of all child instances including their decendants. children (list:dict): name (str): Name of the family table instance. total (int): Count of all child instances including their decendants. children (list:dict): List of child instances. ``` -------------------------------- ### mkdir Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/creo.html Creates a new directory within Creo's file system. ```APIDOC ## mkdir ### Description Create a new directory. ### Method `mkdir(client, dirname)` ### Parameters - **client** (obj) - creopyson Client. - **dirname** (str) - New directory name. ### Returns - (str): Full name of new working directory. ``` -------------------------------- ### file_get_transform Source: https://creopyson.readthedocs.io/en/latest/creopyson.html Gets the 3D transform for a component within an assembly. ```APIDOC ## file_get_transform ### Description Get the 3D transform for a component in an assembly. ### Parameters - **client** (obj): creopyson Client. - **asm** (str, optional): Assembly name. Defaults to currently active model. - **path** (list:int, optional): Path to a component in the assembly. Defaults to the transform for the assembly itself. - **csys** (str, optional): Coordinate system on the component to calculate the transform for. Defaults to the component’s default coordinate system. ### Returns - (obj:JLTransform): The 3D transform from the assembly to the component’s coordinate system. ``` -------------------------------- ### get_mass_units Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/file.html Gets the current mass units for a specified model. ```APIDOC ## get_mass_units ### Description Gets the current mass units for a specified model. ### Method POST ### Endpoint /creoson/file/get_mass_units ### Parameters #### Query Parameters - **file_** (str, optional) - The name of the file. Defaults to the currently active model. ### Response #### Success Response (200) - **units** (str) - Mass units. ``` -------------------------------- ### List Materials with Wildcard Matching Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/file.html Lists materials on parts, supporting wildcard matching for material names and an option to include parts that do not match the material pattern. Defaults to the active model if no file is specified. ```python def list_materials_wildcard( client, file_=None, material=None, include_non_matching_parts=False ): """List materials on a part or parts. Args: client (obj): creopyson Client. `file_` (str, optional): File name. Defaults is currently active model. material (str, optional): Material name pattern. Wildcards allowed. Defaults to None is all materials. include_non_matching_parts (bool, optional): Whether to include parts that match the part name pattern but don't have any materials matching the material pattern. Defaults to False. Returns: list: A list of part and material pairs. If a part has more than one material, it will have multiple entries in this array. """ data = {} if file_ is not None: data["file"] = file_ else: active_file = client.file_get_active() if active_file: data["file"] = active_file["file"] if material is not None: data["material"] = material if include_non_matching_parts is not None: data["include_non_matching_parts"] = include_non_matching_parts return client._creoson_post("file", "list_materials_wildcard", data, "materials") ``` -------------------------------- ### get_length_units Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/file.html Gets the current length units for a specified model. ```APIDOC ## get_length_units ### Description Gets the current length units for a specified model. ### Method POST ### Endpoint /creoson/file/get_length_units ### Parameters #### Query Parameters - **file_** (str, optional) - The name of the file. Defaults to the currently active model. ### Response #### Success Response (200) - **units** (str) - Length units. ``` -------------------------------- ### creopyson.windchill.create_workspace Source: https://creopyson.readthedocs.io/en/latest/modules.html Creates a new Windchill workspace. ```APIDOC ## creopyson.windchill.create_workspace ### Description Creates a new Windchill workspace. ### Method Not specified (assumed to be a function call within the library). ### Endpoint Not applicable (SDK function). ### Parameters Not specified in the source text. ### Request Example ```python creopyson.windchill.create_workspace() ``` ### Response Not specified in the source text. ``` -------------------------------- ### creopyson.familytable.get_parents Source: https://creopyson.readthedocs.io/en/latest/creopyson.html Gets the parent instances of a model in a nested family table. ```APIDOC ## creopyson.familytable.get_parents ### Description Gets the parent instances of a model in a nested family table. ### Method get_parents ### Parameters #### Arguments - **client** (obj) - creopyson Client. - **file_** (str, optional) - File name. Defaults is currently active model. ### Returns (list:str): List of parent instance names, starting with the immediate parent and working back. ``` -------------------------------- ### creopyson.view.list_ Source: https://creopyson.readthedocs.io/en/latest/modules.html Lists all available views. ```APIDOC ## creopyson.view.list_ ### Description Lists all available views. ### Method Not specified (assumed to be a function call within the library). ### Endpoint Not applicable (SDK function). ### Parameters Not specified in the source text. ### Request Example ```python creopyson.view.list_() ``` ### Response Not specified in the source text. ``` -------------------------------- ### drawing_get_sheet_format Source: https://creopyson.readthedocs.io/en/latest/creopyson.html Gets the drawing format file of a specified drawing sheet. ```APIDOC ## drawing_get_sheet_format ### Description Get the drawing format file of drawing sheet. ### Method (Not specified, assumed to be a function call) ### Parameters #### Path Parameters (None) #### Query Parameters (None) #### Request Body - **_sheet_** (int) - Required - Sheet number. - **_drawing_** (str, optional) - Drawing name. ### Request Example (Not specified) ### Response #### Success Response (Type and description not specified in source) #### Response Example (Not specified) ``` -------------------------------- ### creopyson.parameter.list_ Source: https://creopyson.readthedocs.io/en/latest/modules.html Lists all available parameters. ```APIDOC ## creopyson.parameter.list_ ### Description Lists all available parameters. ### Method Not specified (assumed to be a function call within the library). ### Endpoint Not applicable (SDK function). ### Parameters Not specified in the source text. ### Request Example ```python creopyson.parameter.list_() ``` ### Response Not specified in the source text. ``` -------------------------------- ### creopyson.file.assemble Source: https://creopyson.readthedocs.io/en/latest/creopyson.html Assembles a component into an assembly with various options for placement, constraints, and packaging. ```APIDOC ## creopyson.file.assemble ### Description Assemble a component into an assembly. ### Parameters * **client** (obj): creopyson Client. * **file_** (str): File name component. * **dirname** (str, optional): Diretory name. Defaults is Creo’s current working directory. * **generic** (str, optional): Generic model name (if file name represents an instance). Defaults is generic model name (if file name represents an instance). * **into_asm** (str, optional): Target assembly. Defaults is currently active model. * **path** (list:int, optional): Path to a component that the new part will be constrained to. Defaults to None. * **ref_model** (str, optional): Reference model that the new part will be constrained to; only used if path is not given. If there are multiple of this model in the assembly, the component will be assembled multiple times, once to each occurrence. Defaults to None. * **transform** (obj:JLTransform, optional): Transform structure for the initial position and orientation of the new component; only used if there are no constraints, or for certain constraint types. Defaults to None. * **constraints** (obj_array:JLConstraint, optional): Assembly constraints. Defaults to None. * **package_assembly** (bool, optional): Whether to package the component to the assembly; only used if there are no constraints specified. Defaults is If there are no constraints, then the user will be prompted to constrain the component through the Creo user interface. * **walk_children** (bool, optional): Whether to walk into subassemblies to find reference models to constrain to. Defaults to None. * **assemble_to_root** (bool, optional): Whether to always assemble to the root assembly, or assemble to the subassembly containing the reference path/model. Defaults to None. * **suppress** (bool, optional): Whether to suppress the components immediately after assembling them. Defaults to None. ### Returns * **dict**: * **dirname** (str): Directory name of component. * **files** (list:str): File name of component. * **revision** (int): Revision of file that was opened; if more than one file was opened, this field is not returned. * **featureid** (int): Last Feature ID of component after assembly. ``` -------------------------------- ### drawing_get_view_sheet Source: https://creopyson.readthedocs.io/en/latest/genindex.html Gets the sheet of a view in a drawing. This method is part of the creopyson.connection.Client. ```APIDOC ## drawing_get_view_sheet ### Description Gets the sheet of a view in a drawing. ### Method creopyson.connection.Client method ### Endpoint Not applicable (SDK method) ### Parameters None explicitly documented. ### Request Example None provided. ### Response None explicitly documented. ``` -------------------------------- ### drawing_get_view_scale Source: https://creopyson.readthedocs.io/en/latest/genindex.html Gets the scale of a view in a drawing. This method is part of the creopyson.connection.Client. ```APIDOC ## drawing_get_view_scale ### Description Gets the scale of a view in a drawing. ### Method creopyson.connection.Client method ### Endpoint Not applicable (SDK method) ### Parameters None explicitly documented. ### Request Example None provided. ### Response None explicitly documented. ``` -------------------------------- ### creopyson.file.open_ Source: https://creopyson.readthedocs.io/en/latest/creopyson.html Opens one or more Creo files, either in memory or from the drive. Options include specifying the directory, generic model, display, activation, new window, and regeneration force. ```APIDOC ## creopyson.file.open_ ### Description Open one or more files in memory or from the drive. note: if you open more than one file, it will only put file in your session you won’t be able to display more than one file at once. ### Parameters #### Path Parameters None #### Query Parameters * **file_** (str|list:str) - File name or List of file names; * **dirname** (str, optional) - Directory name. Defaults is Creo’s current working directory. * **generic** (str, optional) - Generic model name (if file name represents an instance). Defaults to None. * **display** (bool, optional) - Display the model after opening. Defaults is True. * **activate** (bool, optional) - Activate the model after opening. Defaults is True. * **new_window** (bool, optional) - Open model in a new window. Defaults is False. * **regen_force** (bool, optional) - Force regeneration after opening. Defaults is False. ### Returns * **dict**: * **dirname** (str): Directory name of opened file(s). * **files** (list:str): File names that were opened. * **revision** (int): Revision of file that was opened; if more than one file was opened, this field is not returned. ``` -------------------------------- ### List Instances in a Model's Family Table Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/file.html Lists instances within a model's family table. If no file is specified, it defaults to the currently active model. ```python def list_instances(client, file_=None): """List instances in a model's family table. Args: client (obj): creopyson Client. `file_` (str, optional): File name. Defaults is currently active model. Returns: (dict): dirname (str): Directory name of the file. generic (str): Generic name. files (list:str): List of model names in the table. """ data = {} if file_ is not None: data["file"] = file_ else: active_file = client.file_get_active() if active_file: data["file"] = active_file["file"] return client._creoson_post("file", "list_instances", data) ``` -------------------------------- ### drawing_get_view_loc Source: https://creopyson.readthedocs.io/en/latest/genindex.html Gets the location of a view in a drawing. This method is part of the creopyson.connection.Client. ```APIDOC ## drawing_get_view_loc ### Description Gets the location of a view in a drawing. ### Method creopyson.connection.Client method ### Endpoint Not applicable (SDK method) ### Parameters None explicitly documented. ### Request Example None provided. ### Response None explicitly documented. ``` -------------------------------- ### drawing_get_sheet_size Source: https://creopyson.readthedocs.io/en/latest/genindex.html Gets the size of a drawing sheet. This method is part of the creopyson.connection.Client. ```APIDOC ## drawing_get_sheet_size ### Description Gets the size of a drawing sheet. ### Method creopyson.connection.Client method ### Endpoint Not applicable (SDK method) ### Parameters None explicitly documented. ### Request Example None provided. ### Response None explicitly documented. ``` -------------------------------- ### creopyson.file.display Source: https://creopyson.readthedocs.io/en/latest/creopyson.html Displays a Creo model in a window, with an option to activate it. ```APIDOC ## creopyson.file.display ### Description Display a model in a window. ### Parameters * **client** (obj): creopyson object. * **file_** (str): File name * **activate** (bool, optional): Activate the model after displaying. Defaults is True. ### Returns None ``` -------------------------------- ### create Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/drawing.html Creates a new drawing from a specified template. Various options are available to configure the new drawing. ```APIDOC ## create ### Description Creates a new drawing from a template. ### Method POST ### Endpoint /creopyson/drawing/create ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **client** (obj) - Required - creopyson Client. - **template** (str) - Required - Template name. - **model** (str, optional) - Model name. Defaults: Current active model. - **drawing** (str, optional) - New drawing name. Defaults: A name derived from the model's instance name. - **scale** (float, optional) - Drawing scale. Defaults is `1.0`. - **display** (boolean, optional) - Display the drawing after open. Defaults is False. - **activate** (boolean, optional) - Activate the drawing window after open. Defaults is False. - **new_window** (boolean, optional) - Open drawing in a new window. Defaults is False. ### Request Example ```json { "client": "creopyson_client_object", "template": "MyTemplate", "model": "MyModel", "drawing": "NewDrawingName", "scale": 0.5, "display": true, "activate": true, "new_window": true } ``` ### Response #### Success Response (200) - **drawing** (str) - New drawing name. #### Response Example ```json { "drawing": "NewDrawingName" } ``` ``` -------------------------------- ### drawing_get_sheet_scale Source: https://creopyson.readthedocs.io/en/latest/genindex.html Gets the scale of a drawing sheet. This method is part of the creopyson.connection.Client. ```APIDOC ## drawing_get_sheet_scale ### Description Gets the scale of a drawing sheet. ### Method creopyson.connection.Client method ### Endpoint Not applicable (SDK method) ### Parameters None explicitly documented. ### Request Example None provided. ### Response None explicitly documented. ``` -------------------------------- ### add_inst Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/familytable.html Adds a new instance to a family table. Creates a family table if one does not exist. ```APIDOC ## add_inst ### Description Adds a new instance to a family table. Creates a family table if one does not exist. ### Method POST ### Endpoint /creoson/familytable/add_inst ### Parameters #### Request Body - **instance** (str) - Required - New instance name. - **file_** (str, optional) - File name. Defaults to the currently active model. ### Response #### Success Response (200) None ### Request Example ```json { "instance": "new_instance_name", "file_": "my_model.prt" } ``` ``` -------------------------------- ### drawing_get_sheet_format Source: https://creopyson.readthedocs.io/en/latest/genindex.html Gets the format of a drawing sheet. This method is part of the creopyson.connection.Client. ```APIDOC ## drawing_get_sheet_format ### Description Gets the format of a drawing sheet. ### Method creopyson.connection.Client method ### Endpoint Not applicable (SDK method) ### Parameters None explicitly documented. ### Request Example None provided. ### Response None explicitly documented. ``` -------------------------------- ### drawing_get_num_sheets Source: https://creopyson.readthedocs.io/en/latest/genindex.html Gets the number of sheets in a drawing. This method is part of the creopyson.connection.Client. ```APIDOC ## drawing_get_num_sheets ### Description Gets the number of sheets in a drawing. ### Method creopyson.connection.Client method ### Endpoint Not applicable (SDK method) ### Parameters None explicitly documented. ### Request Example None provided. ### Response None explicitly documented. ``` -------------------------------- ### creopyson.layer.list_ Source: https://creopyson.readthedocs.io/en/latest/modules.html Lists all available layers. ```APIDOC ## creopyson.layer.list_ ### Description Lists all available layers. ### Method Not specified (assumed to be a function call within the library). ### Endpoint Not applicable (SDK function). ### Parameters Not specified in the source text. ### Request Example ```python creopyson.layer.list_() ``` ### Response Not specified in the source text. ``` -------------------------------- ### drawing_get_cur_sheet Source: https://creopyson.readthedocs.io/en/latest/genindex.html Gets the current sheet in a drawing. This method is part of the creopyson.connection.Client. ```APIDOC ## drawing_get_cur_sheet ### Description Gets the current sheet in a drawing. ### Method creopyson.connection.Client method ### Endpoint Not applicable (SDK method) ### Parameters None explicitly documented. ### Request Example None provided. ### Response None explicitly documented. ``` -------------------------------- ### file_open Source: https://creopyson.readthedocs.io/en/latest/creopyson.html Opens one or more files in memory or from the drive. Options include displaying, activating, opening in a new window, and forcing regeneration. ```APIDOC ## file_open ### Description Open one or more files in memory or from the drive. note: if you open more than one file, it will only put file in your session you won’t be able to display more than one file at once. ### Arguments * `client` (obj): creopyson Client. * `file_` (str|list:str): File name or List of file names; * `dirname` (str, optional): Directory name. Defaults is Creo’s current working directory. * `generic` (str, optional): Generic model name (if file name represents an instance). Defaults to None. * `display` (bool, optional): Display the model after opening. Defaults is True. * `activate` (bool, optional): Activate the model after opening. Defaults is True. * `new_window` (bool, optional): Open model in a new window. Defaults is False. * `regen_force` (bool, optional): Force regeneration after opening. Defaults is False. ``` -------------------------------- ### drawing_get_cur_model Source: https://creopyson.readthedocs.io/en/latest/genindex.html Gets the current model in a drawing. This method is part of the creopyson.connection.Client. ```APIDOC ## drawing_get_cur_model ### Description Gets the current model in a drawing. ### Method creopyson.connection.Client method ### Endpoint Not applicable (SDK method) ### Parameters None explicitly documented. ### Request Example None provided. ### Response None explicitly documented. ``` -------------------------------- ### Create Windchill Workspace Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/windchill.html Creates a new workspace on the active Windchill server. Requires the workspace name and context name. ```python def create_workspace(client, workspace, context_name): """Create a workspace on the active server. Args: client (obj): creopyson Client workspace (str): Workspace name context_name (str): Context name Returns: None """ data = {"workspace": workspace, "context": context_name} return client._creoson_post("windchill", "create_workspace", data) ``` -------------------------------- ### activate Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/view.html Activates a specified model view. If a file is not provided, it defaults to the currently active model. ```APIDOC ## activate ### Description Activates a model view. ### Method POST ### Endpoint /view/activate ### Parameters #### Request Body - **name** (str) - Required - View name. - **file_** (str) - Optional - Model name. Defaults to the current active model. ``` -------------------------------- ### drawing_view_bound_box Source: https://creopyson.readthedocs.io/en/latest/genindex.html Gets the bounding box of a view in a drawing. This method is part of the creopyson.connection.Client. ```APIDOC ## drawing_view_bound_box ### Description Gets the bounding box of a view in a drawing. ### Method creopyson.connection.Client method ### Endpoint Not applicable (SDK method) ### Parameters None explicitly documented. ### Request Example None provided. ### Response None explicitly documented. ``` -------------------------------- ### file_get_cur_material_wildcard Source: https://creopyson.readthedocs.io/en/latest/creopyson.html Gets the current material for a part or parts, supporting wildcards in the part name. ```APIDOC ## file_get_cur_material_wildcard ### Description Get the current material for a part or parts, allowing wildcards on the part name. ### Parameters - **client** (obj): creopyson Client. - **file_** (str, optional): Part name. Defaults to None (current active model). - **include_non_matching_parts** (bool, optional): Whether to include parts that match the part name pattern but don’t have a current material. Defaults to False. ### Returns - list: A list of part and current-material pairs. ``` -------------------------------- ### assemble Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/file.html Assembles a component into an assembly with various options for placement and constraints. ```APIDOC ## assemble ### Description Assembles a component into an assembly. ### Method POST ### Endpoint /creoson/file/assemble ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **file_** (str) - Required - File name component. - **dirname** (str) - Optional - Directory name. Defaults is Creo's current working directory. - **generic** (str) - Optional - Generic model name (if file name represents an instance). - **into_asm** (str) - Optional - Target assembly. Defaults is currently active model. - **path** (list[int]) - Optional - Path to a component that the new part will be constrained to. - **ref_model** (str) - Optional - Reference model that the new part will be constrained to; only used if path is not given. - **transform** (obj:JLTransform) - Optional - Transform structure for the initial position and orientation of the new component. - **constraints** (obj_array:JLConstraint) - Optional - Assembly constraints. - **package_assembly** (bool) - Optional - Whether to package the component to the assembly; only used if there are no constraints specified. - **walk_children** (bool) - Optional - Whether to walk into subassemblies to find reference models to constrain to. - **assemble_to_root** (bool) - Optional - Whether to always assemble to the root assembly, or assemble to the subassembly containing the reference path/model. - **suppress** (bool) - Optional - Whether to suppress the components immediately after assembling them. ### Request Example ```json { "file": "my_component.prt", "dirname": "models", "into_asm": "my_assembly.asm", "constraints": [ { "type": "distance", "ref1": "BOTTOM_FACE", "ref2": "TOP_FACE", "distance": 100 } ] } ``` ### Response #### Success Response (200) - **dirname** (str) - Directory name of component. - **files** (list[str]) - File name of component. - **revision** (int) - Revision of file that was opened. - **featureid** (int) - Last Feature ID of component after assembly. #### Response Example ```json { "dirname": "models", "files": ["my_component.prt"], "revision": 1, "featureid": 12345 } ``` ``` -------------------------------- ### list_instances Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/file.html Lists instances in a model's family table. It can target a specific file or default to the currently active model. ```APIDOC ## POST /api/v1/file/list_instances ### Description Lists instances in a model's family table. It can target a specific file or default to the currently active model. ### Method POST ### Endpoint /api/v1/file/list_instances ### Parameters #### Request Body - **file_** (str, optional) - File name. Defaults is currently active model. ### Response #### Success Response (200) - **dirname** (str) - Directory name of the file. - **generic** (str) - Generic name. - **files** (list:str) - List of model names in the table. ``` -------------------------------- ### get_cur_material_wildcard Source: https://creopyson.readthedocs.io/en/latest/_modules/creopyson/file.html Gets the current material for a part or parts, allowing wildcards in the part name. ```APIDOC ## get_cur_material_wildcard ### Description Gets the current material for a part or parts, allowing wildcards in the part name. ### Method POST ### Endpoint /creopyson/file/get_cur_material_wildcard ### Parameters #### Request Body - **file** (str) - Optional - Part name. Wildcards are allowed. Defaults to the current active model. - **include_non_matching_parts** (bool) - Optional - Whether to include parts that do not match the wildcard pattern. Defaults to False. ```