#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""STEP Standard structure.
:Date: 2020-01-03
.. module:: data_step_std
:platform: *nix, Windows
:synopsis: STEP Standard structure.
.. moduleauthor:: Daniel Weschke <daniel.weschke@directbox.de>
.. seealso::
STEP, ISO 10303-21, AP 232 (Application Protocol)
http://www.steptools.com/stds/step/ and
https://www.steptools.com/stds/stp_aim/html/schema.html
ISO 10303-21:2002. Industrial automation systems and integration --
Product data representation and exchange -- Part 21:
Implementation methods: Clear text encoding of the exchange
structure
ISO 10303-21:2016. Industrial automation systems and integration --
Product data representation and exchange -- Part 21:
Implementation methods: Clear text encoding of the exchange
structure
"""
# DATA section
# - Format: Instance name = Entity instance
# - Example: #4 = PRODUCT_DEFINITION_SHAPE('','',#5);
# - Instance name
# - unique name in the form "#1234"
# - must consist of a positive number
# - only valid locally within the STEP-file
# - Entity instance: name of the entity in capital letters followed
# by attribute values in defined order within parentheses
# - Attributes
# - Only explicit attributes get mapped (are listed)
# - Inverse, Derived and re-declared attributes are not listed
# since their values can be deduced from the other ones.
# - Unset attribute values are given as: $
# - Re-declared attributes as derived in a subtype are encoded: *
# - Enumeration (ENUM), boolean (BOOLEAN) and logical (LOGICAL)
# values are given in capital letters with a leading and
# trailing dot, e. g.: .TRUE.
# - String values are given as: ''
# - Integers (INTEGER) and real (REAL) values are used identical
# to typical programming languages
# - elements of aggregates (SET, BAG, LIST, ARRAY) are given in
# parentheses, separated by comma ",":
# STEP Standard TYPE LIST: first index is 1.
# STEP Standard TYPE ARRAY: first index is 0.
[docs]def BOOLEAN_to_bool(boolean):
if boolean == ".T.":
return True
elif boolean == ".F.":
return False
return boolean
[docs]def dimension_of(item):
"""STEP Standard FUNCTION dimension_of
:param item: STEP Standard TYPE GEOMETRIC_REPRESENTATION_ITEM
:type item: GEOMETRIC_REPRESENTATION_ITEM
:returns: dim
:rtype: int or None
:ivar dim: STEP Standard TYPE dimension_count (INTEGER).
dimension_count > 0
:vartype dim: int
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_dimension_of.html
"""
# (* SCHEMA step_merged_ap_schema; *)
#
# -- DIFF IN AP214
# -- DIFF IN AP203e2
# -- DIFF IN AP238 STEP-NC
# -- DIFF IN AP224
# -- DIFF IN AP232
# FUNCTION dimension_of
# (item : geometric_representation_item ) : dimension_count;
# LOCAL
# x : SET OF representation;
# y : representation_context;
# dim : dimension_count;
# END_LOCAL;
# IF 'STEP_MERGED_AP_SCHEMA.CARTESIAN_POINT' IN TYPEOF(item) THEN
# dim := SIZEOF(item\cartesian_point.coordinates);
# RETURN (dim);
# END_IF;
# IF 'STEP_MERGED_AP_SCHEMA.DIRECTION' IN TYPEOF(item) THEN
# dim := SIZEOF(item\direction.direction_ratios);
# RETURN (dim);
# END_IF;
# IF 'STEP_MERGED_AP_SCHEMA.VECTOR' IN TYPEOF(item) THEN
# dim := SIZEOF(item\vector.orientation\direction.direction_ratios);
# RETURN (dim);
# END_IF;
# x := using_representations(item);
# IF SIZEOF(x) > 0 THEN
# y := x[1].context_of_items;
# dim := y\geometric_representation_context.coordinate_space_dimension;
# RETURN (dim);
# ELSE
# RETURN (?);
# END_IF;
# END_FUNCTION;
if isinstance(item, CARTESIAN_POINT):
dim = len(item.coordinates)
return dim
if isinstance(item, DIRECTION):
dim = len(item.direction_ratios)
return dim
if isinstance(item, VECTOR):
dim = len(item.orientation.direction_ratios)
return dim
# TODO: x, y
# x := using_representations(item);
# IF SIZEOF(x) > 0 THEN
# y := x[1].context_of_items;
# dim := y\geometric_representation_context.coordinate_space_dimension;
# RETURN (dim);
# ELSE
# RETURN (?);
# END_IF;
return None
[docs]def list_to_array(lis, low, u):
"""STEP Standard FUNCTION list_to_array
:param lis: STEP Standard TYPE LIST [0:?] OF GENERIC
:type lis: tuple
:param low: STEP Standard TYPE INTEGER
:type low: int
:param u: STEP Standard TYPE INTEGER
:type u: int
:returns: res
:rtype: tuple or None
:param n: STEP Standard TYPE INTEGER
:type n: int
:ivar res: STEP Standard TYPE ARRAY [low:u] OF GENERIC
:vartype res: tuple
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_list_to_array.html
"""
# (* SCHEMA step_merged_ap_schema; *)
# -- DIFF IN AP214
# -- DIFF IN AP203e2
# -- DIFF IN AP238 STEP-NC
# -- DIFF IN AP224
# -- DIFF IN AP232
# FUNCTION list_to_array
# (lis : LIST [0:?] OF GENERIC : t;
# low : INTEGER;
# u : INTEGER ) : ARRAY [low:u] OF GENERIC : t;
# LOCAL
# n : INTEGER;
# res : ARRAY [low:u] OF GENERIC : t;
# END_LOCAL;
# n := SIZEOF(lis);
# IF n <> u - low + 1 THEN
# RETURN (?);
# ELSE
# res := [ lis[1]:0 ];
# REPEAT i := 2 TO n BY 1;
# res[(low + i - 1)] := lis[i];
# END_REPEAT;
# RETURN (res);
# END_IF;
# END_FUNCTION;
n = len(lis)
# length of new array and old list must be equal
if n != u - low + 1: # len(lis) != len(range(low, u+1))
return None
# TODO: new list?
#res = [i for i in lis]
res = lis
return res
[docs]def boolean_choose(b, choice1, choice2):
"""STEP Standard FUNCTION boolean_choose
:param b: STEP Standard TYPE BOOLEAN
:type b: bool
:param choice1: STEP Standard TYPE GENERIC
:type choice1: object
:param choice2: STEP Standard TYPE GENERIC
:type choice2: object
:returns: STEP STEP Standard TYPE GENERIC
:rtype: object
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_boolean_choose.html
"""
# (* SCHEMA step_merged_ap_schema; *)
#
# FUNCTION boolean_choose
# (b : BOOLEAN;
# choice1 : GENERIC : item;
# choice2 : GENERIC : item ) : GENERIC : item;
# IF b THEN
# RETURN (choice1);
# ELSE
# RETURN (choice2);
# END_IF;
# END_FUNCTION;
return choice1 if b else choice2
[docs]def path_head_to_tail(a_path):
"""STEP Standard FUNCTION path_head_to_tail
Check if the path is a connected curve set.
:param a_path: STEP Standard TYPE path
:type a_path: PATH
:returns: p
:rtype: object
:ivar p: STEP STEP Standard TYPE LOGICAL
:vartype item: bool
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_path_head_to_tail.html
"""
# (* SCHEMA step_merged_ap_schema; *)
# -- DIFF IN AP214
# -- DIFF IN AP203e2
# -- DIFF IN AP238 STEP-NC
# -- DIFF IN AP224
# -- DIFF IN AP232
# FUNCTION path_head_to_tail
# (a_path : path ) : LOGICAL;
# LOCAL
# n : INTEGER;
# p : LOGICAL := TRUE;
# END_LOCAL;
# n := SIZEOF(a_path.edge_list);
# REPEAT i := 2 TO n BY 1;
# p := p AND (a_path.edge_list[(i - 1)].edge_end :=: a_path.edge_list[i].edge_start);
# END_REPEAT;
# RETURN (p);
# END_FUNCTION;
n = len(a_path.edge_list)
p = all([a_path.edge_list[i-1].edge_end == a_path.edge_list[i].edge_start for i in range(1, n)])
return p
[docs]class REPRESENTATION_ITEM():
"""STEP Standard ENTITY representation_item
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
Additional attributes
:ivar idn: for the instance the instance id and for the class the
total number of instances
:vartype idn: int
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_representation_item.html
"""
idn = 0 # equal to total numbers of instances
def __init__(self, name):
self.name = name
REPRESENTATION_ITEM.idn += 1
self.idn = REPRESENTATION_ITEM.idn # instance id
[docs]class GEOMETRIC_REPRESENTATION_ITEM(REPRESENTATION_ITEM):
"""STEP Standard ENTITY geometric_representation_item
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
Derived Attributes
:param dim: STEP Standard TYPE dimension_count (INTEGER)
:type dim: int
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_geometric_representation_item.html
"""
def __init__(self, name):
# TODO: or dim rather in a method (or property) so that it is
# conducted only on demand?
self.dim = dimension_of(self)
super().__init__(name)
[docs]class POINT(GEOMETRIC_REPRESENTATION_ITEM):
"""STEP Standard ENTITY point
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
Derived Attributes
:param dim: STEP Standard TYPE dimension_count (INTEGER)
:type dim: int
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_point.html
"""
def __init__(self, name):
super().__init__(name)
[docs]class CARTESIAN_POINT(POINT):
"""STEP Standard ENTITY cartesian_point
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
:param coordinates: list of length_measure (floats)
:type coordinates: tuple
Derived Attributes
:param dim: STEP Standard TYPE dimension_count (INTEGER)
:type dim: int
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_cartesian_point.html
"""
def __init__(self, name, coordinates):
self.coordinates = coordinates
super().__init__(name)
[docs] def __str__(self):
return "#"+str(self.idn)+" = CARTESIAN_POINT('"+self.name+"', "+str(self.coordinates)+")"
[docs]class TOPOLOGICAL_REPRESENTATION_ITEM(REPRESENTATION_ITEM):
"""STEP Standard ENTITY topological_representation_item
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_topological_representation_item.html
"""
def __init__(self, name):
super().__init__(name)
[docs]class VERTEX(TOPOLOGICAL_REPRESENTATION_ITEM):
"""STEP Standard ENTITY vertex
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_vertex.html
"""
def __init__(self, name):
super().__init__(name)
[docs]class VERTEX_POINT(VERTEX):
"""STEP Standard ENTITY vertex_point
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
:param vertex_geometry: point
:type vertex_geometry: POINT
Derived Attributes
:param dim: STEP Standard TYPE dimension_count (INTEGER)
:type dim: int
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_vertex_point.html
"""
def __init__(self, name, vertex_geometry):
self.vertex_geometry = vertex_geometry
super().__init__(name)
[docs] def __str__(self):
return "#"+str(self.idn)+" = VERTEX_POINT('"+self.name+"', #"+str(self.vertex_geometry.idn)+")"
[docs]class DIRECTION(GEOMETRIC_REPRESENTATION_ITEM):
"""STEP Standard ENTITY direction
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
:param direction_ratios: STEP Standard LIST OF REAL
:type direction_ratios: tuple
Derived Attributes
:param dim: STEP Standard TYPE dimension_count (INTEGER)
:type dim: int
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_direction.html
"""
def __init__(self, name, direction_ratios):
self.direction_ratios = direction_ratios
super().__init__(name)
[docs]class VECTOR(GEOMETRIC_REPRESENTATION_ITEM):
"""STEP Standard ENTITY vector
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
:param orientation:
:type orientation: DIRECTION
:param magnitude: length_measure
:type magnitude: float
Derived Attributes
:param dim: STEP Standard TYPE dimension_count (INTEGER)
:type dim: int
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_vector.html
"""
def __init__(self, name, orientation, magnitude):
self.orientation = orientation
self.magnitude = magnitude
super().__init__(name)
[docs]class EDGE(TOPOLOGICAL_REPRESENTATION_ITEM):
"""STEP Standard ENTITY edge
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
:param edge_start: start point
:type edge_start: VERTEX
:param edge_end: end point
:type edge_end: VERTEX
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_edge.html
"""
def __init__(self, name, edge_start, edge_end):
self.edge_start = edge_start
self.edge_end = edge_end
super().__init__(name)
[docs]class CURVE(GEOMETRIC_REPRESENTATION_ITEM):
"""STEP Standard ENTITY curve
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
Derived Attributes
:param dim: STEP Standard TYPE dimension_count (INTEGER)
:type dim: int
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_curve.html
"""
def __init__(self, name):
super().__init__(name)
[docs]class LINE(CURVE):
"""STEP Standard ENTITY line
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
:param pnt:
:type pnt: CARTESIAN_POINT
:param dir:
:type dir: VECTOR
Derived Attributes
:param dim: STEP Standard TYPE dimension_count (INTEGER)
:type dim: int
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_line.html
"""
def __init__(self, name, pnt, dir):
self.pnt = pnt
self.dir = dir
super().__init__(name)
[docs]class SURFACE_CURVE(CURVE):
"""STEP Standard ENTITY surface_curve
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
:param curve_3d:
:type curve_3d: CURVE
:param associated_geometry:
:type associated_geometry: list of pcurve_or_surface
:param master_representation:
:type master_representation: preferred_surface_curve_representation
Derived Attributes
:param dim: STEP Standard TYPE dimension_count (INTEGER)
:type dim: int
:param basis_surface:
:type basis_surface: SET OF surface
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_surface_curve.html
"""
def __init__(self, name, curve_3d, associated_geometry, master_representation):
self.curve_3d = curve_3d
self.associated_geometry = associated_geometry
self.master_representation = master_representation
super().__init__(name)
[docs]class SEAM_CURVE(SURFACE_CURVE):
"""STEP Standard ENTITY seam_curve
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
:param curve_3d:
:type curve_3d: CURVE
:param associated_geometry:
:type associated_geometry: list of pcurve_or_surface
:param master_representation:
:type master_representation: preferred_surface_curve_representation
Derived Attributes
:param dim: STEP Standard TYPE dimension_count (INTEGER)
:type dim: int
:param basis_surface:
:type basis_surface: SET OF surface
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_seam_curve.html
"""
def __init__(self, name, curve_3d, associated_geometry, master_representation):
super().__init__(name, curve_3d, associated_geometry, master_representation)
[docs]class EDGE_CURVE(EDGE):
"""STEP Standard ENTITY edge_curve
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
:param edge_start: start point
:type edge_start: VERTEX
:param edge_end: end point
:type edge_end: VERTEX
:param edge_geometry: curve
:type edge_geometry: CURVE
:param same_sense: STEP Standard TYPE BOOLEAN
:type same_sense: str
Derived Attributes
:param dim: STEP Standard TYPE dimension_count (INTEGER)
:type dim: int
Definition from ISO/CD 10303-42:1992: An edge curve is a special subtype of edge which has its geometry fully defined. The geometry is defined by associating the edge with a curve which may be unbounded. As the topological and geometric directions may be opposed, an indicator (same sense) is used to identify whether the edge and curve directions agree or are opposed. The Boolean value indicates whether the curve direction agrees with (TRUE) or is in the opposite direction (FALSE) to the edge direction. Any geometry associated with the vertices of the edge shall be consistent with the edge geometry.
Informal propositions
1. The domain of the edge curve is formally defined to be the domain of its edge geometry as trimmed by the vertices. This domain does not include the vertices.
2. An edge curve has non-zero finite extent.
3. An edge curve is a manifold.
4. An edge curve is arcwise connected.
5. The edge start is not a part of the edge domain.
6. The edge end is not a part of the edge domain.
7. Vertex geometry shall be consistent with edge geometry.
Attribute definitions
EdgeGeometry
The curve which defines the shape and spatial location of the edge. This curve may be unbounded and is implicitly trimmed by the vertices of the edge; this defines the edge domain. Multiple edges can reference the same curve.
SameSense
This logical flag indicates whether (TRUE), or not (FALSE) the senses of the edge and the curve defining the edge geometry are the same. The sense of an edge is from the edge start vertex to the edge end vertex; the sense of a curve is in the direction of increasing parameter.
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_edge_curve.html
https://iaiweb.lbl.gov/Resources/IFC_Releases/R2x3_final/ifctopologyresource/lexical/ifcedgecurve.htm
"""
def __init__(self, name, edge_start, edge_end, edge_geometry, same_sense):
self.edge_geometry = edge_geometry
self.same_sense = BOOLEAN_to_bool(same_sense)
super().__init__(name, edge_start, edge_end)
[docs]class PLACEMENT(GEOMETRIC_REPRESENTATION_ITEM):
"""STEP Standard ENTITY placement
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
:param location:
:type location: CARTESIAN_POINT
Derived Attributes
:param dim: STEP Standard TYPE dimension_count (INTEGER)
:type dim: int
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_placement.html
"""
def __init__(self, name, location):
self.location = location
super().__init__(name)
[docs]class AXIS2_PLACEMENT_2D(PLACEMENT):
"""STEP Standard ENTITY axis2_placement_2d
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
:param location:
:type location: CARTESIAN_POINT
:param ref_direction:
:type ref_direction: DIRECTION
Derived Attributes
:param dim: STEP Standard TYPE dimension_count (INTEGER)
:type dim: int
:param p:
:type p: list of DIRECTION
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_axis2_placement_2d.html
"""
def __init__(self, name, location, ref_direction):
self.ref_direction = ref_direction
super().__init__(name, location)
[docs]class AXIS2_PLACEMENT_3D(PLACEMENT):
"""STEP Standard ENTITY axis2_placement_3d
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
:param location:
:type location: CARTESIAN_POINT
:param axis:
:type axis: DIRECTION
:param ref_direction:
:type ref_direction: DIRECTION
Derived Attributes
:param dim: STEP Standard TYPE dimension_count (INTEGER)
:type dim: int
:param p:
:type p: list of DIRECTION
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_axis2_placement_3d.html
"""
def __init__(self, name, location, axis, ref_direction):
self.axis = axis
self.ref_direction = ref_direction
super().__init__(name, location)
[docs]class CONIC(CURVE):
"""STEP Standard ENTITY conic
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
:param position: axis2_placement
:type position: AXIS2_PLACEMENT_2D or AXIS2_PLACEMENT_3D
Derived Attributes
:param dim: STEP Standard TYPE dimension_count (INTEGER)
:type dim: int
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_conic.html
"""
def __init__(self, name, position):
self.position = position
super().__init__(name)
[docs]class CIRCLE(CONIC):
"""STEP Standard ENTITY circle
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
:param position: axis2_placement
:type position: AXIS2_PLACEMENT_2D or AXIS2_PLACEMENT_3D
:param radius: positive_length_measure
:type radius: float
Derived Attributes
:param dim: STEP Standard TYPE dimension_count (INTEGER)
:type dim: int
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_circle.html
"""
def __init__(self, name, position, radius):
self.radius = radius
super().__init__(name, position)
[docs]class ELLIPSE(CONIC):
"""STEP Standard ENTITY ellipse
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
:param position: STEP Standard TYPE axis2_placement (SELECT)
:type position: AXIS2_PLACEMENT_2D or AXIS2_PLACEMENT_3D
:param semi_axis_1: STEP Standard TYPE positive_length_measure (REAL)
:type semi_axis_1: float
:param semi_axis_2: STEP Standard TYPE positive_length_measure (REAL)
:type semi_axis_2: float
Derived Attributes
:param dim: STEP Standard TYPE dimension_count (INTEGER)
:type dim: int
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_ellipse.html
"""
def __init__(self, name, position, semi_axis_1, semi_axis_2):
self.semi_axis_1 = semi_axis_1
self.semi_axis_2 = semi_axis_2
super().__init__(name, position)
[docs]class BOUNDED_CURVE(CURVE):
"""STEP Standard ENTITY bounded_curve
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
Derived Attributes
:param dim: STEP Standard TYPE dimension_count (INTEGER)
:type dim: int
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_bounded_curve.html
"""
def __init__(self, name):
super().__init__(name)
[docs]class B_SPLINE_CURVE(BOUNDED_CURVE):
"""STEP Standard ENTITY b_spline_curve
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
:param degree: STEP Standard TYPE INTEGER
:type degree: int
:param control_points_list: STEP Standard TYPE LIST OF
cartesian_point (ENTITY)
:type control_points_list: tuple
:param curve_form: STEP Standard TYPE b_spline_curve_form (ENUM).
ENUMERATION OF (polyline_form, circular_arc, elliptic_arc,
parabolic_arc, hyperbolic_arc, unspecified).
:type curve_form: str
:param closed_curve: STEP Standard TYPE LOGICAL
:type closed_curve: str
:param self_intersect: STEP Standard TYPE LOGICAL
:type self_intersect: str
Derived Attributes
:param dim: STEP Standard TYPE dimension_count (INTEGER)
:type dim: int
:param upper_index_on_control_points: STEP Standard TYPE INTEGER
:type upper_index_on_control_points: int
:param control_points: STEP Standard TYPE ARRAY OF
cartesian_point (ENTITY)
:type control_points: tuple
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_b_spline_curve.html
"""
def __init__(self, name, degree, control_points_list, curve_form,
closed_curve, self_intersect):
self.degree = degree
self.control_points_list = control_points_list
self.curve_form = curve_form
self.closed_curve = BOOLEAN_to_bool(closed_curve) # TODO: BOOLEAN not LOGICAL?
self.self_intersect = BOOLEAN_to_bool(self_intersect) # TODO: BOOLEAN not LOGICAL?
self.upper_index_on_control_points = len(control_points_list) - 1
# TODO: necessary?
self.control_points = list_to_array(
control_points_list, 0, self.upper_index_on_control_points)
super().__init__(name)
[docs]class B_SPLINE_CURVE_WITH_KNOTS(B_SPLINE_CURVE):
"""STEP Standard ENTITY b_spline_curve_with_knots
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
:param degree: STEP Standard TYPE INTEGER
:type degree: int
:param control_points_list: STEP Standard TYPE LIST OF
cartesian_point (ENTITY)
:type control_points_list: tuple
:param curve_form: STEP Standard TYPE b_spline_curve_form (ENUM).
ENUMERATION OF (polyline_form, circular_arc, elliptic_arc,
parabolic_arc, hyperbolic_arc, unspecified).
:type curve_form: str
:param closed_curve: STEP Standard TYPE LOGICAL
:type closed_curve: str
:param self_intersect: STEP Standard TYPE LOGICAL
:type self_intersect: str
:param knot_multiplicities: STEP Standard TYPE LIST OF INTEGER
:type knot_multiplicities: tuple
:param knots: STEP Standard TYPE LIST OF parameter_value (REAL)
:type knots: tuple
:param knot_spec: STEP Standard TYPE knot_type (ENUM).
ENUMERATION OF (uniform_knots, quasi_uniform_knots,
piecewise_bezier_knots, unspecified).
:type knot_spec: str
Derived Attributes
:param dim: STEP Standard TYPE dimension_count (INTEGER)
:type dim: int
:param upper_index_on_control_points: STEP Standard TYPE INTEGER
:type upper_index_on_control_points: int
:param control_points: STEP Standard TYPE ARRAY OF
cartesian_point (ENTITY)
:type control_points: tuple
:param upper_index_on_knots: STEP Standard TYPE INTEGER
:type upper_index_on_knots: int
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_b_spline_curve_with_knots.html
"""
def __init__(self, name, degree, control_points_list, curve_form,
closed_curve, self_intersect, knot_multiplicities,
knots, knot_spec):
self.knot_multiplicities = knot_multiplicities
self.knots = knots
self.knot_spec = knot_spec
self.upper_index_on_knots = len(knots)
super().__init__(name, degree, control_points_list, curve_form,
closed_curve, self_intersect)
[docs]class ORIENTED_EDGE(EDGE):
"""STEP Standard ENTITY oriented_edge
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
:param edge_start: STEP Standard TYPE vertex (ENTITY)
[re-declared attribute from edge]
:type edge_start: VERTEX
:param edge_end: STEP Standard TYPE vertex (ENTITY)
[re-declared attribute from edge]
:type edge_end: VERTEX
:param edge_element: STEP Standard TYPE edge (ENTITY)
:type edge_element: EDGE
:param orientation: STEP Standard TYPE BOOLEAN
:type orientation: str
Derived Attributes
:param edge_start: STEP Standard TYPE vertex (ENTITY)
[re-declared attribute from edge]
:type edge_start: VERTEX
:param edge_end: STEP Standard TYPE vertex (ENTITY)
[re-declared attribute from edge]
:type edge_end: VERTEX
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_oriented_edge.html
"""
def __init__(self, name, edge_start, edge_end, edge_element,
orientation):
# if edge_element not EDGE
if not isinstance(self, type(edge_element)):
# value of edge_start should be '*'
# value of edge_end should be '*'
self.edge_element = edge_element
self.orientation = BOOLEAN_to_bool(orientation)
self.edge_start = boolean_choose(
self.orientation,
self.edge_element.edge_start, self.edge_element.edge_end)
self.edge_end = boolean_choose(
self.orientation,
self.edge_element.edge_end, self.edge_element.edge_start)
super().__init__(name, self.edge_start, self.edge_end)
else:
self = None
print('no oriented_edge')
[docs]class LOOP(TOPOLOGICAL_REPRESENTATION_ITEM):
"""STEP Standard ENTITY loop
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_loop.html
"""
def __init__(self, name):
super().__init__(name)
[docs]class PATH(TOPOLOGICAL_REPRESENTATION_ITEM):
"""STEP Standard ENTITY path
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
:param edge_list: STEP Standard TYPE LIST OF oriented_edge (ENTITY)
:type edge_list: tuple
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_path.html
"""
def __init__(self, name, edge_list):
self.edge_list = edge_list
super().__init__(name)
if not path_head_to_tail(self):
self = None
print('no path')
[docs]class EDGE_LOOP(PATH, LOOP):
"""STEP Standard ENTITY edge_loop
Explicit Attributes
:param name: STEP Standard TYPE label (STRING)
:type name: str
:param edge_list: STEP Standard TYPE LIST OF oriented_edge (ENTITY)
:type edge_list: tuple
.. seealso::
https://www.steptools.com/stds/stp_aim/html/t_edge_loop.html
"""
def __init__(self, name, edge_list):
self.edge_list = edge_list
super().__init__(name, edge_list)
self.ne = len(self.edge_list)
if self.edge_list[0].edge_start != self.edge_list[self.ne-1].edge_end:
self = None
print('no edge_loop')