Assembly3 preview

Discussion about the development of the Assembly workbench.
User avatar
Zolko
Posts: 406
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly3 preview

Postby Zolko » Thu Jan 24, 2019 10:36 am

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.
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — simple tutorial here
realthunder
Posts: 1207
Joined: Tue Jan 03, 2017 10:55 am

Re: Assembly3 preview

Postby realthunder » Thu Jan 24, 2019 12:46 pm

Zolko wrote:
Thu Jan 24, 2019 10:36 am
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 ?
I am afraid that's not possible for DlgPropertyLink, as it is tightly related to the property editor.
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.
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?
Try Assembly3 (latest version 0.10.2) along with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
User avatar
Zolko
Posts: 406
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly3 preview

Postby Zolko » Thu Jan 24, 2019 1:16 pm

realthunder wrote:
Thu Jan 24, 2019 12:46 pm
Zolko wrote:
Thu Jan 24, 2019 10:36 am
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 ?
I am afraid that's not possible for DlgPropertyLink, as it is tightly related to the property editor.
tht's what I thought ... too bad.
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.
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?
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.

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 )
after that I have to select the object to be linked. It works, but it's very pedestrian.

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.
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — simple tutorial here
User avatar
Zolko
Posts: 406
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly3 preview

Postby Zolko » Thu Jan 24, 2019 1:34 pm

Probably something like:

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
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — simple tutorial here
User avatar
fosselius
Posts: 344
Joined: Sat Apr 23, 2016 10:03 am

Re: Assembly3 preview

Postby fosselius » Thu Jan 24, 2019 5:45 pm

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.
This is also true of assemblies? I would like a "import to active assembly as link" button ^_^

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. :D
Also, wish i could say that "we" was not 99% realthunder ^_^, awesome work dude!
realthunder
Posts: 1207
Joined: Tue Jan 03, 2017 10:55 am

Re: Assembly3 preview

Postby realthunder » Thu Jan 24, 2019 10:34 pm

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.
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,
* 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.

fosselius wrote:
Thu Jan 24, 2019 5:45 pm
This is also true of assemblies? I would like a "import to active assembly as link" button ^_^
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.
Try Assembly3 (latest version 0.10.2) along with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
User avatar
Zolko
Posts: 406
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly3 preview

Postby Zolko » Thu Jan 24, 2019 10:40 pm

fosselius wrote:
Thu Jan 24, 2019 5:45 pm
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!
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
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — simple tutorial here
User avatar
Zolko
Posts: 406
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly3 preview

Postby Zolko » Thu Jan 24, 2019 10:50 pm

Thank-you for your advice, looks feasible, except for this:

realthunder wrote:
Thu Jan 24, 2019 10:34 pm
* Macro pops up a input box ask for link's name
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 .... :o
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — simple tutorial here
realthunder
Posts: 1207
Joined: Tue Jan 03, 2017 10:55 am

Re: Assembly3 preview

Postby realthunder » Thu Jan 24, 2019 11:37 pm

Zolko wrote:
Thu Jan 24, 2019 10:50 pm
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 ....

Code: Select all

from PySide import QtGui
text,ok = QtGui.QInputDialog.getText(None,'title','input something', text='default input')
if ok:
	print(text)
PySide is the python binding of Qt. You can build full featured GUI with it. For other type of inputs, checkout the document here.
Try Assembly3 (latest version 0.10.2) along with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
User avatar
Zolko
Posts: 406
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly3 preview

Postby Zolko » Fri Jan 25, 2019 2:11 pm

.
EDIT: ooops, sorry, this actually belongs to another thread.
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — simple tutorial here