Assembly 4 workbench

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
aron
Posts: 11
Joined: Tue Mar 08, 2016 11:02 pm
Location: Tsukuba, Japan
Contact:

Re: Assembly 4 workbench

Post by aron »

Zolko and everybody here, thank you for your absolutely stunning work!! I have been waiting for 5 years for a working solution for assemblies with a master sketch approach. I am really blown away by the simplicity and robustness of your solution. The Configurations enabling easy implementation of explosion views now tops it all! Please, please keep up the great work!

Now I am sure there is no lack of good ideas how to improve things even more, but let me still express two wishes at my heart:

(1) Controlling transparency with variables/configurations: Maybe that is not a Assembly 4 thing, but it would be so great to be able to make a whole complex assembly semi-transparent with a single variable, which is linked to all the parts. Unfortunately the transparency field does not have the "function link" option. Anyone maybe an idea/work-around, how that could be achieved?

(2) Controlling body features such as enabling/disabling grooves, cuts, etc. with variables/configurations: The idea is to be able to control section cuts in the parts, which (same as above) with a single variable in the Assembly. So with one "on/off switch" one could "cut open" the entire assembly model to be able to see inside. I used to do that with Catia and Solidworks and it helped me a lot when designing complex parts and assemblies.
User avatar
FreeCutter
Posts: 93
Joined: Mon Aug 26, 2019 5:52 pm
Location: Germany
Contact:

Re: Assembly 4 workbench

Post by FreeCutter »

Really greate workbench!

Just noticed the following error message ending with "unit mismatch":

Code: Select all

07:08:40  Traceback (most recent call last):
07:08:40    File "C:\Program Files\FreeCAD 0.19\Mod\Part\AttachmentEditor\TaskAttachmentEditor.py", line 271, in <lambda>
07:08:40      QtCore.QObject.connect(self.attachmentOffsetEdits[i], QtCore.SIGNAL('valueChanged(double)'), lambda val, i=i: self.attachmentOffsetChanged(i,val))
07:08:40    File "C:\Program Files\FreeCAD 0.19\Mod\Part\AttachmentEditor\TaskAttachmentEditor.py", line 389, in attachmentOffsetChanged
07:08:40      pos.x = Q(self.form.attachmentOffsetX.text()).getValueAs(mm)
07:08:40  ValueError: Unit mismatch
It occured when:
- Defining a variable in Model/Variables (e.g. length).
- Defining a new LCS_Model_1
- Click on button "Attache a Datum object in ..." to open the task for Attachment of this LCS.
- Changing offset for e.g. x-direction by formula editor to 'Variables.length'

However, no negative impact to further steps (e.g. recompute etc.) due to this 'error'.

No error message when doing the same opperation in the 'Property' window under 'Attachment Offset'.

FreeCAD Version:

Code: Select all

OS: Windows 10 Version 2009
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24291 (Git)
Build type: Release
Branch: releases/FreeCAD-0-19
Hash: 7b5e18a0759de778b74d3a5c17eba9cb815035ac
Python version: 3.8.6+
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.5.0
Locale: German/Germany (de_DE)
Attachments
LCS_unit_mismatch.FCStd
(10.66 KiB) Downloaded 110 times
FreeCutter
Visit my GitHub profile

Be nice to others! Respect the FreeCAD code of conduct!
pizzaslice
Posts: 4
Joined: Mon Jun 22, 2015 11:48 am

Re: Assembly 4 workbench

Post by pizzaslice »

Hey all,
I also like the Assembly 4 workbench. Earlier, I showed a laser head developed in it. Recently, I added optical simulations see the following video.
https://youtu.be/kekMkjqzRjE

Image.

As shown in the video, I grab the coordinates of components, translate them to pyoptools and plot the result in freeCAD.
pyOptools has custom components and is not build on opencascade and there is no "defined" way of interfacing with it.
The whole thing might still be interesting as it combines a lot of technology. I guess the only thing missing is a realistic virtual render, maybe I will add this later. For now I will focus on improving the module.

Freecad workbench
https://github.com/hstarmans/freecad_hexastorm
Python library with prism simulation
https://github.com/hstarmans/opticaldesign
Assembly file
https://github.com/hstarmans/hexastorm_design
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Assembly 4 workbench

