Skip to content

Commit

Permalink
Toponaming: Cleanup review notes
Browse files Browse the repository at this point in the history
  • Loading branch information
bgbsww authored and chennes committed Jul 24, 2024
1 parent 5084e6c commit 6a5207f
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Mod/PartDesign/App/FeatureLoft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,11 @@ Loft::getSectionShape(const char *name,
<< App::SubObjectT(obj, sub.c_str()).getSubObjectFullName(obj->getDocument()->getName()));
}
}
auto compound = TopoShape().makeElementCompound(shapes, "", TopoShape::SingleShapeCompoundCreationPolicy::returnShape);
auto compound = TopoShape(0).makeElementCompound(shapes, "", TopoShape::SingleShapeCompoundCreationPolicy::returnShape);
auto wires = compound.getSubTopoShapes(TopAbs_WIRE);
auto edges = compound.getSubTopoShapes(TopAbs_EDGE, TopAbs_WIRE); // get free edges and make wires from it
if (edges.size()) {
auto extra = TopoShape().makeElementWires(edges).getSubTopoShapes(TopAbs_WIRE);
auto extra = TopoShape(0).makeElementWires(edges).getSubTopoShapes(TopAbs_WIRE);
wires.insert(wires.end(), extra.begin(), extra.end());
}
const char *msg = "Sections need to have the same amount of wires or vertices as the base section";
Expand Down
77 changes: 77 additions & 0 deletions src/Mod/PartDesign/PartDesignTests/TestLoft.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,83 @@ def testClosedAdditiveLoftCase(self):

self.assertGreater(loft.Shape.Volume, 80000.0) # 85105.5788704151

def testLoftBetweenCones(self):
""" Test issue #15138 adapted from a script by chennes """
body = self.Doc.addObject('PartDesign::Body','Body')
body.Label = 'Body'
coneBottomSketch = body.newObject('Sketcher::SketchObject','ConeBottomSketch')
coneBottomSketch.AttachmentSupport = (self.Doc.getObject('XY_Plane'),[''])
coneBottomSketch.MapMode = 'FlatFace'

geoList = []
geoList.append(Part.Circle(Base.Vector(0.000000, 0.000000, 0.000000), Base.Vector(0.000000, 0.000000, 1.000000), 25.000000))
coneBottomSketch.addGeometry(geoList,False)
del geoList

constraintList = []
coneBottomSketch.addConstraint(Sketcher.Constraint('Diameter',0,25.000000))
coneBottomSketch.addConstraint(Sketcher.Constraint('Coincident', 0, 3, -1, 1))

geoList = []
geoList.append(Part.Circle(Base.Vector(0.000000, 0.000000, 0.000000), Base.Vector(0.000000, 0.000000, 1.000000), 40.000000))
coneBottomSketch.addGeometry(geoList,False)
del geoList

constraintList = []
coneBottomSketch.addConstraint(Sketcher.Constraint('Diameter',1,40.000000))
coneBottomSketch.addConstraint(Sketcher.Constraint('Coincident', 1, 3, 0, 3))

coneTopSketch = body.newObject('Sketcher::SketchObject','ConeTopSketch')
coneTopSketch.AttachmentSupport = (self.Doc.getObject('XY_Plane'),[''])
coneTopSketch.MapMode = 'FlatFace'

geoList = []
geoList.append(Part.Circle(Base.Vector(0.000000, 0.000000, 0.000000), Base.Vector(0.000000, 0.000000, 1.000000), 8.000000))
coneTopSketch.addGeometry(geoList,False)
del geoList

constraintList = []
coneTopSketch.addConstraint(Sketcher.Constraint('Diameter',0,8.000000))
coneTopSketch.addConstraint(Sketcher.Constraint('Coincident', 0, 3, -1, 1))

geoList = []
geoList.append(Part.Circle(Base.Vector(0.000000, 0.000000, 0.000000), Base.Vector(0.000000, 0.000000, 1.000000), 15.000000))
coneTopSketch.addGeometry(geoList,False)
del geoList

constraintList = []
coneTopSketch.addConstraint(Sketcher.Constraint('Diameter',1,15.000000))
coneTopSketch.addConstraint(Sketcher.Constraint('Coincident', 1, 3, 0, 3))
coneTopSketch.AttachmentOffset = Base.Placement(Base.Vector(0,0,20),Base.Rotation(Base.Vector(0,0,1),0))
self.Doc.recompute()

cone = body.newObject('PartDesign::AdditiveLoft','Cone')
cone.Profile = coneBottomSketch
cone.Sections += [(coneTopSketch, [''])]
coneBottomSketch.Visibility = False
coneTopSketch.Visibility = False
self.Doc.recompute()

pad = body.newObject('PartDesign::Pad','Pad')
pad.Profile = (cone, ['Face4',])
pad.Length = 10.000000
pad.TaperAngle = 0.000000
pad.UseCustomVector = 0
pad.Direction = (0, 0, 1)
pad.ReferenceAxis = None
pad.AlongSketchNormal = 1
pad.Type = 0
pad.UpToFace = None
pad.Reversed = 0
pad.Midplane = 0
pad.Offset = 0
cone.Visibility = True
self.Doc.recompute()

self.assertAlmostEqual(cone.Shape.Volume, 5854.5823094398365)
# self.assertAlmostEqual(body.Shape.Volume, 5854.5823094398365) # TODO: is this supposed to be?
# self.assertAlmostEqual(pad.Shape.Volume, 5854.5823094398365) # TODO: how about this one?

def tearDown(self):
#closing doc
FreeCAD.closeDocument("PartDesignTestLoft")
Expand Down

0 comments on commit 6a5207f

Please sign in to comment.