V0.19 Benchmarking--2019 Monthly Challenges #1,#2,#3,#4,#5,#6,#7a,#7b

A place to share learning material: written tutorials, videos, etc.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
bambuko
Veteran
Posts: 2185
Joined: Thu Oct 24, 2019 12:53 pm
Location: UK, England, North Devon

Re: V0.19 Benchmarking--2019 Monthly Challenges #1,#2,#3,#4,#5

Post by bambuko »

Well... looks like I got my next exercise delivered on a plate :P
Thank you very much indeed!
That looks perfect. I particularly like you introducing Assembly 4 (my goal)
I shall enjoy it :ugeek:
I am using Link branch and Assembly3
you can also download ... and try it here
excellent Assembly3 tutorials here
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: V0.19 Benchmarking--2019 Monthly Challenges #6

Post by ppemawm »

This seemingly innocuous looking object is a bit difficult to envision how one should model it at first look. I have to admit I could not find a simple way to model this solely in PartDesign and had to resort to the 'Connect' tool in the Part workbench to complete it. Any port in a storm.

In any event, it is a good example of using sketch attachment to align bodies and the Part > Connect* to join them as shown in the following images:

In order to use the Connect tool two bodies are required, one for the base and another for the inclined portion.  The base sketch is fairly straight forward but note where the sketch origin is located.  This will make the model for the inclined portion much easier as you will see when it comes time to align the sketch with attachment offset.<br /><br />The first step for the base is to reverse pad the first sketch.  The next step is to pad the end face long enough to fill the gap between the two bodies as will be shown later.  Select the end face and pad 10 mm.  You will see that it is padded at an angle to the sketch plane which is important.
In order to use the Connect tool two bodies are required, one for the base and another for the inclined portion. The base sketch is fairly straight forward but note where the sketch origin is located. This will make the model for the inclined portion much easier as you will see when it comes time to align the sketch with attachment offset.

The first step for the base is to reverse pad the first sketch. The next step is to pad the end face long enough to fill the gap between the two bodies as will be shown later. Select the end face and pad 10 mm. You will see that it is padded at an angle to the sketch plane which is important.
Capture28_base.JPG (189.28 KiB) Viewed 2461 times
The second body requires that the sketch for the pad is aligned according to the drawing angle dimensions.  In order to reference the first body sketch, create a shapebinder of the sketch by making sure that the second body is active and then select the sketch and PartDesign &gt; Shapebinder.  Toggle the first body sketch to invisible and you should see an orange outline of the sketch as shown in this image.<br /><br />Now you can create a sketch for the inclined body in the YZ plane.  I usually add something to the sketch before opening the map mode panel so that it is visible.  Close the sketch and select the sketch map mode in the properties panel which will open this task panel.  <br /><br />Rotate the sketch about the sketch y-axis 30 deg and the x-axis 45 deg using the Attachment Offset as shown.
The second body requires that the sketch for the pad is aligned according to the drawing angle dimensions. In order to reference the first body sketch, create a shapebinder of the sketch by making sure that the second body is active and then select the sketch and PartDesign > Shapebinder. Toggle the first body sketch to invisible and you should see an orange outline of the sketch as shown in this image.

Now you can create a sketch for the inclined body in the YZ plane. I usually add something to the sketch before opening the map mode panel so that it is visible. Close the sketch and select the sketch map mode in the properties panel which will open this task panel.

Rotate the sketch about the sketch y-axis 30 deg and the x-axis 45 deg using the Attachment Offset as shown.
Capture29_attach-offset.JPG (167.93 KiB) Viewed 2461 times
Reference the incline sketch to the shapebinder by using the Sketcher &gt; External reference tool.  Select 'Create an edge linked to...'   and the encircled vertices of the shapebinder.  Constrain the inclined sketch to the external reference vertices as shown.<br /><br />Note the 10 mm extension in the sketch which will help fill the gap between the base and the inclined pad.
Reference the incline sketch to the shapebinder by using the Sketcher > External reference tool. Select 'Create an edge linked to...' and the encircled vertices of the shapebinder. Constrain the inclined sketch to the external reference vertices as shown.