Post by Kunda1 »

pizzaslice wrote: Mon Jun 21, 2021 9:50 am For now I will focus on improving the module.
This is wicked cool, do you mind starting a separate thread to track the progress of your work?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly 4 workbench

Post by Zolko »

An updated new version (0.9.17) of the workbench is available, with various fixes. Big thanx to all who contributed.

The next version will have significant changes, like language translation et repetitive patterns, therefore it will bump the version number to 0.10.
try the Assembly4 workbench for FreCAD — tutorials here and here
istapp
Posts: 12
Joined: Thu Apr 08, 2021 7:30 pm

Re: Assembly 4 workbench

Post by istapp »

A project of mine uses several almost identical parts, where constraints are governed by variables.
When copy & pasting a part in the same model, a new Variables object is created.
Currently the default behaviour of asm4 is to simply copy the current values from the original Variables object into the new Variables object.
This means I have to manually reference all relevant cells of the new Variables object to corresponding cells of the original Variables object, in order to keep identical geometries where intended.

Could copy & pasting a part in the same model be made to depend on the original Variables object, instead of creating a new, nondependent Variables object?
e.g. all cells of new variables object references corresponding cells of old variables object as default
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly 4 workbench

Post by Zolko »

istapp wrote: Wed Aug 11, 2021 1:31 pm Could copy & pasting a part in the same model be made to depend on the original Variables object, instead of creating a new, nondependent Variables object?
wrong workflow: create a new - another - instance of your part and don't copy it.
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Assembly 4 workbench

Post by Kunda1 »

Heads up: Thor project has adopted Assembly4 as it's chosen solution.

Ref: https://twitter.com/_AngelLM/status/1424408804817580046
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
ecorm
Posts: 18
Joined: Tue May 04, 2021 5:35 am

Re: Assembly 4 workbench

Post by ecorm »

Is there a way to obtain the absolute position of a PartDesign body nested deeply in an Assembly 4 tree? I need this to compute the center of mass of a complex, nested Assembly 4 model. I've already figured out how to obtain the center of mass of a single PartDesign body (via .Shape.CenterOfMass), but I need its absolute position to compute its moment in the overall model.

I would prefer a way to do this within a FreeCAD spreadsheet, but I'm open to using a Python console command.

I tried applying the chain of transformations using .AttachmentOffset and .Placement properties within a spreadsheet, but that way lies madness because there are so many ways an assembly part body can be translated and rotated. It's impossible for me to guess the proper sequence of transforms without digging into the source code.
ecorm
Posts: 18
Joined: Tue May 04, 2021 5:35 am

Re: Assembly 4 workbench

Post by ecorm »

ecorm wrote: Fri Aug 20, 2021 10:30 pm Is there a way to obtain the absolute position of a PartDesign body nested deeply in an Assembly 4 tree? I need this to compute the center of mass of a complex, nested Assembly 4 model.
Here's the spreadsheet formula I have so far to compute the moment vector of an assembly part body:

Code: Select all

= (<<Subassembly>>#<<Body>>.Shape.Volume * density) *
<<Assembly>>#<<Subassembly>>.AttachmentOffset *
<<Assembly>>#<<Subassembly>>.LinkPlacement *
<<Subassembly>>#<<Body>>.Shape.CenterOfMass
where the first line computes the body's mass, and 'density' is an alias to a spreadsheet cell containing the body's density. I had to experiment with the order of .AttachmentOffset and .LinkPlacement terms to get results that seem plausible.

The resulting moment vector seems to be within the local XYZ coordinates of the parent assembly. I can then sum all moment vectors for all other subassemblies within the parent assembly, and divide by the assembly's total weight to obtain the center of mass of the parent assembly.

The idea is then the repeat this procedure at the next higher level of assemblies, until I reach the top-level assembly.

I don't know if I should be taking the .AttachedTo and .AttachedBy properties into consideration.

Any guidance would be appreciated. A script or macro that automates this would be awesome, but I'm not knowledgeable enough in FreeCAD & Assembly 4's internal workings to write such a thing.
Post Reply