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

Class Solid

cadquery/occ_impl/shapes.py:4164–4757  ·  view source on GitHub ↗

a single solid

Source from the content-addressed store, hash-verified

4162
4163
4164class Solid(Shape, Mixin3D):
4165 """
4166 a single solid
4167 """
4168
4169 wrapped: TopoDS_Solid
4170
4171 @staticmethod
4172 def isSolid(obj: Shape) -> bool:
4173 """
4174 Returns true if the object is a solid, false otherwise
4175 """
4176 if hasattr(obj, "ShapeType"):
4177 if obj.ShapeType() == "Solid" or (
4178 obj.ShapeType() == "Compound" and len(obj.Solids()) > 0
4179 ):
4180 return True
4181 return False
4182
4183 @classmethod
4184 def makeSolid(cls, shell: Shell) -> Solid:
4185 """
4186 Makes a solid from a single shell.
4187 """
4188
4189 return cls(ShapeFix_Solid().SolidFromShell(shell.wrapped))
4190
4191 @classmethod
4192 def makeBox(
4193 cls,
4194 length: float,
4195 width: float,
4196 height: float,
4197 pnt: VectorLike = Vector(0, 0, 0),
4198 dir: VectorLike = Vector(0, 0, 1),
4199 ) -> Solid:
4200 """
4201 makeBox(length,width,height,[pnt,dir]) -- Make a box located in pnt with the dimensions (length,width,height)
4202 By default pnt=Vector(0,0,0) and dir=Vector(0,0,1)
4203 """
4204 return cls(
4205 BRepPrimAPI_MakeBox(
4206 gp_Ax2(Vector(pnt).toPnt(), Vector(dir).toDir()), length, width, height
4207 ).Shape()
4208 )
4209
4210 @classmethod
4211 def makeCone(
4212 cls,
4213 radius1: float,
4214 radius2: float,
4215 height: float,
4216 pnt: VectorLike = Vector(0, 0, 0),
4217 dir: VectorLike = Vector(0, 0, 1),
4218 angleDegrees: float = 360,
4219 ) -> Solid:
4220 """
4221 Make a cone with given radii and height

Callers 3

SolidsMethod · 0.85
thickenMethod · 0.85
imprintFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected