myCylinder = FreeCAD.ActiveDocument.getObject("Cylinder")
yc = float (myCylinder.Placement.Base.y)
I use this code to take the y value of the position. How can i do to take the value of the y of the axis?
(version 0.20.1 windows)
How can i take the x, y, and z of the axis by a part object in python?
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: How can i take the x, y, and z of the axis by a part object in python?
I may not understand: The origin of a cylinder is on the axis. Getting the y value of the cylinder gives you the y value of the axis.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: How can i take the x, y, and z of the axis by a part object in python?
Sorry, I badly explayned myself: i need to import the rotation axis (i don't know the exact name, but is the one in the attached image)
- Attachments
-
- axis.png (3.39 KiB) Viewed 516 times
-
- Veteran
- Posts: 3194
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: How can i take the x, y, and z of the axis by a part object in python?
Code: Select all
myCylinder.Placement.Rotation.Axis.y
Re: How can i take the x, y, and z of the axis by a part object in python?
thank you, that was what i needed
Re: How can i take the x, y, and z of the axis by a part object in python?
Code: Select all
myCylinder.Placement.Rotation.RawAxis.y
If you change x and y of the axis to -1 in the property editor then
Code: Select all
myCylinder.Placement.Rotation.Axis.y
Code: Select all
myCylinder.Placement.Rotation.RawAxis.y