[Freecad] Реализован интерфейс добавления свойства (property) к фрейм объекту"

This commit is contained in:
brothermechanic 2023-04-12 09:19:17 +00:00 committed by Igor Brylyov
parent b744fe30a0
commit 7f13c0056f
4 changed files with 32 additions and 13 deletions

View file

@ -174,10 +174,14 @@ def spawnClassCommand(classname, function, resources):
def getLocalPartProps(obj):
old_placement = obj.Placement
obj_parent_label = ''
if obj.getParentGeoFeatureGroup():
obj_parent_label = obj.getParentGeoFeatureGroup().Label
# obj.Placement = FreeCAD.Placement()
""" Part properties """
partprops = {
"label": obj.Label,
"parent_label": obj_parent_label,
"placement": placement2pose(old_placement),
# "boundingbox": boundingBox2list(obj.Shape.BoundBox),
# "volume": obj.Shape.Volume*1e-9,
@ -465,7 +469,7 @@ def exportFeatureFramesDialogue():
FreeCAD.Console.PrintMessage("Feature frames of " + str(unique_selected[0].Label) + " exported to " + str(ofile) + "\n")
def exportPartInfoAndFeaturesDialogue():
def exportPlacementAndProperties():
"""Spawns a dialogue window for exporting both."""
import Frames
s = FreeCADGui.Selection.getSelection()
@ -534,11 +538,11 @@ uidir = os.path.join(FreeCAD.getUserAppDataDir(),
"Mod", __workbenchname__, "UI")
icondir = os.path.join(uidir, "icons")
spawnClassCommand("ExportPartInfoAndFeaturesDialogueCommand",
exportPartInfoAndFeaturesDialogue,
spawnClassCommand("ExportPlacementAndPropertiesCommand",
exportPlacementAndProperties,
{"Pixmap": str(os.path.join(icondir, "parttojson.svg")),
"MenuText": "Export info and featureframes",
"ToolTip": "Export part properties (placement, C.O.M) and feature frames"})
"MenuText": "Export placement and properties",
"ToolTip": "Export object placement and properties and feature frames"})
spawnClassCommand("ExportGazeboModels",
exportGazeboModels,