BIM+Draft: Bring back human figure

* For the human figure attached to the Draft grid a hard-coded point list is used (instead deriving the points from human figure.brep). This is more efficient and avoids a dependency on the BIM WB.
* The default for the human figure preference of the grid was changed to false. And the tooltip adjusted.
This commit is contained in:
Roy-043
2024-11-21 14:11:54 +01:00
committed by Yorik van Havre
parent 7ff12bace9
commit af71f75b9a
5 changed files with 1644 additions and 41 deletions

View File

@@ -3,14 +3,13 @@
import os
txt = "<RCC>\n <qresource>\n"
cdir = os.path.dirname(__file__)
for subdir in ["icons/IFC", "icons", "ui", "translations"]:
for subdir in ["geometry", "icons", "icons/IFC", "translations", "ui"]:
subpath = os.path.join(cdir, subdir)
for f in sorted(os.listdir(subpath)):
if f not in ["Arch.ts", "BIM.ts", "IFC"]:
ext = os.path.splitext(f)[1]
if ext.lower() in [".qm", ".svg", ".ui", ".png"]:
if ext.lower() in [".qm", ".svg", ".ui", ".png", "brep"]:
txt += " <file>" + subdir + "/" + f + "</file>\n"
txt += " </qresource>\n</RCC>\n"
with open(os.path.join(cdir, "Arch.qrc"), "w") as resfile:
resfile.write(txt)

File diff suppressed because one or more lines are too long

View File

@@ -130,16 +130,11 @@ class BIM_ProjectManager:
).Value
human = None
if self.form.addHumanFigure.isChecked():
# TODO ; fix loading of human shape
humanpath = os.path.join(
os.path.dirname(__file__), "geometry", "human figure.brep"
)
if os.path.exists(humanpath):
humanshape = Part.Shape()
humanshape.importBrep(humanpath)
human = FreeCAD.ActiveDocument.addObject("Part::Feature", "Human")
human.Shape = humanshape
human.Placement.move(FreeCAD.Vector(500, 500, 0))
humanshape = Part.Shape()
humanshape.importBrep(":/geometry/HumanFigure.brep")
human = FreeCAD.ActiveDocument.addObject("Part::Feature", "Human")
human.Shape = humanshape
human.Placement.move(FreeCAD.Vector(500, 500, 0))
if self.form.groupBuilding.isChecked():
building = Arch.makeBuilding()
if site:
@@ -714,19 +709,4 @@ class BIM_ProjectManager:
self.reject()
def getHuman(loc=None):
"""Return a list of points defining a human figure,
optionally translated to a given location"""
import Part
humanshape = Part.Shape()
humanpath = os.path.join(os.path.dirname(__file__), "geometry", "human figure.brep")
humanshape.importBrep(humanpath)
pts = [v.Point for v in humanshape.Vertexes]
if loc:
pts = [p.add(loc) for p in pts]
return pts
FreeCADGui.addCommand("BIM_ProjectManager", BIM_ProjectManager())