pylib.data_step module

STEP reader.

Date

2020-01-03

arc_circle_geometry(conic, p1, p2, ellipse=False)[source]
b_spline_curve_with_knots_geometry(b_spline, p1, p2)[source]

Currently only clamped b_spline curves and assumed, i. e. closed = False.

data_cmds_to_data_dict(data_cmds, verbose=False)[source]

Create dict with step objects

1st it creats keys equal to the number id string and values with the command string.

2nd it creats keys for different step object types to dict all commands as new created objects of that type.

Example

from:
  ["#12 = CARTESIAN_POINT('',(0.E+000,0.E+000,0.E+000))",
   "#22 = VERTEX_POINT('',#23)"]
to:
  {'#12': 'CARTESIAN_POINT('',(0.E+000,0.E+000,0.E+000))',
   '#22': 'VERTEX_POINT('',#23)'}

additional
  {
    'cartesian_points': {
      '#12': pointer_to_new_created_point_object,
      ...
      },
    'vertex_points': {
      '#22': pointer_to_new_created_vertex_object,
      ...
      },
    ...
    }
data_dict_edge_curve_to_geometry(data_dict)[source]
data_dict_to_geometry_world(data_dict)[source]
data_dict_to_geometry_world_edge_curve(data_dict)[source]
data_section_dict(step, verbose=False)[source]
line_geometry(p1, p2)[source]
print_edge_loop(data_dict, instance_name)[source]
class step(file_name)[source]

Bases: object

STEP reader class.

1st read a STEP file. 2nd convert header and data section string to list of commands.

The STEP file string can have commands distributed over several lines, the commands are seperated by ;\n. This class un-wraps each command into one line (remove \n) and removes empty lines.

Example

header part of a step file (between HEADER; and ENDSEC;):
  FILE_DESCRIPTION(('Open CASCADE Model'),'2;1');
  FILE_NAME('Open CASCADE Shape Model','2019-10-14T14:32:20',('Author'),(
      'Open CASCADE'),'Open CASCADE STEP processor 7.1','Open CASCADE 7.1'
    ,'Unknown');
  FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 1 1 1 1 }'));

will result in (but as a list):
  FILE_DESCRIPTION(('Open CASCADE Model'),'2;1')
  FILE_NAME('Open CASCADE Shape Model','2019-10-14T14:32:20',('Author'),('Open CASCADE'),'Open CASCADE STEP processor 7.1','Open CASCADE 7.1','Unknown')
  FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 1 1 1 1 }'))
str_to_cmd_args(cmd_str)[source]

Using negative lookahead to match all the commas which are not inside a parenthesis and then split the string at the commas.

Example

CARTESIAN_POINT('',(0.E+000,0.E+000,0.E+000))
will become
command = 'CARTESIAN_POINT'
arguments = ['', '(0.E+000,0.E+000,0.E+000)']