pycatia.scripts.csv_tools

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

Convert input ‘length’ from unit to millimeters.

Parameters:
  • number

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

Returns:

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

Parses a csv file in the format defined in csv_reader() and populates the geometry_set_name with new points. Once complete the part is updated.

Parameters:
  • part (Part) –

  • file_name (str) – full path to csv file.

  • units (str) – length units of csv_file eg ‘in’

  • geometry_set_name (str) – name of new geometrical set in which to add points.

Returns:

pycatia.scripts.csv_tools.csv_reader(file_name: str, units: str, delimiter: str = ',') Generator[dict, None, None]
Reads contents of csv file and returns a generator object containing tuples in the format:
[
(
str(<point_name>),
int(X coordinate),
int(Y coordinate),
int(Z coordinate)
),
]
Parameters:
  • file_name – full path to csv file.

  • units (str) –

  • delimiter

Returns:

generator()