Use sketch for kinematic

Show off your FreeCAD projects here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
kisolre
Veteran
Posts: 4163
Joined: Wed Nov 21, 2018 1:13 pm

Use sketch for kinematic

Post by kisolre »

After this post https://forum.freecadweb.org/viewtopic.php?f=24&t=39967 I tried and succeeded in an experiment that I wanted to do for a long time - using a sketch to define placement of objects and create kinematic in sketch to act as an assembly. I noticed that Draft Clone has mapping mode and used that to map clones of the bodies to sketch edges and thus changing sketch moves the clones arround. I also used the kinematic sketch to define dimensions in bodies through CarboCopy.
.
phpBB [video]

.
OS: Windows 8.1 (6.3)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18504 (Git)
Build type: Release
Branch: master
Hash: f66023a646db4b2502bb3637897443b3525ca3c7
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Bulgarian/Bulgaria (bg_BG)
Attachments
CrankShaftKinematic.FCStd
(38.99 KiB) Downloaded 135 times
Last edited by kisolre on Sat Oct 12, 2019 3:45 pm, edited 1 time in total.
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: Use sketch for kinematic

Post by chrisb »

Why do you use these clones? You could place the bodies directly.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
kisolre
Veteran
Posts: 4163
Joined: Wed Nov 21, 2018 1:13 pm

Re: Use sketch for kinematic

Post by kisolre »

chrisb wrote: Wed Oct 09, 2019 7:46 pm Why do you use these clones? You could place the bodies directly.
Because bodies can not be ATTACHED to things? They can be placed but they will not follow sketch changes.
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: Use sketch for kinematic

Post by ppemawm »

kisolre wrote: Wed Oct 09, 2019 8:29 pm Because bodies can not be ATTACHED to things? They can be placed but they will not follow sketch changes.
They can if they are created from a carboncopy of the master sketch.

In the example you referenced, there were eighteen (18) bodies created from multiple copies (Edit>duplicate selection) of a carboncopy of the single master sketch that represents and controls the position of the bodies in the subassembly.
"It is a poor workman who blames his tools..." ;)
kisolre
Veteran
Posts: 4163
Joined: Wed Nov 21, 2018 1:13 pm

Re: Use sketch for kinematic

Post by kisolre »

ppemawm wrote: Wed Oct 09, 2019 10:17 pm They can if they are created from a carboncopy of the master sketch.
There is a difference between the Body object and its actual geometry. In your master sketch approach you move the geometry of the body and not the body itself. And for that to succeed you need to have all placements/dimensions/relations/... in the master sketch. If you want to make an extra hole in the body you need to either add it to the master sketch or make another carboncopy sketch and add it there to keep the relationships.
In this approach you just need to have proper basic body orientation and very simple kinematic sketch. I used it as master for crankshafts crank length and connecting rod distance between heads but that is all. You are free to design your bodies as you want. You can also attach different kinematik sketches in sequence to define different mechanisms.
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: Use sketch for kinematic

Post by chrisb »

kisolre wrote: Wed Oct 09, 2019 8:29 pm Because bodies can not be ATTACHED to things? They can be placed but they will not follow sketch changes.
Thanks
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
kisolre
Veteran
Posts: 4163
Joined: Wed Nov 21, 2018 1:13 pm

Re: Use sketch for kinematic

Post by kisolre »

Another WIP of an Excavator kinematic:
.
Screenshot01.JPG
Screenshot01.JPG (86.11 KiB) Viewed 4261 times
.
Rotating Sketch rotates the whole assembly. Changing HC1, HC2, HC3 (hydraulic cylinder) constraints in Sketch001 moves the arm.
One must pay attention to edge draw direction it it should be used for mapping later.

OS: Windows 8.1 (6.3)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18504 (Git)
Build type: Release
Branch: master
Hash: f66023a646db4b2502bb3637897443b3525ca3c7
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Bulgarian/Bulgaria (bg_BG)
Attachments
Excavator.FCStd
(75.21 KiB) Downloaded 79 times
Last edited by kisolre on Sat Oct 12, 2019 3:45 pm, edited 1 time in total.
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: Use sketch for kinematic

Post by ppemawm »

It would be helpful if you indicated what version you are using.
It seems that the expressions fail for V0.18 or early V0.19 with multiple error messages in the report view:
...Failed to parse expression.
No extension found of type 'PartGui::ViewProviderAttachExtension'...


But, I get no error for my current version, at least for small changes in the variables:
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18356 (Git)
Build type: Release
Branch: master
Hash: 12335c7d52376c140c5328d57902d2c0afdeb588
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)

kisolre wrote: Thu Oct 10, 2019 5:54 am In this approach you just need to have proper basic body orientation and very simple kinematic sketch....You are free to design your bodies as you want....
You have an interesting approach. I am trying to understand where you are going with this.

How one can design or model a new body "out-of-context" is beyond my skill set. E.g., how do you insure that the bodies are not going to interfere when placed in the assembly? If you are working from legacy drawings it is not a problem because the body envelopes have already been determined.

I have always used a top down approach even going back to the drawing board days, but I am open to the advantages of a different method. My next project will be to see if I can somehow blend the use of master sketches, in-context modelling, and an assembly workbench (A2plus?) to take advantage of the assembly constraint engine. Trying to control body positioning with a master sketch(es) can get quite complicated and error prone when working with complex assemblies.
"It is a poor workman who blames his tools..." ;)
kisolre
Veteran
Posts: 4163
Joined: Wed Nov 21, 2018 1:13 pm

Re: Use sketch for kinematic

Post by kisolre »

Added version info to posts with files. Those are created with latest 0.19_pre - after all changes with Link Merge. But the method should work with with older versions that have expressions. Might be that expression format changed after the Link Merge and older versions fail to parse it. I tried latest 0.19_pre version before the LinkMerge that I have and it also fails with some of the expressions.
ppemawm wrote: Sat Oct 12, 2019 3:31 pm I am trying to understand where you are going with this.
I wanted to try something like a simple assembly without any workbench and since there was a solver already why not use it?
ppemawm wrote: Sat Oct 12, 2019 3:31 pm How one can design or model a new body "out-of-context" is beyond my skill set. E.g., how do you insure that the bodies are not going to interfere when placed in the assembly?
In those examples I just modeled something that looks like a real part. In the existing FreeCAD assembly workbenches you model your parts in a separate files so they are "out-of-context" by default. When I model real parts that should work together I usually select meaningful origin and orientation, design one part or at least what will mate with other parts. For the next part I again select meaningful origin and orientation, draw something in the first sketch so body will be visible and then move the second part to there it should be relative to the first and design it there.
But this is Ok just for a single state of the final assembly. And when you need to move them to check for interference it becomes a mess. So having the ability to move things around in a controlled dependent manner helps with that.
Designing a proper sketches and linking them together to properly represent desired relations is of course a challenge but for simple assemblies will do the trick.
Here I used kinematic sketch to define the parts lengths but it can be the other way around - use spreadsheet for basic dimensions and reference those in kinematic and design. Spreadsheet to avoid possible circular dependencies.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Use sketch for kinematic

Post by Zolko »

ppemawm wrote: Sat Oct 12, 2019 3:31 pm I am trying to understand where you are going with this.
kisolre wrote: Sat Oct 12, 2019 5:11 pm I wanted to try something like a simple assembly without any workbench and since there was a solver already why not use it?
Isn't this similar to the assembly without solver thing ?

That evolved to a proper assembly workbench (Assembly4), and I have the feeling you are doing very similar things. Did you check those threads ? Did you try to install/use Assembly4 workbench ?

In the existing FreeCAD assembly workbenches you model your parts in a separate files so they are "out-of-context" by default.
Not necessarily: they must be created out-of-context, in their own file, you're right, but once they're in the assembly they can be edited and changed in-context.

When I model real parts that should work together I usually select meaningful origin and orientation, design one part or at least what will mate with other parts.
Does this approach also work if you want to re-use a part several times ?

Designing a proper sketches and linking them together to properly represent desired relations is of course a challenge but for simple assemblies will do the trick.

Here I used kinematic sketch to define the parts lengths but it can be the other way around - use spreadsheet for basic dimensions and reference those in kinematic and design. Spreadsheet to avoid possible circular dependencies.
I very much like that approach, and I think you can build quite complex mechanisms in such way. Technically, most movements in real life happen anyway in 2D and are mostly combinations of rotation and translation.
try the Assembly4 workbench for FreCAD — tutorials here and here
Post Reply