### steputils.p21.reference Source: https://steputils.readthedocs.io/en/latest/p21.html Factory function to create a new Reference object (Entity Instance Name). A reference has to start with '#' followed by only digits e.g. '#100' ```APIDOC ## steputils.p21.reference ### Description Factory function to create a new `Reference` object (Entity Instance Name). A reference has to start with `'#'` followed by only digits e.g. `'#100'`. ### Method Factory Function ### Endpoint N/A ### Parameters #### Path Parameters - **ref** (str) - Required - reference string. ### Response - **Reference**: A new Reference object. ``` -------------------------------- ### steputils.p21.keyword Source: https://steputils.readthedocs.io/en/latest/p21.html Factory function to create a new Keyword object. Only uppercase letters and digits are allowed, standard keyword has to start with an uppercase letter and user-defined keyword has to start with '!' ```APIDOC ## steputils.p21.keyword ### Description Factory function to create a new `Keyword` object. Only uppercase letters and digits are allowed, standard keyword has to start with an uppercase letter and user-defined keyword has to start with `'!'`. ### Method Factory Function ### Endpoint N/A ### Parameters #### Path Parameters - **name** (str) - Required - keyword name. ### Response - **Keyword**: A new Keyword object. ``` -------------------------------- ### Create and Save a New STEP-file Source: https://steputils.readthedocs.io/en/latest/p21.html Demonstrates the process of creating a new STEP-file, adding data and header information, and saving it to the file system. Ensure the 'p21' module is imported. ```python from steputils import p21 FNAME = "example.p21" # Create a new STEP-file: stepfile = p21.new_step_file() # Create a new data section: data = stepfile.new_data_section() # Add entity instances to data section: data.add(p21.simple_instance('#1', name='APPLICATION', params=('MyApp', 'v1.0'))) # Set required header entities: stepfile.header.set_file_description(('Example STEP file', 'v1.0')) stepfile.header.set_file_name(name=FNAME, organization=('me', 'myself'), autorization='me') stepfile.header.set_file_schema(('NONE',)) # Write STEP-file to file system: stepfile.save(FNAME) ``` -------------------------------- ### steputils.p21.loads Source: https://steputils.readthedocs.io/en/latest/p21.html Loads a STEP-file (ISO 10303-21) from a unicode string. ```APIDOC ## steputils.p21.loads ### Description Loads a STEP-file (ISO 10303-21) from a unicode string. Decoding for special characters > 126 to unicode characters according to ISO 10303-21 standard will be applied. ### Method loads ### Parameters #### Path Parameters - **s** (str) - Required - The STEP-file content as a unicode string. ``` -------------------------------- ### Read and Validate an Existing STEP-file Source: https://steputils.readthedocs.io/en/latest/p21.html Shows how to read an existing STEP-file from the file system and includes error handling for potential IOErrors or ParseErrors if the file is invalid. The 'p21' module must be imported. ```python from steputils import p21 from steputils.p21 import ParseError FNAME = "example.p21" # Read an existing file from file system: try: stepfile = p21.readfile(FNAME) except IOError as e: print(str(e)) except ParseError as e: # Invalid STEP-file print(str(e)) else: print(f'File {FNAME} is a valid STEP-file') ``` -------------------------------- ### steputils.p21.load Source: https://steputils.readthedocs.io/en/latest/p21.html Loads a STEP-file (ISO 10303-21) from a text stream. ```APIDOC ## steputils.p21.load ### Description Loads a STEP-file (ISO 10303-21) from a text stream. Special encoding for characters > 126 is applied, and decoding to Unicode characters will be performed. ### Method load ### Parameters #### Path Parameters - **fp** (TextIO) - Required - The STEP-file content as a text stream yielding unicode strings. ``` -------------------------------- ### steputils.p21.new_step_file Source: https://steputils.readthedocs.io/en/latest/p21.html Factory function to create a new StepFile object. ```APIDOC ## steputils.p21.new_step_file ### Description Factory function to create a new `StepFile` object. ### Method Factory Function ### Endpoint N/A ### Parameters None ### Response - **StepFile**: A new StepFile object. ``` -------------------------------- ### StepFile.get Source: https://steputils.readthedocs.io/en/latest/p21.html Safely retrieves an EntityInstance by its reference name, returning None if not found. Searches all data sections. ```APIDOC ## StepFile.get ### Description Returns `EntityInstance` by instance name ref or `None` if not found. Searches all data sections if more than one exist. ### Method `get` ### Parameters #### Path Parameters - **ref** (Reference) - Required - entity instance name as string e.g. `'#100'` ``` -------------------------------- ### steputils.p21.parameter_list Source: https://steputils.readthedocs.io/en/latest/p21.html Factory function to create a new ParameterList object. ```APIDOC ## steputils.p21.parameter_list ### Description Factory function to create a new `ParameterList` object. ### Method Factory Function ### Endpoint N/A ### Parameters #### Path Parameters - **args** (*) - Required - arguments for the parameter list. ### Response - **ParameterList**: A new ParameterList object. ``` -------------------------------- ### StepFile.write Source: https://steputils.readthedocs.io/en/latest/p21.html Serializes the StepFile to a stream in ISO 10303-21 format. ```APIDOC ## StepFile.write ### Description Serialize to a STEP-file (ISO 10303-21) formatted stream to `fp` (a `write()`-supporting file-like object). File encoding should be `'iso-8859-1'` but can also be `'ascii'`, because ISO 10303-21 requires special encoding for characters > 126 into characters < 127 as unicode compatible characters, which should be compatible with most encodings, but don’t use 16-bit encodings! ### Method `write` ### Parameters #### Request Body - **fp** (TextIO) - Required - The text stream to write to. ``` -------------------------------- ### steputils.p21.simple_entity_instance Source: https://steputils.readthedocs.io/en/latest/p21.html Factory function to create a new SimpleEntityInstance object. ```APIDOC ## steputils.p21.simple_entity_instance ### Description Factory function to create a new `SimpleEntityInstance` object. ### Method Factory Function ### Endpoint N/A ### Parameters #### Path Parameters - **ref** (str or Reference) - Required - instance reference. - **entity** (Entity) - Required - entity object. ### Response - **SimpleEntityInstance**: A new SimpleEntityInstance object. ``` -------------------------------- ### StepFile.save Source: https://steputils.readthedocs.io/en/latest/p21.html Exports the StepFile to the file system with the specified filename. ```APIDOC ## StepFile.save ### Description Export STEP-file to the file system. ### Method `save` ### Parameters #### Path Parameters - **name** (str) - Required - The filename to save the STEP-file as. ``` -------------------------------- ### StepFile.__getitem__ Source: https://steputils.readthedocs.io/en/latest/p21.html Retrieves an EntityInstance by its reference name from any data section within the StepFile. ```APIDOC ## StepFile.__getitem__ ### Description Returns an `EntityInstance` by instance name reference. Searches all data sections if more than one exist. ### Method `__getitem__` ### Parameters #### Path Parameters - **ref** (Reference) - Required - entity instance name as string e.g. `'#100'` ### Raises - `KeyError` – instance id not found ``` -------------------------------- ### steputils.p21.readfile Source: https://steputils.readthedocs.io/en/latest/p21.html Reads a STEP-file (ISO 10303-21) from the file system. ```APIDOC ## steputils.p21.readfile ### Description Reads a STEP-file (ISO 10303-21) from the file system. ### Method readfile ### Parameters #### Path Parameters - **filename** (str) - Required - The path to the STEP-file to read. ``` -------------------------------- ### StepFile.__str__ Source: https://steputils.readthedocs.io/en/latest/p21.html Serializes the StepFile object into a string formatted according to the ISO 10303-21 standard. ```APIDOC ## StepFile.__str__ ### Description Serialize to a STEP-file (ISO 10303-21) formatted `str`. Special encoding for characters > 126 into characters < 127 as unicode compatible characters according to ISO 10303-21 standard will be applied. ### Method `__str__` ``` -------------------------------- ### StepFile.new_data_section Source: https://steputils.readthedocs.io/en/latest/p21.html Creates and appends a new DataSection to the StepFile. ```APIDOC ## StepFile.new_data_section ### Description Create a new `DataSection` and append to existing data sections. ### Method `new_data_section` ### Parameters #### Request Body - **params** (Iterable) - Optional - Parameters for the new data section. ``` -------------------------------- ### steputils.p21.simple_instance Source: https://steputils.readthedocs.io/en/latest/p21.html Factory function to create a new SimpleEntityInstance object. This method creates the Entity object automatically. ```APIDOC ## steputils.p21.simple_instance ### Description Factory function to create a new `SimpleEntityInstance` object. This method creates the `Entity` object automatically. ### Method Factory Function ### Endpoint N/A ### Parameters #### Path Parameters - **ref** (str or Reference) - Required - instance reference. - **name** (str or Keyword) - Required - entity name. - **params** (tuple, list, or ParameterList) - Required - entity parameters. ### Response - **SimpleEntityInstance**: A new SimpleEntityInstance object. ``` -------------------------------- ### StepFile.append Source: https://steputils.readthedocs.io/en/latest/p21.html Appends an existing DataSection to the StepFile. ```APIDOC ## StepFile.append ### Description Append new data section data. ### Method `append` ### Parameters #### Request Body - **data** (DataSection) - Required - The data section to append. ``` -------------------------------- ### steputils.p21.entity Source: https://steputils.readthedocs.io/en/latest/p21.html Factory function to create a new Entity object. ```APIDOC ## steputils.p21.entity ### Description Factory function to create a new `Entity` object. ### Method Factory Function ### Endpoint N/A ### Parameters #### Path Parameters - **name** (str or Keyword) - Required - entity name. - **params** (tuple, list, or ParameterList) - Required - entity parameters. ### Response - **Entity**: A new Entity object. ``` -------------------------------- ### steputils.p21.binary Source: https://steputils.readthedocs.io/en/latest/p21.html Factory function to create a new Binary object. Only for export used, unset specifies the uppermost unset bits. ```APIDOC ## steputils.p21.binary ### Description Factory function to create a new `Binary` object. Only for export used, unset specifies the uppermost unset bits. ### Method Factory Function ### Endpoint N/A ### Parameters #### Path Parameters - **value** (int) - Required - the binary value. - **unset** (int) - Optional - the uppermost unset bits. ### Response - **Binary**: A new Binary object. ``` -------------------------------- ### DataSection Methods Source: https://steputils.readthedocs.io/en/latest/p21.html This section details the methods available for interacting with DataSection objects, including accessing parameters, instances, and managing entity instances. ```APIDOC ## DataSection Methods ### Description Provides methods to access and manage data within a STEP file's data section, including parameters, entity instances, and their references. ### Methods - **`parameter`** - Description: Accesses associated parameters for the data section. - **`instances`** - Description: Provides an ordered dictionary of all entity instances within this data section. Keys are instance names (e.g., '#100'), and values are `EntityInstance` objects. - **`__getitem__(ref: str) -> EntityInstance`** - Description: Returns an `EntityInstance` by its reference string. Raises `KeyError` if the instance is not found. - **`__iter__() -> Iterable[EntityInstance]`** - Description: Returns an iterable of all `EntityInstance` objects in this data section. - **`get(ref: str) -> Optional[EntityInstance]`** - Description: Returns an `EntityInstance` by its reference string, or `None` if not found. - **`__len__() -> int`** - Description: Returns the total count of entity instances in the data section. - **`references() -> Iterable[Reference]`** - Description: Returns an iterable of all entity instance names (references) within the data section. - **`add(instance: EntityInstance) -> None`** - Description: Appends a new entity instance to the data section. If an instance with the same name already exists, it will be replaced. - Parameters: - **instance** (`EntityInstance`) - The entity instance to add. ``` -------------------------------- ### steputils.p21.timestamp Source: https://steputils.readthedocs.io/en/latest/p21.html Factory function returns an ISO formatted UTC timestamp. ```APIDOC ## steputils.p21.timestamp ### Description Factory function returns an ISO formatted UTC timestamp. ### Method Factory Function ### Endpoint N/A ### Parameters None ### Response - **str**: An ISO formatted UTC timestamp string. ``` -------------------------------- ### StepFile.__len__ Source: https://steputils.readthedocs.io/en/latest/p21.html Returns the total count of all stored entity instances within the StepFile. ```APIDOC ## StepFile.__len__ ### Description Returns count of all stored entity instances. ### Method `__len__` ``` -------------------------------- ### steputils.p21.complex_entity_instance Source: https://steputils.readthedocs.io/en/latest/p21.html Factory function to create a new ComplexEntityInstance object. ```APIDOC ## steputils.p21.complex_entity_instance ### Description Factory function to create a new `ComplexEntityInstance` object. ### Method Factory Function ### Endpoint N/A ### Parameters #### Path Parameters - **ref** (str or Reference) - Required - instance reference. - **entities** (List[Entity]) - Required - list of Entity objects. ### Response - **ComplexEntityInstance**: A new ComplexEntityInstance object. ``` -------------------------------- ### StepFile.__iter__ Source: https://steputils.readthedocs.io/en/latest/p21.html Returns an iterable of all entity instances across all data sections in the StepFile. ```APIDOC ## StepFile.__iter__ ### Description Returns an iterable of all instance entities of all data sections. ### Method `__iter__` ``` -------------------------------- ### steputils.p21.typed_parameter Source: https://steputils.readthedocs.io/en/latest/p21.html Factory function to create a new TypedParameter object. ```APIDOC ## steputils.p21.typed_parameter ### Description Factory function to create a new `TypedParameter` object. ### Method Factory Function ### Endpoint N/A ### Parameters #### Path Parameters - **type_name** (str or Keyword) - Required - type name. - **param** (*) - Required - typed parameter. ### Response - **TypedParameter**: A new TypedParameter object. ``` -------------------------------- ### steputils.p21.is_binary Source: https://steputils.readthedocs.io/en/latest/p21.html Returns True if e is a Binary. ```APIDOC ## steputils.p21.is_binary ### Description Returns `True` if e is a `Binary`. ### Method Type Checker Function ### Endpoint N/A ### Parameters #### Path Parameters - **e** (*) - Required - the element to check. ### Response - **bool**: `True` if e is a Binary object, `False` otherwise. ``` -------------------------------- ### steputils.p21.is_string Source: https://steputils.readthedocs.io/en/latest/p21.html Returns True if e is a str. ```APIDOC ## steputils.p21.is_string ### Description Returns `True` if e is a `str`. ### Method Type Checker Function ### Endpoint N/A ### Parameters #### Path Parameters - **e** (*) - Required - the element to check. ### Response - **bool**: `True` if e is a string, `False` otherwise. ``` -------------------------------- ### steputils.p21.is_keyword Source: https://steputils.readthedocs.io/en/latest/p21.html Returns True if e is a Keyword. ```APIDOC ## steputils.p21.is_keyword ### Description Returns `True` if e is a `Keyword`. ### Method Type Checker Function ### Endpoint N/A ### Parameters #### Path Parameters - **e** (*) - Required - the element to check. ### Response - **bool**: `True` if e is a Keyword object, `False` otherwise. ``` -------------------------------- ### StepFile.has_reference Source: https://steputils.readthedocs.io/en/latest/p21.html Checks if a given reference exists in any data section of the StepFile. ```APIDOC ## StepFile.has_reference ### Description Returns True if reference ref exist in any data section. ### Method `has_reference` ### Parameters #### Path Parameters - **ref** (str) - Required - The reference string to check for. ``` -------------------------------- ### steputils.p21.enum Source: https://steputils.readthedocs.io/en/latest/p21.html Factory function to create a new Enumeration object. A enumeration is surrounded '.' and only uppercase letters and digits are allowed e.g. '.TRUE.' or '.FALSE.' ```APIDOC ## steputils.p21.enum ### Description Factory function to create a new `Enumeration` object. A enumeration is surrounded `'.'` and only uppercase letters and digits are allowed e.g. `'.TRUE.'` or `'.FALSE.'`. ### Method Factory Function ### Endpoint N/A ### Parameters #### Path Parameters - **enum** (str) - Required - enumeration string. ### Response - **Enumeration**: A new Enumeration object. ``` -------------------------------- ### steputils.p21.is_reference Source: https://steputils.readthedocs.io/en/latest/p21.html Returns True if e is an EntityInstanceName. ```APIDOC ## steputils.p21.is_reference ### Description Returns `True` if e is an `EntityInstanceName`. ### Method Type Checker Function ### Endpoint N/A ### Parameters #### Path Parameters - **e** (*) - Required - the element to check. ### Response - **bool**: `True` if e is a reference, `False` otherwise. ``` -------------------------------- ### steputils.p21.is_parameter_list Source: https://steputils.readthedocs.io/en/latest/p21.html Returns True if e is a ParameterList. Note: It is a single parameter if it’s not a ParameterList ```APIDOC ## steputils.p21.is_parameter_list ### Description Returns `True` if e is a `ParameterList`. Note: It is a single parameter if it’s not a `ParameterList`. ### Method Type Checker Function ### Endpoint N/A ### Parameters #### Path Parameters - **e** (*) - Required - the element to check. ### Response - **bool**: `True` if e is a ParameterList object, `False` otherwise. ``` -------------------------------- ### steputils.p21.is_simple_entity_instance Source: https://steputils.readthedocs.io/en/latest/p21.html Returns True if e is a SimpleEntityInstance. ```APIDOC ## steputils.p21.is_simple_entity_instance ### Description Returns `True` if e is a `SimpleEntityInstance`. ### Method Type Checker Function ### Endpoint N/A ### Parameters #### Path Parameters - **e** (*) - Required - the element to check. ### Response - **bool**: `True` if e is a SimpleEntityInstance object, `False` otherwise. ``` -------------------------------- ### steputils.p21.is_integer Source: https://steputils.readthedocs.io/en/latest/p21.html Returns True if e is an int. ```APIDOC ## steputils.p21.is_integer ### Description Returns `True` if e is an `int`. ### Method Type Checker Function ### Endpoint N/A ### Parameters #### Path Parameters - **e** (*) - Required - the element to check. ### Response - **bool**: `True` if e is an integer, `False` otherwise. ``` -------------------------------- ### steputils.p21.unset_parameter Source: https://steputils.readthedocs.io/en/latest/p21.html Factory function to create a new UnsetParameter object. Unset attribute values are given as '$'. Explicit attributes which got re-declared as derived in a subtype are encoded as '*' in the position of the supertype attribute. ```APIDOC ## steputils.p21.unset_parameter ### Description Factory function to create a new `UnsetParameter` object. Unset attribute values are given as `'$'`. Explicit attributes which got re-declared as derived in a subtype are encoded as `'*'` in the position of the supertype attribute. ### Method Factory Function ### Endpoint N/A ### Parameters #### Path Parameters - **char** (str) - Required - the unset character. ### Response - **UnsetParameter**: A new UnsetParameter object. ``` -------------------------------- ### steputils.p21.is_entity Source: https://steputils.readthedocs.io/en/latest/p21.html Returns True if e is a Entity. ```APIDOC ## steputils.p21.is_entity ### Description Returns `True` if e is a `Entity`. ### Method Type Checker Function ### Endpoint N/A ### Parameters #### Path Parameters - **e** (*) - Required - the element to check. ### Response - **bool**: `True` if e is an Entity object, `False` otherwise. ``` -------------------------------- ### steputils.p21.is_real Source: https://steputils.readthedocs.io/en/latest/p21.html Returns True if e is a float. ```APIDOC ## steputils.p21.is_real ### Description Returns `True` if e is a `float`. ### Method Type Checker Function ### Endpoint N/A ### Parameters #### Path Parameters - **e** (*) - Required - the element to check. ### Response - **bool**: `True` if e is a real number (float), `False` otherwise. ``` -------------------------------- ### steputils.p21.is_unset_parameter Source: https://steputils.readthedocs.io/en/latest/p21.html Returns True if e is an unset or omitted parameter (UnsetParameter). ```APIDOC ## steputils.p21.is_unset_parameter ### Description Returns `True` if e is an unset or omitted parameter (`UnsetParameter`). ### Method Type Checker Function ### Endpoint N/A ### Parameters #### Path Parameters - **e** (*) - Required - the element to check. ### Response - **bool**: `True` if e is an UnsetParameter object, `False` otherwise. ``` -------------------------------- ### steputils.p21.is_typed_parameter Source: https://steputils.readthedocs.io/en/latest/p21.html Returns True if e is a TypedParameter. ```APIDOC ## steputils.p21.is_typed_parameter ### Description Returns `True` if e is a `TypedParameter`. ### Method Type Checker Function ### Endpoint N/A ### Parameters #### Path Parameters - **e** (*) - Required - the element to check. ### Response - **bool**: `True` if e is a TypedParameter object, `False` otherwise. ``` -------------------------------- ### steputils.p21.is_enum Source: https://steputils.readthedocs.io/en/latest/p21.html Returns True if e is an Enumeration. ```APIDOC ## steputils.p21.is_enum ### Description Returns `True` if e is an `Enumeration`. ### Method Type Checker Function ### Endpoint N/A ### Parameters #### Path Parameters - **e** (*) - Required - the element to check. ### Response - **bool**: `True` if e is an Enumeration object, `False` otherwise. ``` -------------------------------- ### steputils.p21.is_complex_entity_instance Source: https://steputils.readthedocs.io/en/latest/p21.html Returns True if e is a ComplexEntityInstance. ```APIDOC ## steputils.p21.is_complex_entity_instance ### Description Returns `True` if e is a `ComplexEntityInstance`. ### Method Type Checker Function ### Endpoint N/A ### Parameters #### Path Parameters - **e** (*) - Required - the element to check. ### Response - **bool**: `True` if e is a ComplexEntityInstance object, `False` otherwise. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.