Assembly 4 workbench

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
im7thson
Posts: 9
Joined: Mon Oct 28, 2019 5:48 am

Re: Assembly 4 workbench

Post by im7thson »

parts from assembly were hidden for me too, but i noticed when clicking create new assembly4 Model button (yellow with blue box) there a folder parts appear, i think i placed parts there and after reopening there were not hidden. But i'm not sure because i did another files to see if it happens again and it is not.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly 4 workbench

Post by Zolko »

im7thson wrote: Sat Nov 16, 2019 5:09 pm parts from assembly were hidden for me too, but i noticed when clicking create new assembly4 Model button (yellow with blue box) there a folder parts appear, i think i placed parts there and after reopening there were not hidden. But i'm not sure because i did another files to see if it happens again and it is not.
what I noticed is that objects are hidden and show sequentially: if you make an assembly in 1 file, and link into the assembly a part that is in the same document, then the original part must be hidden and the link shown. So if in the document, the link is parsed first, which shows the part, and then the part is parsed, which is hidden, the end-result is that the solid is hidden. If the part is parsed first, it is hidden, then the link is parsed, which shows it, the end-result is that the solids are shown.

That's why I create first a Part group before creating the Model App::Part, and all subsequent Parts are placed in that group, even if created later, so they are parsed before the assembly Model. Thus, the App::Links in the Model decide what is shown and not.
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 4 workbench

Post by Zolko »

joe.belladonna wrote: Sat Nov 16, 2019 2:29 pm Everything was assembled with the Assembly4. [...] Then I twice copied that assembly into a new document and have created the "AssemblyOfBoxes_WithCopy", and have imported one "Box" assembly with "Insert link..."
hum .. doesn't seem completely kosher to me. If you mix Assembly4 methods and manual copy of objects, I don't know what's going to happen. Is there a particular reason you did all that ? Is there a missing functionality in Assembly4 that made you manually copy the (partial ?) assembly ?
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
alonso_jamm
Posts: 77
Joined: Mon Nov 11, 2019 11:32 pm

Re: Assembly 4 workbench

Post by alonso_jamm »

Hello.

I have been testing Assembly 4 and so far I have like it quite a bit. I like the simplicity of the workbench, you have done a really good job! I also have been looking at your examples of animations and tried to do a small animation for a planetary gear set. It turned out to be quite simple, I added a small gif of the animation.

And here is the code I used:

Code: Select all

import time
from math import  degrees

step = 1

for angle in range(0, 1440, step):
	App.getDocument("GearAssembly").LCS_0.Placement=App.Placement(App.Vector(0,0,0), App.Rotation(App.Vector(0,0,1), angle))
	carrierRatio = 15/(15+46)
	planetRatio = ((46/15) - 1)*(15/61)
	boxRot = App.getDocument("GearAssembly").LCS_0.Placement.Rotation	# Get the current rotation of the sun gear
	boxAngle = degrees(boxRot.Angle)
	boxAx = boxRot.Axis
	
	# Setting up the rotation of the carrier
	App.getDocument("GearAssembly").Sketch_1.Placement.Rotation = App.Rotation(boxAx, boxAngle*carrierRatio)	
	
	# Now set up the rotation of each planet gear
	App.getDocument("GearAssembly").LCS_1.Placement.Rotation = App.Rotation(boxAx, (-boxAngle - 0)*planetRatio)
	App.getDocument("GearAssembly").LCS_1001.Placement.Rotation = App.Rotation(boxAx, (-boxAngle - 0)*planetRatio)
	App.getDocument("GearAssembly").LCS_1002.Placement.Rotation = App.Rotation(boxAx, (-boxAngle - 0)*planetRatio)
	App.getDocument("GearAssembly").LCS_1003.Placement.Rotation = App.Rotation(boxAx, (-boxAngle - 0)*planetRatio)
	App.getDocument("GearAssembly").LCS_1004.Placement.Rotation = App.Rotation(boxAx, (-boxAngle - 0)*planetRatio)
	
	App.ActiveDocument.recompute()
	Gui.updateGui()
	time.sleep(0.001)
I also included the files I used to make the animation. The only issue I could think about this approach is that it is kind of tedious to create all the LCSs, attach them to the sketch and then to link and attach all the gears to these LCSs. So I was wondering whether there could be some kind of way to automate this process.

For example, a sketch containing a polygon (like the pentagon used in the file I linked) could be created first. Then, LCSs would be created and attached to each vertex of the polygon. Using the Expression engine, the rotation of each new LCSs could be locked to the rotation of the center LCS (like how I did in my python script). Finally, links to the desired part are imported and attached to the new LCSs.

The problem I see with the example I mentioned is that it is not parametric and if we wanted to change the part or the number of linked parts we would have to delete pretty much everything.

So another method I thought was to directly attach each new LCS to the center LCS and use the attachment offset to change the placement of each LCS. I tried to something like that; however, the placement of each LCS become a little bit more complex. Here is, the piece of code that I used to run the animation using AttachmentOffset.

Code: Select all

