MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / Activated

Method Activated

src/Mod/BIM/ArchStructure.py:176–207  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

174 return not FreeCAD.ActiveDocument is None
175
176 def Activated(self):
177 sel = FreeCADGui.Selection.getSelection()
178 if sel:
179 st = Draft.getObjectsOfType(sel, "Structure")
180 ax = Draft.getObjectsOfType(sel, "Axis")
181 if ax:
182 FreeCAD.ActiveDocument.openTransaction(
183 translate("Arch", "Create Structural System")
184 )
185 FreeCADGui.addModule("Arch")
186 if st:
187 FreeCADGui.doCommand(
188 "obj = Arch.makeStructuralSystem("
189 + ArchCommands.getStringList(st)
190 + ", "
191 + ArchCommands.getStringList(ax)
192 + ")"
193 )
194 else:
195 FreeCADGui.doCommand(
196 "obj = Arch.makeStructuralSystem(axes = "
197 + ArchCommands.getStringList(ax)
198 + ")"
199 )
200 FreeCADGui.addModule("Draft")
201 FreeCADGui.doCommand("Draft.autogroup(obj)")
202 FreeCAD.ActiveDocument.commitTransaction()
203 FreeCAD.ActiveDocument.recompute()
204 else:
205 FreeCAD.Console.PrintError(
206 translate("Arch", "Select at least an axis object") + "\n"
207 )
208
209
210class _CommandStructure:

Callers

nothing calls this directly

Calls 8

translateFunction · 0.90
getStringListMethod · 0.80
getSelectionMethod · 0.45
getObjectsOfTypeMethod · 0.45
openTransactionMethod · 0.45
addModuleMethod · 0.45
commitTransactionMethod · 0.45
recomputeMethod · 0.45

Tested by

no test coverage detected