diff --git a/docs/direct_api_classes.svg b/docs/direct_api_classes.svg index ac3b7b8..1d0d8fd 100644 --- a/docs/direct_api_classes.svg +++ b/docs/direct_api_classes.svg @@ -4,441 +4,444 @@ - - + + classes - + build123d.direct_api.Axis - -Axis - -X -Y -Z -direction -position -wrapped - -angle_between(other: Axis): float -copy(): Axis -from_occt(cls: gp_Ax1, axis): Axis -is_coaxial(other: Axis, angular_tolerance: float, linear_tolerance: float): bool -is_normal(other: Axis, angular_tolerance: float): bool -is_opposite(other: Axis, angular_tolerance: float): bool -is_parallel(other: Axis, angular_tolerance: float): bool -reversed(): Axis -to_location(): Location -to_plane(): Plane + +Axis + +X +Y +Z +direction +position +wrapped + +angle_between(other: Axis): float +copy(): Axis +from_occt(cls: gp_Ax1, axis): Axis +is_coaxial(other: Axis, angular_tolerance: float, linear_tolerance: float): bool +is_normal(other: Axis, angular_tolerance: float): bool +is_opposite(other: Axis, angular_tolerance: float): bool +is_parallel(other: Axis, angular_tolerance: float): bool +reversed(): Axis +to_location(): Location +to_plane(): Plane build123d.direct_api.BoundBox - -BoundBox - -wrapped -xlen -xmax -xmin -ylen -ymax -ymin -zlen -zmax -zmin - -add(obj: Union[tuple[float, float, float], Vector, BoundBox], tol: float): BoundBox -center(): Vector -diagonal_length(): float -find_outside_box_2d(bb1: BoundBox, bb2): Optional[BoundBox] -is_inside(b2: BoundBox): bool + +BoundBox + +wrapped +xlen +xmax +xmin +ylen +ymax +ymin +zlen +zmax +zmin + +add(obj: Union[tuple[float, float, float], Vector, BoundBox], tol: float): BoundBox +center(): Vector +diagonal_length(): float +find_outside_box_2d(bb1: BoundBox, bb2): Optional[BoundBox] +is_inside(b2: BoundBox): bool build123d.direct_api.Plane - -Plane - -XY -XZ -YX -YZ -ZX -ZY -back -bottom -f_g -f_g -front -lcs -lcs -left -origin -origin -r_g -r_g -right -top -wrapped -x_dir -y_dir -z_dir - -from_local_coords(obj: Union[tuple, Vector, Shape, BoundBox]) -rotated(rotate) -set_origin2d(x, y) -to_local_coords(obj: Union[VectorLike, Shape, BoundBox]) -to_location(): Location + +Plane + +XY +XZ +YX +YZ +ZX +ZY +back +bottom +f_g +f_g +front +lcs +lcs +left +origin +origin +r_g +r_g +right +top +wrapped +x_dir +y_dir +z_dir + +from_local_coords(obj: Union[tuple, Vector, Shape, BoundBox]) +rotated(rotate: VectorLike): Plane +set_origin2d(x, y) +to_local_coords(obj: Union[VectorLike, Shape, BoundBox]) +to_location(): Location build123d.direct_api.BoundBox->build123d.direct_api.Plane - - -_origin + + +_origin build123d.direct_api.Compound - -Compound - - -cut(): Compound -fuse(): Compound -get_type(obj_type: Union[Edge, Wire, Face, Solid]): list[Union[Edge, Wire, Face, Solid]] -intersect(): Compound -make_2d_text(cls: str, txt: float, fontsize: str, font: Optional[str], font_path: FontStyle, font_style: Halign, halign: Valign, valign: float, position_on_path: Union[Edge, Wire], text_path): -make_compound(cls: Iterable[Shape], list_of_shapes): Compound -make_text(cls: str, text: float, size: float, height: str, font: str, font_path: FontStyle, kind: Halign, halign: Valign, valign: Plane, position): Compound -remove(shape: Shape): Compound + +Compound + + +cut(): Compound +fuse(): Compound +get_type(obj_type: Union[Edge, Wire, Face, Solid]): list[Union[Edge, Wire, Face, Solid]] +intersect(): Compound +make_2d_text(cls: str, txt: float, fontsize: str, font: Optional[str], font_path: FontStyle, font_style: Halign, halign: Valign, valign: float, position_on_path: Union[Edge, Wire], text_path): +make_compound(cls: Iterable[Shape], list_of_shapes): Compound +make_text(cls: str, text: float, size: float, height: str, font: str, font_path: FontStyle, kind: Halign, halign: Valign, valign: Plane, position): Compound +remove(shape: Shape): Compound build123d.direct_api.Mixin3D - -Mixin3D - - -chamfer(length: float, length2: Optional[float], edge_list: Iterable[Edge]) -dprism(basis: Optional[Face], bounds: list[Union[Face, Wire]], depth: float, taper: float, up_to_face: Face, thru_all: bool, additive: bool): Solid -fillet(radius: float, edge_list: Iterable[Edge]) -is_inside(point: VectorLike, tolerance: float): bool -shell(face_list: Optional[Iterable[Face]], thickness: float, tolerance: float, kind: Kind): Solid + +Mixin3D + + +chamfer(length: float, length2: Optional[float], edge_list: Iterable[Edge]) +dprism(basis: Optional[Face], bounds: list[Union[Face, Wire]], depth: float, taper: float, up_to_face: Face, thru_all: bool, additive: bool): Solid +fillet(radius: float, edge_list: Iterable[Edge]) +is_inside(point: VectorLike, tolerance: float): bool +shell(face_list: Optional[Iterable[Face]], thickness: float, tolerance: float, kind: Kind): Solid build123d.direct_api.Compound->build123d.direct_api.Mixin3D - - + + build123d.direct_api.Shape - -Shape - -for_construction : bool -label : str -wrapped - -area(): float -bounding_box(tolerance: float): BoundBox -cast(cls: TopoDS_Shape, obj: bool, for_construction): Shape -clean(): Shape -combined_center(objects: CenterOf, center_of): Vector -compounds(): ShapeList['Compound'] -compute_mass(obj): float -copy(): Shape -cut(): Shape -distance(other: Shape): float -distances(): Iterator[float] -edges(): ShapeList['Edge'] -export_brep(f: Union[str, BytesIO]): bool -export_step(file_name: str): IFSelect_ReturnStatus -export_stl(file_name: str, tolerance: float, angular_tolerance: float, ascii: bool): bool -faces(): ShapeList['Face'] -faces_intersected_by_line(point: VectorLike, axis: VectorLike, tol: float, direction: Direction): ShapeList[Face] -find_intersection(point: Vector, direction: Vector): list[tuple[Vector, Vector]] -fix(): Shape -fuse(): Shape -geom_type(): Geoms -hash_code(): int -import_brep(cls: Union[str, BytesIO], f): Shape -intersect(): Shape -is_equal(other: Shape): bool -is_null(): bool -is_same(other: Shape): bool -is_valid(): bool -locate(loc: Location): Shape -located(loc: Location): Shape -location(): Location -max_fillet(edge_list: Iterable[Edge], tolerance, max_iterations: int): float -mesh(tolerance: float, angular_tolerance: float) -mirror(mirror_plane: Plane): Shape -move(loc: Location): Shape -moved(loc: Location): Shape -project_text(txt: str, fontsize: float, depth: float, path: Union[Wire, Edge], font: str, font_path: str, kind: FontStyle, valign: Valign, start: float): Compound -rotate(axis: Axis, angle: float): Shape -scale(factor: float): Shape -shape_type(): Shapes -shells(): ShapeList['Shell'] -solids(): ShapeList['Solid'] -split(): Shape -tessellate(tolerance: float, angular_tolerance: float): Tuple[list[Vector], list[Tuple[int, int, int]]] -to_vtk_poly_data(tolerance: float, angular_tolerance: float, normals: bool): vtkPolyData -transform_geometry(t_matrix: Matrix): Shape -transform_shape(t_matrix: Matrix): Shape -transformed(rotate: VectorLike, offset: VectorLike): Shape -translate(vector: VectorLike): Shape -vertices(): ShapeList['Vertex'] -volume(): float -wires(): ShapeList['Wire'] + +Shape + +for_construction : bool +label : str +orientation +position +wrapped + +area(): float +bounding_box(tolerance: float): BoundBox +cast(cls: TopoDS_Shape, obj: bool, for_construction): Shape +clean(): Shape +combined_center(objects: CenterOf, center_of): Vector +compounds(): ShapeList['Compound'] +compute_mass(obj): float +copy(): Shape +cut(): Shape +distance(other: Shape): float +distances(): Iterator[float] +edges(): ShapeList['Edge'] +export_brep(f: Union[str, BytesIO]): bool +export_step(file_name: str): IFSelect_ReturnStatus +export_stl(file_name: str, tolerance: float, angular_tolerance: float, ascii: bool): bool +faces(): ShapeList['Face'] +faces_intersected_by_line(point: VectorLike, axis: VectorLike, tol: float, direction: Direction): ShapeList[Face] +find_intersection(point: VectorLike, direction: VectorLike): list[tuple[Vector, Vector]] +fix(): Shape +fuse(): Shape +geom_type(): Geoms +hash_code(): int +import_brep(cls: Union[str, BytesIO], f): Shape +intersect(): Shape +is_equal(other: Shape): bool +is_null(): bool +is_same(other: Shape): bool +is_valid(): bool +locate(loc: Location): Shape +located(loc: Location): Shape +location(): Location +max_fillet(edge_list: Iterable[Edge], tolerance, max_iterations: int): float +mesh(tolerance: float, angular_tolerance: float) +mirror(mirror_plane: Plane): Shape +move(loc: Location): Shape +moved(loc: Location): Shape +project_text(txt: str, fontsize: float, depth: float, path: Union[Wire, Edge], font: str, font_path: str, kind: FontStyle, valign: Valign, start: float): Compound +rotate(axis: Axis, angle: float): Shape +scale(factor: float): Shape +shape_type(): Shapes +shells(): ShapeList['Shell'] +solids(): ShapeList['Solid'] +split(): Shape +tessellate(tolerance: float, angular_tolerance: float): Tuple[list[Vector], list[Tuple[int, int, int]]] +to_vtk_poly_data(tolerance: float, angular_tolerance: float, normals: bool): vtkPolyData +transform_geometry(t_matrix: Matrix): Shape +transform_shape(t_matrix: Matrix): Shape +transformed(rotate: VectorLike, offset: VectorLike): Shape +translate(vector: VectorLike): Shape +vertices(): ShapeList['Vertex'] +volume(): float +wires(): ShapeList['Wire'] build123d.direct_api.Compound->build123d.direct_api.Shape - - + + build123d.direct_api.Edge - -Edge - - -arc_center(): Vector -close(): Union[Edge, Wire] -distribute_locations(count: int, start: float, stop: float, positions_only: bool): list[Location] -make_circle(cls: float, radius: VectorLike, pnt: VectorLike, dir: float, angle1: float, angle2, orientation): Edge -make_ellipse(cls: float, x_radius: float, y_radius: VectorLike, pnt: VectorLike, dir: VectorLike, xdir: float, angle1: float, angle2: AngularDirection, angular_direction): Edge -make_line(cls: VectorLike, v1: VectorLike, v2): Edge -make_spline(cls: list[VectorLike], points: list[VectorLike], tangents: bool, periodic: list[float], parameters: bool, scale: float, tol): Edge -make_spline_approx(cls: list[VectorLike], points: float, tol: Tuple[float, float, float], smoothing: int, min_deg: int, max_deg): Edge -make_tangent_arc(cls: VectorLike, start: VectorLike, tangent: VectorLike, end): Edge -make_three_point_arc(cls: VectorLike, v1: VectorLike, v2: VectorLike, v3): Edge -project_to_shape(target_object: Shape, direction: VectorLike, center: VectorLike): list[Edge] -to_wire(): Wire + +Edge + + +arc_center(): Vector +close(): Union[Edge, Wire] +distribute_locations(count: int, start: float, stop: float, positions_only: bool): list[Location] +make_circle(cls: float, radius: VectorLike, pnt: VectorLike, dir: float, angle1: float, angle2, orientation): Edge +make_ellipse(cls: float, x_radius: float, y_radius: VectorLike, pnt: VectorLike, dir: VectorLike, xdir: float, angle1: float, angle2: AngularDirection, angular_direction): Edge +make_line(cls: VectorLike, v1: VectorLike, v2): Edge +make_spline(cls: list[VectorLike], points: list[VectorLike], tangents: bool, periodic: list[float], parameters: bool, scale: float, tol): Edge +make_spline_approx(cls: list[VectorLike], points: float, tol: Tuple[float, float, float], smoothing: int, min_deg: int, max_deg): Edge +make_tangent_arc(cls: VectorLike, start: VectorLike, tangent: VectorLike, end): Edge +make_three_point_arc(cls: VectorLike, v1: VectorLike, v2: VectorLike, v3): Edge +project_to_shape(target_object: Shape, direction: VectorLike, center: VectorLike): list[Edge] +to_wire(): Wire build123d.direct_api.Mixin1D - -Mixin1D - - -center(center_of: CenterOf): Vector -end_point(): Vector -is_closed(): bool -length(): float -location_at(distance: float, position_mode: PositionMode, frame_method: FrameMethod, planar: bool): Location -locations(ds: Iterable[float], position_mode: PositionMode, frame_method: FrameMethod, planar: bool): list[Location] -normal(): Vector -param_at(d: float): float -position_at(d: float, position_mode: PositionMode): Vector -positions(ds: Iterable[float], position_mode: PositionMode): list[Vector] -project(face: Face, d: VectorLike, closest: bool): Union[Mixin1D, list[Mixin1D]] -radius(): float -start_point(): Vector -tangent_at(location_param: float, position_mode: PositionMode): Vector + +Mixin1D + + +center(center_of: CenterOf): Vector +end_point(): Vector +is_closed(): bool +length(): float +location_at(distance: float, position_mode: PositionMode, frame_method: FrameMethod, planar: bool): Location +locations(ds: Iterable[float], position_mode: PositionMode, frame_method: FrameMethod, planar: bool): list[Location] +normal(): Vector +param_at(d: float): float +position_at(d: float, position_mode: PositionMode): Vector +positions(ds: Iterable[float], position_mode: PositionMode): list[Vector] +project(face: Face, d: VectorLike, closest: bool): Union[Mixin1D, list[Mixin1D]] +radius(): float +start_point(): Vector +tangent_at(location_param: float, position_mode: PositionMode): Vector build123d.direct_api.Edge->build123d.direct_api.Mixin1D - - + + build123d.direct_api.Edge->build123d.direct_api.Shape - - + + build123d.direct_api.Face - -Face - - -center(center_of: CenterOf): Vector -chamfer_2d(d: float, vertices: Iterable[Vertex]): Face -construct_on(cls: Face, f: Wire, outer): Face -fillet_2d(radius: float, vertices: Iterable[Vertex]): Face -inner_wires(): list[Wire] -is_inside(point: VectorLike, tolerance: float): bool -make_from_wires(cls: Wire, outer_wire: list[Wire], inner_wires): Face -make_holes(interior_wires: list[Wire]): Face -make_plane(cls: VectorLike, pnt: VectorLike, dir): Face -make_rect(cls: float, width: float, height: VectorLike, pnt: VectorLike, normal): Face -make_ruled_surface(cls: Edge, edge1: Edge, edge2): Face -make_surface(cls: Union[Wire, list[Edge]], exterior: list[VectorLike], surface_points: list[Wire], interior_wires): Face -make_surface_from_curves(cls, curve1, curve2): Face -make_surface_from_points(cls: list[list[VectorLike]], points: float, tol: Tuple[float, float, float], smoothing: int, min_deg: int, max_deg): Face -normal_at(location_vector: Vector): Vector -outer_wire(): Wire -project(other: Face, d: VectorLike): Face -project_to_shape(target_object: Shape, direction: VectorLike, center: VectorLike, internal_face_points: list[Vector]): list[Face] -thicken(depth: float, direction: Vector): Solid -to_pln(): gp_Pln + +Face + + +center(center_of: CenterOf): Vector +chamfer_2d(d: float, vertices: Iterable[Vertex]): Face +construct_on(cls: Face, f: Wire, outer): Face +fillet_2d(radius: float, vertices: Iterable[Vertex]): Face +inner_wires(): list[Wire] +is_inside(point: VectorLike, tolerance: float): bool +make_from_wires(cls: Wire, outer_wire: list[Wire], inner_wires): Face +make_holes(interior_wires: list[Wire]): Face +make_plane(cls: VectorLike, pnt: VectorLike, dir): Face +make_rect(cls: float, width: float, height: VectorLike, pnt: VectorLike, normal): Face +make_ruled_surface(cls: Edge, edge1: Edge, edge2): Face +make_surface(cls: Union[Wire, list[Edge]], exterior: list[VectorLike], surface_points: list[Wire], interior_wires): Face +make_surface_from_curves(cls, curve1, curve2): Face +make_surface_from_points(cls: list[list[VectorLike]], points: float, tol: Tuple[float, float, float], smoothing: int, min_deg: int, max_deg): Face +normal_at(surface_point: VectorLike): Vector +outer_wire(): Wire +project(other: Face, d: VectorLike): Face +project_to_shape(target_object: Shape, direction: VectorLike, center: VectorLike, internal_face_points: list[Vector]): list[Face] +thicken(depth: float, direction: VectorLike): Solid +to_pln(): gp_Pln build123d.direct_api.Face->build123d.direct_api.Shape - - + + build123d.direct_api.Location - -Location - -orientation -position -wrapped - -inverse(): Location -to_tuple(): tuple[tuple[float, float, float], tuple[float, float, float]] + +Location + +orientation +position +wrapped + +inverse(): Location +to_tuple(): tuple[tuple[float, float, float], tuple[float, float, float]] build123d.direct_api.Matrix - -Matrix - -wrapped : NoneType - -inverse(): Matrix -multiply(other: Vector): Vector -rotate_x(angle: float) -rotate_y(angle: float) -rotate_z(angle: float) -transposed_list(): Sequence[float] + +Matrix + +wrapped : NoneType + +inverse(): Matrix +multiply(other: Vector): Vector +rotate_x(angle: float) +rotate_y(angle: float) +rotate_z(angle: float) +transposed_list(): Sequence[float] build123d.direct_api.Matrix->build123d.direct_api.Plane - - -r_g + + +r_g build123d.direct_api.Matrix->build123d.direct_api.Plane - - -f_g + + +f_g build123d.direct_api.Matrix->build123d.direct_api.Plane - - -r_g + + +r_g build123d.direct_api.Matrix->build123d.direct_api.Plane - - -f_g + + +f_g build123d.direct_api.Rotation - -Rotation - -about_x : float -about_y : float -about_z : float - - + +Rotation + +about_x : float +about_y : float +about_z : float + + build123d.direct_api.Rotation->build123d.direct_api.Location - - + + build123d.direct_api.ShapeList - -ShapeList - - -filter_by(filter_by: Union[Axis, GeomType], reverse: bool, tolerance: float): ShapeList -filter_by_position(axis: Axis, minimum: float, maximum: float, inclusive: tuple[bool, bool]) -group_by(group_by: Union[Axis, SortBy], reverse, tol_digits) -sort_by(sort_by: Union[Axis, SortBy], reverse: bool) + +ShapeList + + +filter_by(filter_by: Union[Axis, GeomType], reverse: bool, tolerance: float): ShapeList +filter_by_position(axis: Axis, minimum: float, maximum: float, inclusive: tuple[bool, bool]) +group_by(group_by: Union[Axis, SortBy], reverse, tol_digits) +sort_by(sort_by: Union[Axis, SortBy], reverse: bool) build123d.direct_api.Shell - -Shell - - -make_shell(cls: Iterable[Face], list_of_faces): Shell + +Shell + + +make_shell(cls: Iterable[Face], list_of_faces): Shell build123d.direct_api.Shell->build123d.direct_api.Shape - - + + build123d.direct_api.Solid - -Solid - - -center(center_of: CenterOf): Vector -extrude_linear(cls: Union[Face, Wire], section: VectorLike, normal: list[Wire], inner_wires: float, taper): Solid -extrude_linear_with_rotation(cls: Union[Face, Wire], section: VectorLike, center: VectorLike, normal: float, angle: list[Wire], inner_wires): Solid -is_solid(obj): bool -make_box(cls: float, length: float, width: float, height: VectorLike, pnt: VectorLike, dir): Solid -make_cone(cls: float, radius1: float, radius2: float, height: VectorLike, pnt: VectorLike, dir: float, angle): Solid -make_cylinder(cls: float, radius: float, height: VectorLike, pnt: VectorLike, dir: float, angle): Solid -make_loft(cls: list[Wire], list_of_wire: bool, ruled): Solid -make_solid(cls: Shell, shell): Solid -make_sphere(cls: float, radius: VectorLike, pnt: VectorLike, dir: float, angle1: float, angle2: float, angle3): Shape -make_torus(cls: float, radius1: float, radius2: VectorLike, pnt: VectorLike, dir: float, angle1: float, angle2): Solid -make_wedge(cls: float, dx: float, dy: float, dz: float, xmin: float, zmin: float, xmax: float, zmax: VectorLike, pnt: VectorLike, dir): Solid -revolve(cls: Union[Face, Wire], section: float, angle: Axis, axis: list[Wire], inner_wires): Solid -sweep(cls: Union[Face, Wire], section: Union[Wire, Edge], path: list[Wire], inner_wires: bool, make_solid: bool, is_frenet: Union[Vector, Wire, Edge, None], mode: Transition, transition): Solid -sweep_multi(cls: Iterable[Union[Wire, Face]], profiles: Union[Wire, Edge], path: bool, make_solid: bool, is_frenet: Union[Vector, Wire, Edge, None], mode): Solid + +Solid + + +center(center_of: CenterOf): Vector +extrude_linear(cls: Union[Face, Wire], section: VectorLike, normal: list[Wire], inner_wires: float, taper): Solid +extrude_linear_with_rotation(cls: Union[Face, Wire], section: VectorLike, center: VectorLike, normal: float, angle: list[Wire], inner_wires): Solid +is_solid(obj): bool +make_box(cls: float, length: float, width: float, height: VectorLike, pnt: VectorLike, dir): Solid +make_cone(cls: float, radius1: float, radius2: float, height: VectorLike, pnt: VectorLike, dir: float, angle): Solid +make_cylinder(cls: float, radius: float, height: VectorLike, pnt: VectorLike, dir: float, angle): Solid +make_loft(cls: list[Wire], list_of_wire: bool, ruled): Solid +make_solid(cls: Shell, shell): Solid +make_sphere(cls: float, radius: VectorLike, pnt: VectorLike, dir: float, angle1: float, angle2: float, angle3): Shape +make_torus(cls: float, radius1: float, radius2: VectorLike, pnt: VectorLike, dir: float, angle1: float, angle2): Solid +make_wedge(cls: float, dx: float, dy: float, dz: float, xmin: float, zmin: float, xmax: float, zmax: VectorLike, pnt: VectorLike, dir): Solid +revolve(cls: Union[Face, Wire], section: float, angle: Axis, axis: list[Wire], inner_wires): Solid +sweep(cls: Union[Face, Wire], section: Union[Wire, Edge], path: list[Wire], inner_wires: bool, make_solid: bool, is_frenet: Union[Vector, Wire, Edge, None], mode: Transition, transition): Solid +sweep_multi(cls: Iterable[Union[Wire, Face]], profiles: Union[Wire, Edge], path: bool, make_solid: bool, is_frenet: Union[Vector, Wire, Edge, None], mode): Solid build123d.direct_api.Solid->build123d.direct_api.Mixin3D - - + + build123d.direct_api.Solid->build123d.direct_api.Shape - - + + build123d.direct_api.Vector - -Vector - + +Vector + +X X -X +Y Y -Y -Z +Z +vector_index : int wrapped add(v: Vector): Vector @@ -466,128 +469,128 @@ build123d.direct_api.Vector->build123d.direct_api.Axis - - -position + + +position build123d.direct_api.Vector->build123d.direct_api.Axis - - -direction + + +direction build123d.direct_api.Vector->build123d.direct_api.Plane - - -z_dir + + +z_dir build123d.direct_api.Vector->build123d.direct_api.Plane - - -z_dir + + +z_dir build123d.direct_api.Vector->build123d.direct_api.Plane - - -x_dir + + +x_dir build123d.direct_api.Vector->build123d.direct_api.Plane - - -x_dir + + +x_dir build123d.direct_api.Vector->build123d.direct_api.Plane - - -y_dir + + +y_dir build123d.direct_api.Vector->build123d.direct_api.Plane - - -origin + + +origin build123d.direct_api.Vector->build123d.direct_api.Plane - - -_origin + + +_origin build123d.direct_api.Vector->build123d.direct_api.Plane - - -_origin + + +_origin build123d.direct_api.Vertex - -Vertex - -X -Y -Z -for_construction : bool -wrapped - -center(): Vector -to_tuple(): tuple[float, float, float] -to_vector(): Vector + +Vertex + +X +Y +Z +for_construction : bool +wrapped + +center(): Vector +to_tuple(): tuple[float, float, float] +to_vector(): Vector build123d.direct_api.Vertex->build123d.direct_api.Shape - - + + build123d.direct_api.Wire - -Wire - - -chamfer_2d(d: float, vertices: Iterable[Vertex]): Wire -close(): Wire -combine(cls: Iterable[Union[Wire, Edge]], list_of_wires: float, tol): list[Wire] -fillet_2d(radius: float, vertices: Iterable[Vertex]): Wire -make_circle(cls: float, radius: VectorLike, center: VectorLike, normal): Wire -make_ellipse(cls: float, x_radius: float, y_radius: VectorLike, center: VectorLike, normal: VectorLike, x_dir: float, angle1: float, angle2: bool, closed): Wire -make_helix(cls: float, pitch: float, height: float, radius: VectorLike, center: VectorLike, normal: float, angle: bool, lefthand): Wire -make_polygon(cls: Iterable[VectorLike], vertices: bool, close): Wire -make_rect(width: float, height: VectorLike, pnt: VectorLike, normal): Wire -make_wire(cls: Iterable[Edge], edges: bool, sequenced): Wire -offset_2d(d: float, kind: Kind): list[Wire] -project_to_shape(target_object: Shape, direction: VectorLike, center: VectorLike): list[Wire] -stitch(other: Wire): Wire -to_wire(): Wire + +Wire + + +chamfer_2d(d: float, vertices: Iterable[Vertex]): Wire +close(): Wire +combine(cls: Iterable[Union[Wire, Edge]], list_of_wires: float, tol): list[Wire] +fillet_2d(radius: float, vertices: Iterable[Vertex]): Wire +make_circle(cls: float, radius: VectorLike, center: VectorLike, normal): Wire +make_ellipse(cls: float, x_radius: float, y_radius: VectorLike, center: VectorLike, normal: VectorLike, x_dir: float, angle1: float, angle2: bool, closed): Wire +make_helix(cls: float, pitch: float, height: float, radius: VectorLike, center: VectorLike, normal: float, angle: bool, lefthand): Wire +make_polygon(cls: Iterable[VectorLike], vertices: bool, close): Wire +make_rect(width: float, height: VectorLike, pnt: VectorLike, normal): Wire +make_wire(cls: Iterable[Edge], edges: bool, sequenced): Wire +offset_2d(d: float, kind: Kind): list[Wire] +project_to_shape(target_object: Shape, direction: VectorLike, center: VectorLike): list[Wire] +stitch(other: Wire): Wire +to_wire(): Wire build123d.direct_api.Wire->build123d.direct_api.Mixin1D - - + + build123d.direct_api.Wire->build123d.direct_api.Shape - - + + diff --git a/src/build123d/direct_api.py b/src/build123d/direct_api.py index 9347122..2ae7c21 100644 --- a/src/build123d/direct_api.py +++ b/src/build123d/direct_api.py @@ -7,7 +7,7 @@ TODO: from __future__ import annotations import os import sys -from math import pi, sqrt, inf, radians +from math import pi, sqrt, inf, radians, degrees import warnings import logging import copy @@ -1222,7 +1222,7 @@ class Rotation(Location): rot_y.SetRotation(gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(0, 1, 0)), radians(about_y)) rot_z = gp_Trsf() rot_z.SetRotation(gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), radians(about_z)) - super().__init__(Location(rot_x * rot_y * rot_z).wrapped) + super().__init__(rot_x * rot_y * rot_z) #:TypeVar("RotationLike"): Three tuple of angles about x, y, z or Rotation @@ -1927,6 +1927,50 @@ class Shape: # Helps identify this solid through the use of an ID self.label: str = "" + @property + def position(self) -> Vector: + """Get the position component of this Shape's Location""" + return Location(self.wrapped.Location()).position + + @position.setter + def position(self, value: VectorLike): + """Set the position component of this Shape's Location to value""" + gp_trsf = self.wrapped.Location().Transformation() + gp_trsf.SetTranslation(Vector(value).wrapped) + new_location = Location(gp_trsf) + self.wrapped.Location(new_location.wrapped) + + @property + def orientation(self) -> Vector: + """Get the orientation component of this Shape's Location""" + return Vector( + *[degrees(v) for v in Location(self.wrapped.Location()).orientation] + ) + + @orientation.setter + def orientation(self, rotations: RotationLike): + """Set the orientation component of this Shape's Location to rotations""" + + rotations = Rotation(*rotations) if isinstance(rotations, tuple) else rotations + + t_o = gp_Trsf() + t_o.SetTranslationPart(self.position.wrapped) + t_rx = gp_Trsf() + t_rx.SetRotation( + gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(1, 0, 0)), radians(rotations.about_x) + ) + t_ry = gp_Trsf() + t_ry.SetRotation( + gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(0, 1, 0)), radians(rotations.about_y) + ) + t_rz = gp_Trsf() + t_rz.SetRotation( + gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), radians(rotations.about_z) + ) + + new_location = Location(t_o * t_rx * t_ry * t_rz) + self.wrapped.Location(new_location.wrapped) + def clean(self) -> Shape: """clean