Which Python command to use to extract the location of a point

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
paullee
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: Which Python command to use to extract the location of a point

Post by paullee »

FlyingaHull wrote: Tue Nov 23, 2021 2:27 pm I have a project that studies the motion of a parametrized 4-bar linkage, animated with a Python script (I'm new at Python programming). I would like to have the script publish the motion of certain points into a file that I can eventually load into EXCEL. My question is what Python command can be used to extract the x-y-z location of any point in my model into a variable.
Kind of 4-bar hinge e.g. for windows?

Can share e.g. in Arch/BIM sub-forum after you make it ? :)

Image


Thanks !
FlyingaHull
Posts: 16
Joined: Sun Jan 29, 2017 10:26 pm

Re: Which Python command to use to extract the location of a point

Post by FlyingaHull »

To Paullee:

I had 'mispoken' in describing my project as "4-bar" when it is actually just a "3-bar" mechanism, which isn't terribly sophisticated, and I suspect wouldn't be much use for you. The project is a study of the motion of a wing flap driven by a servo, where I wanted to make sure that the device had the appropriate range of movement that I was looking for. FreeCAD helped me with visualization of the motion, as well as allowing for parametric adjustments. This link https://youtu.be/CUgOfjrcX-k was very helpful in showing me how to set up the animation via a Python script. Then finally, through the help of those on this forum, I was able to extract actual motion was useful to record the results.

Regards,
Richard
Attachments
Screenshot 2021-11-30 093008.png
Screenshot 2021-11-30 093008.png (101.41 KiB) Viewed 676 times
mario52
Veteran
Posts: 4673
Joined: Wed May 16, 2012 2:13 pm

Re: Which Python command to use to extract the location of a point

Post by mario52 »

Hi

Macro_crank_simul (in sketcher)

Image


mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
Post Reply