assembly without solver

Discussion about the development of the Assembly workbench.
User avatar
fosselius
Posts: 344
Joined: Sat Apr 23, 2016 10:03 am

Re: assembly without solver

Postby fosselius » Sat Jan 19, 2019 11:06 pm

Zolko wrote:
Sat Jan 19, 2019 8:13 pm
everybody has the right to loose his time as he wants. Explains a lot, though ...
Soo... i guess i lost some time ;)
Screenshot_20190120-000451_Photos.jpg
Screenshot_20190120-000451_Photos.jpg (130.36 KiB) Viewed 934 times
User avatar
Zolko
Posts: 356
Joined: Mon Dec 17, 2018 10:02 am

Re: assembly without solver

Postby Zolko » Sat Jan 19, 2019 11:13 pm

Nice ... how did you do that ?
try the Assembly4 workbench for FreCAD v0.19
installable with Tools > Addon Manager, new version 0.6.3. Simple tutorial here
realthunder
Posts: 1172
Joined: Tue Jan 03, 2017 10:55 am

Re: assembly without solver

Postby realthunder » Sun Jan 20, 2019 1:53 am

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
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.
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.
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".
Screenshot from 2019-01-20 09-26-22.png
Screenshot from 2019-01-20 09-26-22.png (28.71 KiB) Viewed 911 times
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
fosselius
Posts: 344
Joined: Sat Apr 23, 2016 10:03 am

Re: assembly without solver

Postby fosselius » Sun Jan 20, 2019 6:20 am

Zolko wrote:
Sat Jan 19, 2019 11:13 pm
Nice ... how did you do that ?
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.

So worst possible solution ;) this was made with 0.18 appimg. I will make a remake with realthunders link implementation later.

I will make a GUI for easy selection/import from a lego parts library as well as easy grid based placement of the lego blocks.
GeneFC
Posts: 1025
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: assembly without solver

Postby GeneFC » Sun Jan 20, 2019 4:57 pm

Zolko wrote:
Sat Jan 19, 2019 8:13 pm

everybody has the right to loose his time as he wants. Explains a lot, though ...
There seems to be a recurring problem in this thread. "It's my way or else you are an idiot."

Not everyone is designing an Airbus. :?

Gene
User avatar
Zolko
Posts: 356
Joined: Mon Dec 17, 2018 10:02 am

Re: assembly without solver

Postby Zolko » Mon Jan 21, 2019 11:48 am

Good news, realthunder has released a new version of hid FreeCAD version:

realthunder wrote:
Mon Jan 21, 2019 3:24 am
New asm3 version are released. Please checkout the release note
and it works perfectly with this assembly without solver method:

asm_V4_2pistons.gif
asm_V4_2pistons.gif (806.68 KiB) Viewed 791 times

Files attached for testing. If you try to add another Piston and Bielle and have problems with that, please don't hesitate to ask and I'll try to (better) explain how to do it. If you're adventurous you can model the crankshaft in a geometrical way.
Attachments
Asm_V4.zip
(519.26 KiB) Downloaded 24 times
try the Assembly4 workbench for FreCAD v0.19
installable with Tools > Addon Manager, new version 0.6.3. Simple tutorial here
User avatar
Zolko
Posts: 356
Joined: Mon Dec 17, 2018 10:02 am

Re: assembly without solver

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

yes, that worked, thank-you. Now at least my macro is marginally usable:

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 )
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.
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...

LinkDialog.png
LinkDialog.png (35.4 KiB) Viewed 639 times

(*) yes I know it's restrictive, but this is how other CAD systems do. I don't pretend to do a generic App::Link interface, your's is there for that. What I wish to do is to have a traditional CAD workflow where engineers would feel at home. If some other devs here around who know how to code Python/Qt would want to jump in, that would be great

EDIT: ooops, that was more for this thread, sorry to troll that other thread
try the Assembly4 workbench for FreCAD v0.19
installable with Tools > Addon Manager, new version 0.6.3. Simple tutorial here
User avatar
fosselius
Posts: 344
Joined: Sat Apr 23, 2016 10:03 am

Re: assembly without solver

Postby fosselius » Fri Jan 25, 2019 5:18 pm

Zolko wrote:
Fri Jan 25, 2019 2:37 pm
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.
Why "open documents" and not all documents in a folder? Not that either excludes the other..

Update: my 2 braincells connected, it all makes sense now.
realthunder
Posts: 1172
Joined: Tue Jan 03, 2017 10:55 am

Re: assembly without solver

Postby realthunder » Fri Jan 25, 2019 10:53 pm

Just use the combo box input from Qt

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)]
	
	
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: 356
Joined: Mon Dec 17, 2018 10:02 am

Re: assembly without solver

Postby Zolko » Sun Jan 27, 2019 9:08 pm

realthunder wrote:
Fri Jan 25, 2019 10:53 pm
Just use the combo box input from Qt
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 )

Now ... about that expression thingy ... would it be possible to store / retrieve the placement expression from an object in the assembly document ? Specifically, an App::Placement, as used here ( App.ActiveDocument.addObject( 'App::Placement' ) ) has a property called "Expression Engine", but that is frozen. Would it be possible to use that property to store the text of the expression ? The field is frozen and empty, but it would be the ideal place to store the string used in the expression engine. (populating the text of that expression is then another subject, but using it would be very natural). Do you know if there is a way to use the field "Expression Engine" in an App::Placement ? Or if it's possible to add another field / property / whatever that could store text, which could be evaluated by the expression engine ? This App::Placement would then become, de facto, the constraint for the corresponding App::Part.

Placement_Expression.png
Placement_Expression.png (383.27 KiB) Viewed 474 times
Attachments
Lego_3001.fcstd
(66.34 KiB) Downloaded 16 times
asm_Lego2.fcstd
(8.79 KiB) Downloaded 15 times
try the Assembly4 workbench for FreCAD v0.19
installable with Tools > Addon Manager, new version 0.6.3. Simple tutorial here