Small example made with Asm3 WB from a * .step file

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
jpg87
Posts: 809
Joined: Thu Mar 16, 2017 7:16 am
Location: Limoges - France
Contact:

Small example made with Asm3 WB from a * .step file

Post by jpg87 »

The assembly :
stepperRed.png
stepperRed.png (52.96 KiB) Viewed 1111 times

The advantage is that opening the file with the Import Step function of Asm3 WB makes it possible to recover the sub-assemblies (with one detail in this example).
As a sub-assembly behaves like a single part, there is no need to constrain parts in sub-assemblies (unless of course your source file contains errors!)

You can see an animation :

http://help-freecad-jpg87.fr/02assembla ... epper.html

If you want the files to test or explanations, request them (approximately 5MB).
My website : http://help-freecad-jpg87.fr updated 2023/11/06
Solarman
Posts: 18
Joined: Tue Aug 04, 2020 6:39 pm
Location: Latin America / Africa

Re: Small example made with Asm3 WB from a * .step file

Post by Solarman »

Hi jpg87,

glad i found your example. may i ask how you made the animation?
i'm trying to animate an imported step-assembly (approx. 88 MB), which i've rebuilt in asm3 (RealThunder's latest release). everything worked very well so far, but i don't want to repeat the work in assembly4.

thx in advance

Al
User avatar
jpg87
Posts: 809
Joined: Thu Mar 16, 2017 7:16 am
Location: Limoges - France
Contact:

Re: Small example made with Asm3 WB from a * .step file

Post by jpg87 »

Solarman wrote: Sun Sep 06, 2020 12:38 pm may i ask how you made the animation?
Hi Solarman,
The pilot mechanical link marked on the image (Join) leaves a rotating DOF between support 1 and pedal 2 :

Pilot mechanical link.png
Pilot mechanical link.png (165.3 KiB) Viewed 896 times

After having set the Lock Angle parameter of the link to True, the value of the angle can then hijack the position of the mechanism which then has 0 DOF.
My solution to animate the mechanism, which is not necessarily the best nor the only one, consists in creating a macro that will vary the value of this angle.
Here is the content of this macro:

Code: Select all

# -*- coding: utf-8 -*-

#DO NOT FORGET TO LOCK THE ANGLE
import time

# Movement go
angle = -20
for i in range(41):
    FreeCAD.getDocument('Asm3_stepper_stepAP214').getObject('Constraint001').Angle = angle
    Gui.runCommand('asm3CmdQuickSolve',0)
    angle += 1
    FreeCADGui.updateGui() # necessary to update the screen before each incrementation
    time.sleep(0.001)

#Return movement
angle = 20
for i in range(41):
    FreeCAD.getDocument('Asm3_stepper_stepAP214').getObject('Constraint001').Angle = angle
    Gui.runCommand('asm3CmdQuickSolve',0)
    angle -= 1
    FreeCADGui.updateGui() # necessary to update the screen before each incrementation
    time.sleep(0.001)

# Macro End ++++++++++
Warning: the starting value angle = -20 of the macro must correspond to the value in the tree. Likewise for the return movement, check that the value given corresponds to the value reached in the forward movement.
My website : http://help-freecad-jpg87.fr updated 2023/11/06
Solarman
Posts: 18
Joined: Tue Aug 04, 2020 6:39 pm
Location: Latin America / Africa

Re: Small example made with Asm3 WB from a * .step file

Post by Solarman »

jpg87 wrote: Mon Sep 07, 2020 12:07 pm
Solarman wrote: Sun Sep 06, 2020 12:38 pm may i ask how you made the animation?
Hi Solarman,
The pilot mechanical link marked on the image (Join) leaves a rotating DOF between support 1 and pedal 2 :


Pilot mechanical link.png


After having set the Lock Angle parameter of the link to True, the value of the angle can then hijack the position of the mechanism which then has 0 DOF.
My solution to animate the mechanism, which is not necessarily the best nor the only one, consists in creating a macro that will vary the value of this angle.
Here is the content of this macro:

Code: Select all

# -*- coding: utf-8 -*-

#DO NOT FORGET TO LOCK THE ANGLE
import time

# Movement go
angle = -20
for i in range(41):
    FreeCAD.getDocument('Asm3_stepper_stepAP214').getObject('Constraint001').Angle = angle
    Gui.runCommand('asm3CmdQuickSolve',0)
    angle += 1
    FreeCADGui.updateGui() # necessary to update the screen before each incrementation
    time.sleep(0.001)

#Return movement
angle = 20
for i in range(41):
    FreeCAD.getDocument('Asm3_stepper_stepAP214').getObject('Constraint001').Angle = angle
    Gui.runCommand('asm3CmdQuickSolve',0)
    angle -= 1
    FreeCADGui.updateGui() # necessary to update the screen before each incrementation
    time.sleep(0.001)

# Macro End ++++++++++
Warning: the starting value angle = -20 of the macro must correspond to the value in the tree. Likewise for the return movement, check that the value given corresponds to the value reached in the forward movement.
perfect! thanks a lot. exactly what i need.

if you had a control function (linear, quadratic, etc.) for the change of angle/distance -unit per second (or frame), this could be the base for a constraint - keyframe animation for asm3 ;) although i'm sure that Realthunder is more than just thinking about some animated constraints already.
Solarman
Posts: 18
Joined: Tue Aug 04, 2020 6:39 pm
Location: Latin America / Africa

Re: Small example made with Asm3 WB from a * .step file

Post by Solarman »

:) that's easier than expected. by selecting the constraint object i see how to access the property.

import time

# Movement go
angle = 0
for i in range(45):
FreeCAD.getDocument('OffRoad_i2_2020_AL').getObject('Constraint013').Angle = angle
Gui.runCommand('asm3CmdQuickSolve',0)
angle += 1
FreeCADGui.updateGui() # necessary to update the screen before each incrementation
time.sleep(0.001)

is it possible to prevent the report view to pop up after each step? i put it on auto hide... maybe...
Solarman
Posts: 18
Joined: Tue Aug 04, 2020 6:39 pm
Location: Latin America / Africa

Re: Small example made with Asm3 WB from a * .step file

Post by Solarman »

jpg87 wrote: Mon Sep 07, 2020 12:07 pm
Solarman wrote: Sun Sep 06, 2020 12:38 pm may i ask how you made the animation?
Hi Solarman,
The pilot mechanical link marked on the image (Join) leaves a rotating DOF between support 1 and pedal 2 :


Pilot mechanical link.png


After having set the Lock Angle parameter of the link to True, the value of the angle can then hijack the position of the mechanism which then has 0 DOF.
My solution to animate the mechanism, which is not necessarily the best nor the only one, consists in creating a macro that will vary the value of this angle.
Here is the content of this macro:

Code: Select all

# -*- coding: utf-8 -*-

#DO NOT FORGET TO LOCK THE ANGLE
import time

# Movement go
angle = -20
for i in range(41):
    FreeCAD.getDocument('Asm3_stepper_stepAP214').getObject('Constraint001').Angle = angle
    Gui.runCommand('asm3CmdQuickSolve',0)
    angle += 1
    FreeCADGui.updateGui() # necessary to update the screen before each incrementation
    time.sleep(0.001)

#Return movement
angle = 20
for i in range(41):
    FreeCAD.getDocument('Asm3_stepper_stepAP214').getObject('Constraint001').Angle = angle
    Gui.runCommand('asm3CmdQuickSolve',0)
    angle -= 1
    FreeCADGui.updateGui() # necessary to update the screen before each incrementation
    time.sleep(0.001)

# Macro End ++++++++++
Warning: the starting value angle = -20 of the macro must correspond to the value in the tree. Likewise for the return movement, check that the value given corresponds to the value reached in the forward movement.
Hi jpg87,

thx a lot! /https://www.dropbox.com/s/imrv23x1mkanj ... L.m4v?dl=0
User avatar
jpg87
Posts: 809
Joined: Thu Mar 16, 2017 7:16 am
Location: Limoges - France
Contact:

Re: Small example made with Asm3 WB from a * .step file

Post by jpg87 »

Hi, I was glad I could help you.
Nice work in FreeCAD and Asm3 and above all very nice project!
My website : http://help-freecad-jpg87.fr updated 2023/11/06
Post Reply