assembly without solver

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
fosselius
Posts: 381
Joined: Sat Apr 23, 2016 10:03 am
Contact:

Re: assembly without solver

Post by fosselius »

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 4503 times
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: assembly without solver

Post by Zolko »

Nice ... how did you do that ?
try the Assembly4 workbench for FreCAD — tutorials here and here
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: assembly without solver

Post by realthunder »

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 4480 times
Try Assembly3 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: 381
Joined: Sat Apr 23, 2016 10:03 am
Contact:

Re: assembly without solver

Post by fosselius »

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
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: assembly without solver

Post by GeneFC »

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
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: assembly without solver

Post by Zolko »

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 4360 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 290 times
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: assembly without solver

Post by Zolko »

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 4208 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 — tutorials here and here
User avatar
fosselius
Posts: 381
Joined: Sat Apr 23, 2016 10:03 am
Contact:

Re: assembly without solver

Post by fosselius »

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
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: assembly without solver

Post by realthunder »

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 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
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: assembly without solver

Post by Zolko »

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 4043 times
Attachments
Lego_3001.fcstd
(66.34 KiB) Downloaded 93 times
asm_Lego2.fcstd
(8.79 KiB) Downloaded 93 times
try the Assembly4 workbench for FreCAD — tutorials here and here
Post Reply