boxRot = App.getDocument("GearAssembly").LCS_0.Placement.Rotation	
boxAngle = degrees(boxRot.Angle)
boxAx = boxRot.Axis
App.getDocument("GearAssembly").LCS_1.AttachmentOffset.Rotation = App.Rotation(boxAx, (-boxAngle*1.5))
App.getDocument("GearAssembly").LCS_1.AttachmentOffset.Base = App.Vector(15*cos(radians(boxAngle*-0.75)), 15*sin(radians(boxAngle*-0.75)), 0)
As I said, it is kind of complex and I am not completely sure about why the coefficients I used worked (like multiplying boxAnlge by 1.5).

So I would like to know what you think about this idea of automatizing the creation and attachment of LCSs and links into assemblies.
Attachments
GearAssembly.FCStd
(13.12 KiB) Downloaded 91 times
Gear.FCStd
(30.16 KiB) Downloaded 64 times
Gears.gif
Gears.gif (819.04 KiB) Viewed 2171 times
joe.belladonna
Posts: 18
Joined: Sat Nov 09, 2019 9:18 pm

Re: Assembly 4 workbench

Post by joe.belladonna »

Zolko wrote: Sat Nov 16, 2019 8:01 pm hum .. doesn't seem completely kosher to me. If you mix Assembly4 methods and manual copy of objects, I don't know what's going to happen. Is there a particular reason you did all that ? Is there a missing functionality in Assembly4 that made you manually copy the (partial ?) assembly ?
I have been testing Assembly4 to see will it suit my needs. Unlike with mechanical engineering in woodworking process, you have one part in many different shapes and forms. In my particular case, I use a chipboard panels. I cut it in smaller parts and then assemble those parts into a cabinet. I use it to build kitchens and wardrobe cabinets, and I need to draw many cabinets with different dimensions. My intention was to use FreeCAD to draw one parametric chipboard cabinet, and import it several times but with different dimensions. If I would use links in Assembly4, the first time I change dimensions of my linked part, all my cabinets would change their dimensions. I would like to import link of a part, or to copy that part, to an assembly and set its dimensions. Then I would like to import second part and to set its dimensions, but I would like to have first part with its already set dimensions without changing it when I set second cabinet dimensions. And I need to do this many times.

In short that was my intention. I need to somehow, unlink parts after import so I can change dimensions. I don't care if that would be simple copying, and I don't care about file sizes. I just need to avoid to draw cabinets all over again for every single cabinets case I need to build. I tried with Assembly4 and copying and it worked until I close the file. When I open it again, linked parts were hidden.
basmati
Posts: 27
Joined: Thu Oct 31, 2019 10:22 am

Re: Assembly 4 workbench

Post by basmati »

What about cloning your original Part and then resizing the clones?

And about the hidden Parts: that problem was described just two posts earlier.
joe.belladonna
Posts: 18
Joined: Sat Nov 09, 2019 9:18 pm

Re: Assembly 4 workbench

Post by joe.belladonna »

basmati wrote: Sun Nov 17, 2019 3:49 pm What about cloning your original Part and then resizing the clones?

And about the hidden Parts: that problem was described just two posts earlier.
Do you mean to link my part within Assembly4 and then to clone it?
basmati
Posts: 27
Joined: Thu Oct 31, 2019 10:22 am

Re: Assembly 4 workbench

Post by basmati »

joe.belladonna wrote: Sun Nov 17, 2019 3:56 pm
basmati wrote: Sun Nov 17, 2019 3:49 pm What about cloning your original Part and then resizing the clones?

And about the hidden Parts: that problem was described just two posts earlier.
Do you mean to link my part within Assembly4 and then to clone it?
I think I would clone the original part (or the Body inside it) and put this clone in its own part.
joe.belladonna
Posts: 18
Joined: Sat Nov 09, 2019 9:18 pm

Re: Assembly 4 workbench

Post by joe.belladonna »

basmati wrote: Sun Nov 17, 2019 4:32 pm I think I would clone the original part (or the Body inside it) and put this clone in its own part.
I'm not sure that I understand you correctly. Here are my files. Can you please show me what you mean in those files. Thanks in advance.
Attachments
AssemblyOfBoxesWithCloning.FCStd
(6.91 KiB) Downloaded 111 times
Box.FCStd
(44.13 KiB) Downloaded 89 times
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly 4 workbench

Post by Zolko »

alonso_jamm wrote: Sun Nov 17, 2019 5:26 am I have been testing Assembly 4 and so far I have like it quite a bit. I like the simplicity of the workbench, you have done a really good job!
thank-you for testing, and thank-you for your comment

alonso_jamm wrote: Sun Nov 17, 2019 5:26 am I also have been looking at your examples of animations and tried to do a small animation for a planetary gear set. It turned out to be quite simple, I added a small gif of the animation.
great stuff !

alonso_jamm wrote: Sun Nov 17, 2019 5:26 am The only issue I could think about this approach is that it is kind of tedious to create all the LCSs, attach them to the sketch and then to link and attach all the gears to these LCSs. So I was wondering whether there could be some kind of way to automate this process.
...
So I would like to know what you think about this idea of automatizing the creation and attachment of LCSs and links into assemblies.
I think it would be very useful. The point I see though is that you might be able to come up with an automagic solution for some use-cases, but I also think that many people have many needs, and also many different ways of doing their stuff, so I don't see how an automatic solution would look like. But for some uses, that could turn out to cover a very large user-base, I definitively think that it is possible to do (much) better than today.

So if you have ideas, please tell them.
try the Assembly4 workbench for FreCAD — tutorials here and here
Post Reply