pycatia3dx.scripts.csv_tools

pycatia3dx.scripts.csv_tools.convert_units(number: str, unit: str) → float

Convert input ‘length’ from unit to millimeters.

Parameters:
  • number – The numeric value to convert

  • unit – A string representing the unit ‘mm’, ‘in’, ‘cm’, ‘m’, ‘mile’, ‘km’

Returns:

The converted value in millimeters

Raises:
  • FloatingPointError – If number cannot be converted to float

  • KeyError – If unit is not supported

pycatia3dx.scripts.csv_tools.create_points(part: Part, file_name: Path, units: str = 'mm', geometry_set_name: str = 'New_Points') → None

Parses a csv file and populates the geometry set with new points.

Once complete, the part is updated.

Parameters:
  • part – The Part object to add points to

  • file_name – Full path to csv file

  • units – Length units of csv file (e.g., ‘mm’, ‘in’)

  • geometry_set_name – Name of new geometrical set in which to add points

Returns:

None

pycatia3dx.scripts.csv_tools.csv_reader(file_name: Path, units: str, delimiter: str = ',') → Generator[dict, None, None]

Reads contents of csv file and returns a generator object containing dictionaries with point data.

Each dictionary contains:
  • ‘name’: str - point name

  • ‘x’: float - X coordinate in mm

  • ‘y’: float - Y coordinate in mm

  • ‘z’: float - Z coordinate in mm

Parameters:
  • file_name – Full path to csv file

  • units – Length units of csv file (e.g., ‘mm’, ‘in’, ‘cm’)

  • delimiter – CSV delimiter character

Returns:

Generator yielding point dictionaries

Raises:

FileNotFoundError – If the file does not exist