Skip to content

Commit

Permalink
Merge branch 'FreeCAD:main' into fontweight
Browse files Browse the repository at this point in the history
  • Loading branch information
obelisk79 authored Feb 10, 2024
2 parents 5f743f7 + ad2fb73 commit e3c605c
Show file tree
Hide file tree
Showing 7 changed files with 475 additions and 108 deletions.
1 change: 0 additions & 1 deletion src/Mod/Draft/draftguitools/gui_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ def startEditing(self, obj, node_idx):
+ str(node_idx) + "\n")

self.ui.lineUi(title=translate("draft", "Edit node"), icon="Draft_Edit")
self.ui.isRelative.hide()
self.ui.continueCmd.hide()
self.editing = node_idx
self.trackers[obj.Name][node_idx].off()
Expand Down
26 changes: 14 additions & 12 deletions src/Mod/Draft/draftobjects/shapestring.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,20 @@ def execute(self, obj):

fill = obj.MakeFace
if fill is True:
# test a simple letter to know if we have a sticky font or not
# if font is sticky change fill to `False`
test_wire = Part.makeWireString("L", obj.FontFile, obj.Size, obj.Tracking)[0][0]
if test_wire.isClosed:
try:
test_face = Part.Face(test_wire)
except Part.OCCError:
fill = False
else:
fill = test_face.isValid() and test_face.Area > 1e-7
else:
# Test a simple letter to know if we have a sticky font or not.
# If the font is sticky change fill to `False`.
# The 0.03 total area minimum is based on tests with:
# 1CamBam_Stick_0.ttf and 1CamBam_Stick_0C.ttf.
# See the make_faces function for more information.
char = Part.makeWireString("L", obj.FontFile, 1, 0)[0]
shapes = self.make_faces(char) # char is list of wires
if not shapes:
fill = False
else:
fill = sum([shape.Area for shape in shapes]) > 0.03\
and math.isclose(Part.Compound(char).BoundBox.DiagonalLength,
Part.Compound(shapes).BoundBox.DiagonalLength,
rel_tol=1e-7)

chars = Part.makeWireString(obj.String, obj.FontFile, obj.Size, obj.Tracking)
shapes = []
Expand All @@ -154,7 +156,7 @@ def execute(self, obj):
elif char:
shapes.extend(self.make_faces(char))
if shapes:
if obj.MakeFace and obj.Fuse:
if fill and obj.Fuse:
ss_shape = shapes[0].fuse(shapes[1:])
ss_shape = faces.concatenate(ss_shape)
else:
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Draft/importDXF.py
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ def drawSpline(spline, forceShape=False):
-------
Part::Part2DObject or Part::TopoShape ('Edge', 'Face')
The returned object is normally a `Draft BezCurve`
created with `Draft.make_bezcurve(controlpoints, Degree=degree)`,
created with `Draft.make_bezcurve(controlpoints, degree=degree)`,
if `forceShape` is `False` and there are no weights.
Otherwise it tries to return a `Part.Shape` of type `'Wire'`,
Expand Down Expand Up @@ -1530,7 +1530,7 @@ def drawSpline(spline, forceShape=False):
if not forceShape and weights is None:
points = controlpoints[:]
del points[degree+1::degree+1]
return Draft.make_bezcurve(points, Degree=degree)
return Draft.make_bezcurve(points, degree=degree)
else:
poles = controlpoints[:]
edges = []
Expand Down
1 change: 1 addition & 0 deletions src/Mod/Part/App/OpenCascadeAll.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@

#include <BRepAlgo.hxx>
#include <BRepAlgo_NormalProjection.hxx>
#include <BRepAlgoAPI_BooleanOperation.hxx>
#include <BRepAlgoAPI_Common.hxx>
#include <BRepAlgoAPI_Cut.hxx>
# include <BRepAlgoAPI_Defeaturing.hxx>
Expand Down
55 changes: 55 additions & 0 deletions src/Mod/Part/App/TopoShape.h
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,61 @@ class PartExport TopoShape: public Data::ComplexGeoData
return TopoShape(Tag, Hasher).makeElementCopy(*this, op, copyGeom, copyMesh);
}


/** Generalized shape making with mapped element name from shape history
*
* @param maker: op code from OpCodes
* @param sources: list of source shapes.
* @param op: optional string to be encoded into topo naming for indicating
* the operation
* @param tol: tolerance option available to some shape making algorithm
*
* @return The original content of this TopoShape is discarded and replaced
* with the new shape built by the shape maker. The function
* returns the TopoShape itself as a self reference so that
* multiple operations can be carried out for the same shape in the
* same line of code.
*/
TopoShape& makeElementBoolean(const char* maker,
const std::vector<TopoShape>& sources,
const char* op = nullptr,
double tol = 0.0);
/** Generalized shape making with mapped element name from shape history
*
* @param maker: op code from TopoShapeOpCodes
* @param source: source shape.
* @param op: optional string to be encoded into topo naming for indicating
* the operation
* @param tol: tolerance option available to some shape making algorithm
*
* @return The original content of this TopoShape is discarded and replaced
* with the new shape built by the shape maker. The function
* returns the TopoShape itself as a self reference so that
* multiple operations can be carried out for the same shape in the
* same line of code.
*/
TopoShape& makeElementBoolean(const char* maker,
const TopoShape& source,
const char* op = nullptr,
double tol = 0.0);

/** Generalized shape making with mapped element name from shape history
*
* @param maker: op code from TopoShapeOpCodes
* @param op: optional string to be encoded into topo naming for indicating
* the operation
* @param tol: tolerance option available to some shape making algorithm
*
* @return Returns the new shape with mappend element name generated from
* shape history using this shape as the source. The shape itself
* is not modified.
*/
TopoShape
makeElementBoolean(const char* maker, const char* op = nullptr, double tol = 0.0) const
{
return TopoShape(0, Hasher).makeElementBoolean(maker, *this, op, tol);
}

/* Make a shell using this shape
* @param silent: whether to throw exception on failure
* @param op: optional string to be encoded into topo naming for indicating
Expand Down
Loading

0 comments on commit e3c605c

Please sign in to comment.