Skip to content

Commit

Permalink
Support macros and console logs in Assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
bgbsww committed Sep 21, 2024
1 parent d7a922c commit 163f9b3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/Mod/Assembly/CommandCreateAssembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def Activated(self):
App.setActiveTransaction("Create assembly")

activeAssembly = UtilsAssembly.activeAssembly()
Gui.addModule("UtilsAssembly")
if activeAssembly:
commands = (
"activeAssembly = UtilsAssembly.activeAssembly()\n"
Expand Down
1 change: 1 addition & 0 deletions src/Mod/Assembly/CommandCreateBom.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ def isNameDuplicate(self, name):

def createBomObject(self):
assembly = UtilsAssembly.activeAssembly()
Gui.addModule("UtilsAssembly")
if assembly is not None:
commands = (
"bom_group = UtilsAssembly.getBomGroup(assembly)\n"
Expand Down
20 changes: 13 additions & 7 deletions src/Mod/Assembly/CommandInsertLink.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@ def IsActive(self):
def Activated(self):
Gui.addModule("UtilsAssembly")

Check failure on line 79 in src/Mod/Assembly/CommandInsertLink.py

View workflow job for this annotation

GitHub Actions / Lint / Lint

Possibly using variable 'Gui' before assignment (possibly-used-before-assignment)
Gui.addModule("CommandInsertLink")
Gui.doCommand("assembly = UtilsAssembly.activeAssembly()")
if not Gui.doCommandEval("assembly"):
if not UtilsAssembly.activeAssembly():
return
Gui.doCommand("view = Gui.activeDocument().activeView()")

Gui.doCommand("panel = CommandInsertLink.TaskAssemblyInsertLink(assembly, view)")
commands = (
"assembly = UtilsAssembly.activeAssembly()\n",
"view = Gui.activeDocument().activeView()\n",
"panel = CommandInsertLink.TaskAssemblyInsertLink(assembly, view)\n",
)
Gui.doCommand(commands)
self.panel = Gui.doCommandEval("panel")
Gui.Control.showDialog(self.panel)

Expand Down Expand Up @@ -129,8 +131,12 @@ def accept(self):
# if self.partMoving:
# self.endMove()
Gui.addModule("UtilsAssembly")
# cmds = UtilsAssembly.generatePropertySettings("obj", self.assembly)
# Gui.doCommand(cmds)
print("InsertLink")
print(self.assembly)
print(self.insertionStack)
print(self.buildPartList())
# commands = UtilsAssembly.generatePropertySettings("obj", self.assembly)
# Gui.doCommand(commands)

App.closeActiveTransaction()
return True
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Assembly/JointObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ def setJointType(self, joint, jointType):

def onChanged(self, joint, prop):
"""Do something when a property has changed"""
App.Console.PrintMessage("Change property: " + str(prop) + "\n")
# App.Console.PrintMessage("Change property: " + str(prop) + "\n")

# during loading the onchanged may be triggered before full init.
if App.isRestoring():
Expand Down

0 comments on commit 163f9b3

Please sign in to comment.