Soo... i guess i lost some time

Sure, I can cherry pick that commit. My branch is about one month lag behind upstream. It is becoming increasingly difficult for each merge, and I don't want to delay the release again, so I'll delay the full merge till next release.Zolko wrote: ↑Sat Jan 19, 2019 11:42 am Cool, and thanx. May-be it would be useful to include git commit 55a4f78ad, that enables the "create Datum Coordinate System" (LCS) in the toolbar ? See here in the forum
That dialog is for general purpose link property editing. I don't think it is appropriate to make it default to App::Part. Anyway, I have changed "Show all object types" to "Filter by type".Also, how much work would it be to refine the "select Linked object" dialog, to show only Parts (App::Part objects) by default, and show all objects only when the "Show all object types" checkbox is actually checked ? It would make the workflow and tutorials more natural.
Each piece is a Body container made in a seperate file. In the example above the body containers for each piece is copied into a seperate document and manually placed.
and it works perfectly with this assembly without solver method:realthunder wrote: ↑Mon Jan 21, 2019 3:24 am New asm3 version are released. Please checkout the release note
Code: Select all
from PySide import QtGui
text,ok = QtGui.QInputDialog.getText(None,'Create link to a Model','Enter the desired link name :', text='Model_X')
if ok and text:
linkName = text
# create an App::Link to an external object
App.activeDocument().getObject('Model').newObject( 'App::Link', linkName )
# create an App::Placement for that object
App.ActiveDocument.getObject('Constraints').newObject( 'App::Placement', 'PLM_'+linkName )
What I'd wish to do is to have a dialog that would list all available App::Part called "Model" in all open documents (*), allow to select one of them, propose a name based on the document name, and then go on with doing the stuff. But I'm afraid I'm better at Gimp than Python...realthunder wrote: ↑Thu Jan 24, 2019 11:37 pm PySide is the python binding of Qt. You can build full featured GUI with it. For other type of inputs, checkout the document here.
Why "open documents" and not all documents in a folder? Not that either excludes the other..
Code: Select all
from PySide import QtGui
# get App::Part from all documents
parts = [ o for doc in App.listDocuments().values() for o in doc.Objects if o.isDerivedFrom('App::Part')]
# construct selection strings
partItems = [ '{}#{}'.format(o.Document.Name,o.Name) for o in parts ]
item,ok = QtGui.QInputDialog.getItem(None,'Parts','Please select',partItems,editable=False)
if ok:
# your part object is here
part = parts[partItems.index(item)]
yes, that worked, thanx. I combined both dialogs sequentially and I have the exact functionality I wished:
Code: Select all
# coding: utf-8
#
# Macro to create a new App::Link to an external App::Part model
from PySide import QtGui
# get App::Part from all documents
parts = [ obj for doc in App.listDocuments().values() for obj in doc.Objects if obj.isDerivedFrom('App::Part') ]
# construct selection strings
partItems = [ '{}#{}'.format(obj.Document.Name,obj.Name) for obj in parts ]
item,ok = QtGui.QInputDialog.getItem( None, 'Create link to a Model', 'Select the model to insert :',partItems,editable=False )
if ok:
# your part object is here
model = parts[ partItems.index(item) ]
docName = model.Document.Name
# inpu dialog to ask the user the name of the link:
text,ok = QtGui.QInputDialog.getText(None,'Create link to a Model','Enter the link name :', text=docName)
if ok and text:
linkName = text
# create the App::Link to the previously selected model
App.activeDocument().getObject('Model').newObject( 'App::Link', linkName ).LinkedObject = model
# create an App::Placement for that object
App.ActiveDocument.getObject('Constraints').newObject( 'App::Placement', 'PLMT_'+linkName )