Note the 10 mm extension in the sketch which will help fill the gap between the base and the inclined pad.
Capture31_incline.JPG (217.45 KiB) Viewed 2461 times
Make sure that the two pads completely overlap as shown in this image by adjusting the length of Pad002 of the base and the extension length in Sketch002 of the 2nd body.
Make sure that the two pads completely overlap as shown in this image by adjusting the length of Pad002 of the base and the extension length in Sketch002 of the 2nd body.
Capture30_overlap.JPG (151.01 KiB) Viewed 2461 times
The final step is to switch to the Part workbench and the Connect Tool shown by the arrow in the previous image.  Select both bodies and use the tool to cleanup the intersection.  Toggle Refine to true in the Connect property panel to remove excess edges.<br /><br />Connect removes any solid not common to the intersection as explained in the reference documentation.
The final step is to switch to the Part workbench and the Connect Tool shown by the arrow in the previous image. Select both bodies and use the tool to cleanup the intersection. Toggle Refine to true in the Connect property panel to remove excess edges.

Connect removes any solid not common to the intersection as explained in the reference documentation.
Capture27_connect.JPG (141.23 KiB) Viewed 2461 times
.
*Ref. https://wiki.freecadweb.org/Part_JoinConnect

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22474 (Git)
Build type: Release
Branch: master
Hash: a44f8ffd427fa9b23b1f00dbf62d66cd152cd774
Python version: 3.8.5
Qt version: 5.12.6
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United States (en_US)
"It is a poor workman who blames his tools..." ;)
User avatar
bambuko
Veteran
Posts: 2185
Joined: Thu Oct 24, 2019 12:53 pm
Location: UK, England, North Devon

Re: V0.19 Benchmarking--2019 Monthly Challenges #5

Post by bambuko »

