thickness = 30

# The points we'll use to create the profile of the bottle's body
aPnt1 = gp_Pnt(-width / 2.0, 0, 0)
aPnt2 = gp_Pnt(-width / 2.0, -thickness / 4.0, 0)
aPnt3 = gp_Pnt(0, -thickness / 2.0, 0)
aPnt4 = gp_Pnt(width / 2.0, -thickness / 4.0, 0)
aPnt5 = gp_Pnt(width / 2.0, 0, 0)

aArcOfCircle = GC_MakeArcOfCircle(aPnt2, aPnt3, aPnt4)
aSegment1 = GC_MakeSegment(aPnt1, aPnt2)
aSegment2 = GC_MakeSegment(aPnt4, aPnt5)

# Could also construct the line edges directly using the points
# instead of the resulting line
aEdge1 = BRepBuilderAPI_MakeEdge(aSegment1.Value())
aEdge2 = BRepBuilderAPI_MakeEdge(aArcOfCircle.Value())
aEdge3 = BRepBuilderAPI_MakeEdge(aSegment2.Value())

# Create a wire out of the edges
aWire = BRepBuilderAPI_MakeWire(aEdge1.Edge(), aEdge2.Edge(), aEdge3.Edge())

# Quick way to specify the X axis
xAxis = gp_OX()

# Set up the mirror
aTrsf = gp_Trsf()
aTrsf.SetMirror(xAxis)

# Apply the mirror transformation
aBRespTrsf = BRepBuilderAPI_Transform(aWire.Wire(), aTrsf)
Esempio n. 2
0
myThickness = 30

# Profile : Define Support Points
aPnt1 = gp_Pnt(-myWidth / 2, 0, 0)
aPnt2 = gp_Pnt(-myWidth / 2, -myThickness / 4, 0)
aPnt3 = gp_Pnt(0, -myThickness / 2, 0)
aPnt4 = gp_Pnt(myWidth / 2, -myThickness / 4, 0)
aPnt5 = gp_Pnt(myWidth / 2, 0, 0)

# Profile : Define the Geometry
aArcOfCircle = GC_MakeArcOfCircle(aPnt2, aPnt3, aPnt4)
aSegment1 = GC_MakeSegment(aPnt1, aPnt2)
aSegment2 = GC_MakeSegment(aPnt4, aPnt5)

# Profile : Define the Topology
aEdge1 = MakeEdge(aSegment1.Value())
aEdge2 = MakeEdge(aArcOfCircle.Value())
aEdge3 = MakeEdge(aSegment2.Value())
aWire = MakeWire(aEdge1.Edge(), aEdge2.Edge(), aEdge3.Edge())

# Complete Profile
xAxis = OCC.gp.gp_OX()
aTrsf = OCC.gp.gp_Trsf()
aTrsf.SetMirror(xAxis)
aBRepTrsf = Transform(aWire.Wire(), aTrsf)
aMirroredShape = aBRepTrsf.Shape()
aMirroredWire = OCC.TopoDS.TopoDS_Shape(aMirroredShape)
aMirroredWire = OCC.TopoDS.topods().Wire(aMirroredWire)

mkWire = MakeWire()
mkWire.Add(aWire.Wire())