Soo... i guess i lost some time
assembly without solver
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: assembly without solver
Nice ... how did you do that ?
-
- Veteran
- Posts: 2190
- Joined: Tue Jan 03, 2017 10:55 am
Re: assembly without solver
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.
Re: assembly without solver
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.
Re: assembly without solver
Good news, realthunder has released a new version of hid FreeCAD version:
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.
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
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
Re: assembly without solver
yes, that worked, thank-you. Now at least my macro is marginally usable:
(*) 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
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.
(*) 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
Re: assembly without solver
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.
-
- Veteran
- Posts: 2190
- Joined: Tue Jan 03, 2017 10:55 am
Re: assembly without solver
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)]
Re: assembly without solver
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.
- Attachments
-
- Lego_3001.fcstd
- (66.34 KiB) Downloaded 93 times
-
- asm_Lego2.fcstd
- (8.79 KiB) Downloaded 93 times