ppemawm wrote: Sun Sep 27, 2020 3:14 pm This rather simple object gives us the chance to present several additional concepts: variables,...
I am following this exercise (#5) and have a question about variables, please.
- what type of variable should I use for these formulas?
(some are obvious and easy to understand) I have used "Float" ?
- whichever type I choose I am unable to enter formula into value window?
(the only thing I can do is to leave value with random number and then edit formula using formula editor)

BTW if you'd rather I didn't "mess up" :D your thread with these questions,
just let me know, please and I will try elsewhere (e.g. Help on using FreeCAD)
Last edited by bambuko on Wed Sep 30, 2020 6:44 pm, edited 1 time in total.
I am using Link branch and Assembly3
you can also download ... and try it here
excellent Assembly3 tutorials here
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: V0.19 Benchmarking--2019 Monthly Challenges #1,#2,#3,#4,#5,#6

Post by ppemawm »

bambuko wrote: Wed Sep 30, 2020 12:39 pm I am following this exercise (#5) and have a question about variables, please.
- what type of variable should I use for these formulas?
(some are obvious and easy to understand) I have used "Float" ?
Yes, if it is to be a decimal value ( as opposed to an integer or a string). I have no idea what the other choices mean since I am not a programmer.
bambuko wrote: Wed Sep 30, 2020 12:39 pm - whichever type I choose I am unable to enter formula into value window?
(the only thing I can do is to leave value with random number and then edit formula using formula editor)
Yes, again. It is not so intuitive, but now you know.
You have learned by doing. Bravo.
bambuko wrote: Wed Sep 30, 2020 12:39 pm BTW if you'd rather I didn't "mess up" :D your thread with these questions,
just let me know, please and I will try elsewhere (e.g. Help on using FreeCAD)
Your questions are quite appropriate for the thread and so they add value. Thank you.
"It is a poor workman who blames his tools..." ;)
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: V0.19 Benchmarking--2019 Monthly Challenges #7a

Post by ppemawm »

This assembly example can be modeled, assembled, and animated using Assembly4 (Asm4) and the PartDesign workbench in a single file, in-context. The process starts with adding an assembly Model in the Asm4 workbench and a Body for each component: base, disc, and slider in the Part folder.

A few details regarding the work process are presented in the captions of the following images:

This is the master sketch and carbon copy that were used to create each body as has been done in previous examples except that the master is located in the Model as shown.  The carbon copy in Model can be duplicated and dropped in each body after deselecting all dependencies.  <br /><br />A variable (crank_angle) is defined using the Add variable table which represents the angular position of the pin on the disc which is highlighted in the image.  The lines representing the slider are not constrained to the sketch axis because they are solely dependent upon the crank angle. The disc position line constrained by the variable angle is also constrained to the vertical line with a 'Fix point on object...' which provides the slider the necessary degree of freedom that follows the crank_angle.<br /><br />Each body that is created from carbon copies of this sketch will be located and constrained such that if the crank_angle is changed, the slider and disc bodies will follow the sketch position changes.    I.e. the master is serving as an assembly 'solver'.<br /><br />The master must be in the Model if it is to be manipulated with the Asm4 animator.
This is the master sketch and carbon copy that were used to create each body as has been done in previous examples except that the master is located in the Model as shown. The carbon copy in Model can be duplicated and dropped in each body after deselecting all dependencies.

A variable (crank_angle) is defined using the Add variable table which represents the angular position of the pin on the disc which is highlighted in the image. The lines representing the slider are not constrained to the sketch axis because they are solely dependent upon the crank angle. The disc position line constrained by the variable angle is also constrained to the vertical line with a 'Fix point on object...' which provides the slider the necessary degree of freedom that follows the crank_angle.

Each body that is created from carbon copies of this sketch will be located and constrained such that if the crank_angle is changed, the slider and disc bodies will follow the sketch position changes. I.e. the master is serving as an assembly 'solver'.

The master must be in the Model if it is to be manipulated with the Asm4 animator.
Capture32_master.JPG (226.86 KiB) Viewed 2327 times
Once the bodies are created they are assembled in Model with Asm4 using the 'Insert a link...' tool as shown in this image.  The default LCS's can be used in this simple example.<br /><br />The base LCS is assembled (attached) to the parent assembly origin and the disc is attached to the base LCS.<br /><br />Use the Rot X,Y,Z buttons to correct the orientation if necessary.  The X,Y,Z are the axes of the LCS not necessarily the global axis.
Once the bodies are created they are assembled in Model with Asm4 using the 'Insert a link...' tool as shown in this image. The default LCS's can be used in this simple example.

The base LCS is assembled (attached) to the parent assembly origin and the disc is attached to the base LCS.

Use the Rot X,Y,Z buttons to correct the orientation if necessary. The X,Y,Z are the axes of the LCS not necessarily the global axis.
Capture33_disc.JPG (202.25 KiB) Viewed 2327 times
The slider must be attached to to the parent LCS as shown in the properties panel since there is no way to attach it to the disc pin since the X-position is variable.
The slider must be attached to to the parent LCS as shown in the properties panel since there is no way to attach it to the disc pin since the X-position is variable.
Capture34_slider.JPG (198.29 KiB) Viewed 2327 times
The Asm4 'Animate assembly' tool can be used to check all of the allowable positions of the slider as the disc rotates.  The GIF shows the slider/disc action for 45 deg intervals.  Note that either a looping or reversing (Pendulum) option may be selected for the range cycle.
The Asm4 'Animate assembly' tool can be used to check all of the allowable positions of the slider as the disc rotates. The GIF shows the slider/disc action for 45 deg intervals. Note that either a looping or reversing (Pendulum) option may be selected for the range cycle.
slider.gif (675.53 KiB) Viewed 2327 times
.
This assembly can also be created without a master sketch and animated by varying the attachment offset or LCS links of the disc and slider bodies. This is my preferred approach especially with more complex mechanisms. A simple expression can be used to calculate the attachment offset of the slider as a function of the crank_angle. I will leave this alternative approach for the next post, #7b.

Please stay tuned.

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22261 (Git)
Build type: Release
Branch: master
Hash: 1c432fd6170b7904592a224194e42d3c566707a6
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)
"It is a poor workman who blames his tools..." ;)
User avatar
bambuko
Veteran
Posts: 2185
Joined: Thu Oct 24, 2019 12:53 pm
Location: UK, England, North Devon

Re: V0.19 Benchmarking--2019 Monthly Challenges #1,#2,#3,#4,#5,#6,#7a

