MCPcopy
hub / github.com/CadQuery/cadquery / Vertex

Class Vertex

cadquery/occ_impl/shapes.py:2003–2033  ·  view source on GitHub ↗

A Single Point in Space

Source from the content-addressed store, hash-verified

2001
2002
2003class Vertex(Shape):
2004 """
2005 A Single Point in Space
2006 """
2007
2008 wrapped: TopoDS_Vertex
2009
2010 def __init__(self, obj: TopoDS_Shape, forConstruction: bool = False) -> None:
2011 """
2012 Create a vertex
2013 """
2014 super(Vertex, self).__init__(obj)
2015
2016 self.forConstruction = forConstruction
2017 self.X, self.Y, self.Z = self.toTuple()
2018
2019 def toTuple(self) -> tuple[float, float, float]:
2020
2021 geom_point = BRep_Tool.Pnt_s(self.wrapped)
2022 return (geom_point.X(), geom_point.Y(), geom_point.Z())
2023
2024 def Center(self) -> Vector:
2025 """
2026 The center of a vertex is itself!
2027 """
2028 return Vector(self.toTuple())
2029
2030 @classmethod
2031 def makeVertex(cls, x: float, y: float, z: float) -> Vertex:
2032
2033 return cls(BRepBuilderAPI_MakeVertex(gp_Pnt(x, y, z)).Vertex())
2034
2035
2036ParamMode = Literal["length", "parameter"]

Callers 4

VerticesMethod · 0.85
startPointMethod · 0.85
endPointMethod · 0.85
VerticesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected