Assembly3 preview
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Assembly3 preview
Hello realthunder,
is there a way to call the link selection dialog DlgPropertyLink from the python console ? And have it return the object to be linked, but not actually making the link ?
What I specifically wish to do is to first select the object to be linked in a GUI, and then create the link where I want (and do other stuff, like creating an App::Placement in the Constraints folder). I have seen that you can select the object in the tree first and then the link is created to it, but it's not the workflow that I use.
is there a way to call the link selection dialog DlgPropertyLink from the python console ? And have it return the object to be linked, but not actually making the link ?
What I specifically wish to do is to first select the object to be linked in a GUI, and then create the link where I want (and do other stuff, like creating an App::Placement in the Constraints folder). I have seen that you can select the object in the tree first and then the link is created to it, but it's not the workflow that I use.
-
- Veteran
- Posts: 2190
- Joined: Tue Jan 03, 2017 10:55 am
Re: Assembly3 preview
I am afraid that's not possible for DlgPropertyLink, as it is tightly related to the property editor.
Yeah, why not just use the tree view for selection? DlgPropertyLink presents the object for selection also in tree, albeit organized a bit differently and no 3D visual feedback. Or, is that you want the type filtering stuff?What I specifically wish to do is to first select the object to be linked in a GUI, and then create the link where I want (and do other stuff, like creating an App::Placement in the Constraints folder). I have seen that you can select the object in the tree first and then the link is created to it, but it's not the workflow that I use.
Re: Assembly3 preview
tht's what I thought ... too bad.realthunder wrote: ↑Thu Jan 24, 2019 12:46 pmI am afraid that's not possible for DlgPropertyLink, as it is tightly related to the property editor.
no, it's not the filtering: when the App::Part is active, and I create a link, it places the link in the document but outside the Part, I have to move it by hand into the part. It's more of anannoyance.Yeah, why not just use the tree view for selection? DlgPropertyLink presents the object for selection also in tree, albeit organized a bit differently and no 3D visual feedback. Or, is that you want the type filtering stuff?What I specifically wish to do is to first select the object to be linked in a GUI, and then create the link where I want (and do other stuff, like creating an App::Placement in the Constraints folder). I have seen that you can select the object in the tree first and then the link is created to it, but it's not the workflow that I use.
But what I really wish is to be able to set the name of the App::Link, not the label, and create an App::Placement with the name of the link in a group called Constraints. I've made a macro that creates an empty link and a placement, but I'd like a GUI for it:
Code: Select all
linkName = input("Enter name of linked Part: ")
App.activeDocument().getObject('Part').newObject( 'App::Link', linkName )
App.ActiveDocument.getObject('Constraints').newObject( 'App::Placement', 'PLM_'+linkName )
If it could be made in 1 go would be nice: open the select object dialog, when selected propose a name by default, but editable so the user can choose a name he wishes for the link, create a placement in the Constraints folder, and finally create the link with the correct name, at the correct place, to the desired object.
Re: Assembly3 preview
Probably something like:
I've hardcoded that the App::Part would be called "Model" in my scheme, to add more confusion with Part, PartDesign, Assembly, Body, Solid ...
see here
Code: Select all
App.activeDocument().getObject( 'Model' ).newObject( 'App::Link', linkName ).setLink( App.getDocument( 'file_to_other_part' ). 'Model' )
I've hardcoded that the App::Part would be called "Model" in my scheme, to add more confusion with Part, PartDesign, Assembly, Body, Solid ...
see here
Re: Assembly3 preview
This is also true of assemblies? I would like a "import to active assembly as link" button ^_^when the App::Part is active, and I create a link, it places the link in the document but outside the Part, I have to move it by hand into the part. It's more of anannoyance.
Mostly i drag drop the part into the document then drag drop it to the assembly. It gets really annoying for larger assemblies...
If i rightclick on a part/body inside an assembly and chose create link, the link will not be placed inside the assembly, i am not sure it should, but it would make me happy.
Also, i think we should celebrate this, we have reached a level where we complain about UI and workflow.
Also, wish i could say that "we" was not 99% realthunder ^_^, awesome work dude!
-
- Veteran
- Posts: 2190
- Joined: Tue Jan 03, 2017 10:55 am
Re: Assembly3 preview
I think you can do this with Macro, although I haven't tested it myself. Here is a an old thread with some hint. I think the easiest workflow is this,Zolko wrote: ↑Thu Jan 24, 2019 1:16 pm If it could be made in 1 go would be nice: open the select object dialog, when selected propose a name by default, but editable so the user can choose a name he wishes for the link, create a placement in the Constraints folder, and finally create the link with the correct name, at the correct place, to the desired object.
* The user select an object in 3D view or tree view,
* User clicks your macro button
* Macro code reads the selection use Gui.Selection.getSelectionEx
* Macro pops up a input box ask for link's name
* User enter name
* Macro finishes by creating link and stuff.
Yes, I plan to add the active assembly concept, too. I need to dig out that DeepSOIC thread about active group and see what's wrong there.
Re: Assembly3 preview
You're right ... but hey, at least we do use and test his stuff, this makes up the remaining 1%. Really incredible job, realthunder, I very much hope that your work is going to be included into mainline for v0.19
Re: Assembly3 preview
Thank-you for your advice, looks feasible, except for this:
I wouldn't know how to do that. My programming skills stop at <CTRL>C / <CTRL>V but I didn't find any example of a pop-up window from a macro. Now if you did have a piece of code at hand, by sheer luck ....
-
- Veteran
- Posts: 2190
- Joined: Tue Jan 03, 2017 10:55 am
Re: Assembly3 preview
Code: Select all
from PySide import QtGui
text,ok = QtGui.QInputDialog.getText(None,'title','input something', text='default input')
if ok:
print(text)
Re: Assembly3 preview
.
EDIT: ooops, sorry, this actually belongs to another thread.
EDIT: ooops, sorry, this actually belongs to another thread.