Post by bambuko »

One more comment on exercise #5 and using variables.

Image

at this point I couldn't remember the names and was unable to find a way to display a list of variables in a separate panel while editing the sketch
(perhaps it can be done?)

So my trick was to prefix all the variable names with a common letter (I have used "v" for variables)
and now when entering the formula I have a dropdown list of available variables to choose from:

Image

OK maybe it is over complicated for just three variables ;) but anymore and I think it could be useful?
I am using Link branch and Assembly3
you can also download ... and try it here
excellent Assembly3 tutorials here
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: V0.19 Benchmarking--2019 Monthly Challenges #1,#2,#3,#4,#5,#6,#7a

Post by ppemawm »

bambuko wrote: Thu Oct 01, 2020 1:10 pm was unable to find a way to display a list of variables in a separate panel while editing the sketch
(perhaps it can be done?)
Switch to the Model View and select 'Variables' and all the variables should show up in the Combo property view or a separate Property panel as in my example (see the 1st image in Challenge #5). That is why I like to have the left and right panels available at all times even though it uses some real estate...saves a lot of cycling back and forth.
bambuko wrote: Thu Oct 01, 2020 1:10 pm So my trick was to prefix all the variable names with a common letter (I have used "v" for variables)...and I think it could be useful?
Good choice. Note that the DynamicData workbench uses the prefix 'dd_' for the same purpose.

I sometimes enter the variables with an alphabet prefix so that they show up in the property panel in a logical sequence (the list is always sorted alphabetically). It is most useful when having several calculated dependent variables as in this example: https://forum.freecadweb.org/viewtopic.php?f=24&t=43250. I rarely need to use a spreadsheet anymore.
"It is a poor workman who blames his tools..." ;)
User avatar
bambuko
Veteran
Posts: 2185
Joined: Thu Oct 24, 2019 12:53 pm
Location: UK, England, North Devon

Re: V0.19 Benchmarking--2019 Monthly Challenges #1,#2,#3,#4,#5,#6,#7a

Post by bambuko »

