assembly without solver
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: assembly without solver
Nice. I've managed to port some of the macros over to the WB, I'll upload them in an hour. Not all though yet
Re: assembly without solver
activeDoc is defined at line 42, part of
def Activated(self)
so it is local to Activated()
then you call it at line 113, as part of
def getAllParts(self)
getAllParts() is itself called within Activated(), AFTER you declare activeDoc = FreeCAD.ActiveDocument, BUT you changed function level! and you did not specifically pass activeDoc. you passed self.
i changed line 48, and passed a parameter
amd i changed the corresponding definition on line 109 to receive the parameter
the error went away from the report view, but still an empty window. did you see the same error from my previous post?
def Activated(self)
so it is local to Activated()
then you call it at line 113, as part of
def getAllParts(self)
getAllParts() is itself called within Activated(), AFTER you declare activeDoc = FreeCAD.ActiveDocument, BUT you changed function level! and you did not specifically pass activeDoc. you passed self.
i changed line 48, and passed a parameter
Code: Select all
self.getAllParts(activeDoc)
Code: Select all
def getAllParts(self,activeDoc):
Re: assembly without solver
after looking through a little bit more, i figure your style would probably be more like
line 42
line 109
and line 113
still looking for the actual problem. i haven't played with the custom windows before, so this is interesting, even you have it all sorted out already.
line 42
Code: Select all
self.activeDoc = FreeCAD.ActiveDocument
Code: Select all
def getAllParts(self):
Code: Select all
if doc != self.activeDoc:
Re: assembly without solver
my coding "style" ... that's a good one.
Well, I managed to make the workbench work on my computer. There are still warnings, but so far all works as expected ... by me. That is, as soon as other people will try, it'll break. And then, I'd like to fix it, to bring this workbench / framework to a usable state for the average Joe, and then we can extend it with fancier features. Version 0.2 of this workbench can be found on:
https://github.com/Zolko-123/FreeCAD_aw ... 4_v0.2.zip
To be extracted into ~/.FreeCAD/Mod
Re: assembly without solver
doesn't seem to want to load the workbench
this one is pretty baffling. 'PrintWarning' dosen't seem to exist anywhere in your files'module' object has no attribute 'PrintWarning'
Traceback (most recent call last):
File "<string>", line 47, in Initialize
Re: assembly without solver
InitGui.py: i switched the contents of Activated and Initialize (by simply changing the function name in the definition).
the workbench now loads. on my machine at least, you cannot pass on Initialize. you can pass on Activated.
ok! now i'm going to try to do something.
the workbench now loads. on my machine at least, you cannot pass on Initialize. you can pass on Activated.
Code: Select all
def Activated(self):
#self.appendMenu(["&Edit","DynamicData"],self.list) # appends a submenu to an existing menu
pass
"""
╔═══════════════════════════════════════════════╗
║ Menu ║
╚═══════════════════════════════════════════════╝
"""
def showMenu(self):
from PySide import QtGui
window = QtGui.QApplication.activeWindow()
#freecad hides wb toolbars on leaving wb, we unhide ours here to keep it around
#if the user has it set in parameters to do so
pg = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Assembly4")
keep = pg.GetBool('KeepToolbar',True)
if not keep:
return
tb = window.findChildren(QtGui.QToolBar)
for bar in tb:
if "Assembly 4" in bar.objectName():
bar.setVisible(True)
"""
╔═══════════════════════════════════════════════╗
║ Standard necessary functions ║
╚═══════════════════════════════════════════════╝
"""
def Initialize(self):
"This function is executed when the workbench is activated"
import newModelCmd # creates a new App::Part container called 'Model'
import newSketchCmd # creates a new Sketch in 'Model'
import newLCSCmd # creates a new LCS in 'Model'
import newBodyCmd # creates a new Body in 'Model
import insertLinkCmd # inserts an App::Link to a 'Model' in another file
import placeLinkCmd # places a linked part by snapping LCS (in the Part and in the Assembly)
import placeLCSCmd # places an LCS relative to an external file (creates a local attached copy)
#self.list = ["newModelCmd", "placeLinkCmd", "DynamicDataAddProperty", "DynamicDataRemoveProperty", "DynamicDataImportNamedConstraints","DynamicDataCopyProperty","DynamicDataSettings"] # A list of command names created in the line above
self.listCmd = [ "newModelCmd", "newSketchCmd", "newLCSCmd", "newBodyCmd", "insertLinkCmd", "placeLinkCmd", "placeLCSCmd" ] # A list of command names created in the line above
self.itemsMenu = [ "newModelCmd", "newSketchCmd", "newLCSCmd", "newBodyCmd", "insertLinkCmd", "placeLinkCmd", "placeLCSCmd" ] # A list of command names created in the line above
self.itemsToolbar = [ "newModelCmd", "newSketchCmd", "newLCSCmd", "newBodyCmd", "insertLinkCmd", "placeLinkCmd", "placeLCSCmd" ] # A list of command names created in the line above
self.itemsContextMenu = [ "placeLinkCmd", "placeLCSCmd" ] # A list of command names created in the line above
self.appendToolbar("Assembly 4",self.itemsToolbar) # leave settings off toolbar
self.appendMenu("&Assembly",self.itemsMenu) # creates a new menu
return
ok! now i'm going to try to do something.
Re: assembly without solver
ok, now i'm back to where i was previously. good.
i built the same 2 parts, 3 instances assembly as before, edited the LCS sketch, got the live update.
i deleted the linked parts, the corresponding constraints are still in the folder. is there a some kind of "OnDelete()" available to deal with this?
i readded the parts, without carefully creating unique labels, and it renamed the second instance by itself, and the constraint followed! excellent. i placed the links, and each tracks individually. good stuff!
gotta wait til next weekend to try much more.
i'm not sure what 'attach an LCS to an external part' is all about.
i built the same 2 parts, 3 instances assembly as before, edited the LCS sketch, got the live update.
i deleted the linked parts, the corresponding constraints are still in the folder. is there a some kind of "OnDelete()" available to deal with this?
i readded the parts, without carefully creating unique labels, and it renamed the second instance by itself, and the constraint followed! excellent. i placed the links, and each tracks individually. good stuff!
gotta wait til next weekend to try much more.
i'm not sure what 'attach an LCS to an external part' is all about.
Re: assembly without solver
yeah, I don't know what that is. So I went back to v0.1 and forward-ported the commands from v0.2. That makes the v0.3. This one loads and works on my computer ... but so did v0.2 before uploading. I created an Assembly 4 repository, but I don't know how to use it
hum, I dunno now, must check
yes, that was important, and I got it from your scriptsi readded the parts, without carefully creating unique labels, and it renamed the second instance by itself, and the constraint followed! excellent. i placed the links, and each tracks individually. good stuff!
nested assemblies. Assembly in an assembly inside another assembly. It's the next workshopi'm not sure what 'attach an LCS to an external part' is all about.
Re: assembly without solver
In this image, there are ~300 parts, in sub-assemblies and sub-sub-assemblies, of ~10 different types. This assembly structure allows to make really really large assemblies now. A 4x2 brick is 432Kb, the entire assembly just 30Kb ! But the fact that each included part has an open window begins to be problematic.
Re: assembly without solver
i never do anything more complicated than shown here actually usually much less complicated:
http://rogerdudler.github.io/git-guide/
creating a local git folder and cloning a github repo i only did once or twice. wasn't hard, but can't remember clearly. i don't use the fancy github GUI tool, but they also give you a "Git Shell". which is awesome because it give me a good unix shell on windows
in practice, day to day looks like this
cd ~
cd ./AppData/Roaming/FreeCAD/Mod/Silk (get to my git folder)
git status (shows me how many files i changed, in red)
git add --all (i basically always add all my changes)
git status (shows me how many files i added to the 'queue', now in green)
git commit -m 'mandatory commit message' (i actually have to type in something here)
git status (shows me all changes are taken care of)
git push origin master ('push' all commits to github)
if i actually did something through the website, like accept soemone's contribution, then i
git pull
that's it.
in Git Shell on windows, i just pull all the commands from history, and only type the message.