ppemawm wrote: Thu Oct 01, 2020 3:05 pm ...Switch to the Model View and select 'Variables' and all the variables should show up in the Combo property view or a separate Property panel as in my example (see the 1st image in Challenge #5)...
You are absolutely correct, but it is my fault for not being precise enough...
What I meant, is that as soon as you select the feature in the sketch to add dimension to (using variable) and "insert dimension" window appears the variables disapear and you cannot do anything about it :oops:
It is at this point I am beginning to think "oh **** which variable was I meant to use" :D
Blame it on my advanced years and decrepitude :lol:

ppemawm wrote: Thu Oct 01, 2020 3:05 pm...That is why I like to have the left and right panels available at all times even though it uses some real estate...saves a lot of cycling back and forth...
I have noticed it and would like to try it, but I still have to find way to do it...
I am sure I will discover it eventually :ugeek:

ppemawm wrote: Thu Oct 01, 2020 3:05 pm...I sometimes enter the variables with an alphabet prefix so that they show up in the property panel in a logical sequence (the list is always sorted alphabetically). It is most useful when having several calculated dependent variables as in this example: https://forum.freecadweb.org/viewtopic.php?f=24&t=43250. I rarely need to use a spreadsheet anymore.
FreeCAD seems to be quite powerful with things like this!
That looks like another useful thread - thank you.
Feels like I am trying to run before I can walk... :mrgreen: but that's OK - I am making reasonable progress.
I am using Link branch and Assembly3
you can also download ... and try it here
excellent Assembly3 tutorials here
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: V0.19 Benchmarking--2019 Monthly Challenges #1,#2,#3,#4,#5,#6,#7a,#7b

Post by ppemawm »

ppemawm wrote: Wed Sep 30, 2020 5:05 pm This assembly can also be created without a master sketch and animated by varying the attachment offset of the Body or LCS links of the disc and slider bodies. This is my preferred approach especially with more complex mechanisms. A simple expression can be used to calculate the attachment offset of the slider as a function of the crank_angle. I will leave this alternative approach for the next post, #7b.
You can model each body in a separate file and then assemble them with Assembly4* (Asm4) while maintaining a link with the original body file that you can update. This is quite useful for bottom-up assembly but also handy for top-down design if you want each body saved in its own file for reuse at another time.

The first steps are to create an assembly file and each body file using the Asm4 workbench. When you create the body file note that you can place the body directly in the Model container rather than the Parts folder. Save each file and open all those that you want to have in the assembly. Before beginning modeling of the body assemble them in the assembly. In that way they will be 'in-context' as they are created since you can actually model in the body link in the assembly file.

This image shows what the tree looks like once you have the body files created and assembled into the assembly file.  The bodies were assembled with the same attachment as the example in #7a.<br /><br />In order to animate the disc and slider it is necessary to define the variables crank_angle which is the angular orientation of the disc and slider_X which is the axial position of the slider.  With the way the LCS's are arranged, the zero angle is on the vertical Y axis.  As a result, the slider X-postion is simply the sin(crank_angle)*radius to the pin center.
This image shows what the tree looks like once you have the body files created and assembled into the assembly file. The bodies were assembled with the same attachment as the example in #7a.

In order to animate the disc and slider it is necessary to define the variables crank_angle which is the angular orientation of the disc and slider_X which is the axial position of the slider. With the way the LCS's are arranged, the zero angle is on the vertical Y axis. As a result, the slider X-postion is simply the sin(crank_angle)*radius to the pin center.
Capture35_variables.jpg (68.04 KiB) Viewed 2163 times
Either the body link attachment offset or the LCS can be used to animate the assembly.  I prefer the former but see also the alternative below**.<br /><br />As shown in this image the offset in the properties panel of the body link is set for the disc rotation angle using the expression field to reference the Variable crank_angle.  The axis is set Y=1 for rotation about that axis and the Y-offset is -1 mm to provide 1 mm clearance between the disc and base that was neglected in the Disc file.
Either the body link attachment offset or the LCS can be used to animate the assembly. I prefer the former but see also the alternative below**.

As shown in this image the offset in the properties panel of the body link is set for the disc rotation angle using the expression field to reference the Variable crank_angle. The axis is set Y=1 for rotation about that axis and the Y-offset is -1 mm to provide 1 mm clearance between the disc and base that was neglected in the Disc file.
Capture36_variables-disc.jpg (87.14 KiB) Viewed 2163 times
The x-position of the slider is set by the same process as the disc.  The animation is left to the student :).
The x-position of the slider is set by the same process as the disc. The animation is left to the student :).
Capture37_variables-slider.jpg (84.77 KiB) Viewed 2163 times
.
The use of expressions to constrain and 'solve' the assembly in this manner provides a lot of flexibility especially for more complicated movements. E.g. conditionals can be used to control sequential movements as shown in this example: https://forum.freecadweb.org/viewtopic. ... 20#p370133
Of course you have to be comfortable with math and trigonometry as well.

**In this example, expressions are used for the attachment offset of the LCS's in order to animate the assembly:
https://forum.freecadweb.org/viewtopic. ... 60#p402648

*see also this documentation for excellent Assembly4 tutorials by zolko: https://github.com/Zolko-123/FreeCAD_As ... HMANUAL.md


OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22474 (Git)
Build type: Release
Branch: master
Hash: a44f8ffd427fa9b23b1f00dbf62d66cd152cd774
Python version: 3.8.5
Qt version: 5.12.6
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United States (en_US)
"It is a poor workman who blames his tools..." ;)
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: V0.19 Benchmarking--2019 Monthly Challenges #1,#2,#3,#4,#5,#6,#7a

Post by ppemawm »

bambuko wrote: Thu Oct 01, 2020 3:43 pm What I meant, is that as soon as you select the feature in the sketch to add dimension to (using variable) and "insert dimension" window appears the variables disappear and you cannot do anything about it
Ahh, Ok now I see what you mean. Perhaps we need a separate Variables View panel instead of having to share the Property panel.
bambuko wrote: Thu Oct 01, 2020 3:43 pm...decrepitude
Nice word...we greybeards need to stick together :)
"It is a poor workman who blames his tools..." ;)
Post Reply