App::PropertyDirection vs. App::PropertyVector?
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
App::PropertyDirection vs. App::PropertyVector?
Is there a difference between App::PropertyDirection and App::PropertyVector? Both hold a vector and seem identical.
Re: App::PropertyDirection vs. App::PropertyVector?
You mean Part.Vertex vs FreeCAD.Vector?
Thanks
Darek
github.com/dprojects
workbench for woodworking is available at: github.com/dprojects/Woodworking
Re: App::PropertyDirection vs. App::PropertyVector?
They seems the same except for what is contained as data.
they share many things see maybe.
as example pnt is the Vector and dir is a Vector but usually "normalized" to Vector(0, 0, 1) Vector(1, 0, 0) and Vector(0, 1, 0) but even complex things like Vector(0.5, 0.5, 0.5) (fake numbers).
but also normals are returned as Vector but are conceptual more similar to an Axis.
We have had some other discussion recently about cylinder orientation where some code was posted.
I could remember wrong but usually a dir is returned "normalized".
@edwilliams16 will for sure correct me.
Regards
Carlo D.
Edited post to clarify my thoughts and commented out some wrong assumptions.
they share many things see maybe.
Code: Select all
help(Part.makeCylinder())
but also normals are returned as Vector but are conceptual more similar to an Axis.
We have had some other discussion recently about cylinder orientation where some code was posted.
I could remember wrong but usually a dir is returned "normalized".
@edwilliams16 will for sure correct me.
Regards
Carlo D.
Edited post to clarify my thoughts and commented out some wrong assumptions.
Last edited by onekk on Fri Jan 20, 2023 5:53 am, edited 1 time in total.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
Re: App::PropertyDirection vs. App::PropertyVector?
Apart from the name these property types seem identical, there is no built-in normalization of App::PropertyDirection. For example in the Draft WB App::PropertyDirection is not used at all. I just wonder why App::PropertyDirection exists.
-
- Veteran
- Posts: 3192
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: App::PropertyDirection vs. App::PropertyVector?
If I add a Direction Property and set it to (1,1,1), then read it out with Python, it comes back as is - not normalized. Even if I set it to (0,0,0) which is illegal for a direction, it comes back as is. So I would say that it is functionally identical to a Vector.
Rotations make a distinction between RawAxis and the normalized Axis. I'm not sure how to check their Property Types.
I noted that FreeCAD would not accept my changing a Rotation Axis to (0,0,0) - which is good!
Rotations make a distinction between RawAxis and the normalized Axis. I'm not sure how to check their Property Types.
I noted that FreeCAD would not accept my changing a Rotation Axis to (0,0,0) - which is good!
Re: App::PropertyDirection vs. App::PropertyVector?
edwilliams16 wrote: ↑Fri Jan 20, 2023 12:44 am Rotations make a distinction between RawAxis and the normalized Axis. I'm not sure how to check their Property Types.
Code: Select all
obj.getTypeIdOfProperty("Axis")
-
- Veteran
- Posts: 3192
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: App::PropertyDirection vs. App::PropertyVector?
Chris_G wrote: ↑Fri Jan 20, 2023 3:01 pmedwilliams16 wrote: ↑Fri Jan 20, 2023 12:44 am Rotations make a distinction between RawAxis and the normalized Axis. I'm not sure how to check their Property Types.Code: Select all
obj.getTypeIdOfProperty("Axis")
Code: Select all
rot = App.Rotation()
Re: App::PropertyDirection vs. App::PropertyVector?
obj is a document object.
-
- Veteran
- Posts: 3192
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: App::PropertyDirection vs. App::PropertyVector?
@Chris_G
How do I drill down to Axis or RawAxis?
Code: Select all
doc = App.getDocument("Unnamed10")
obj = doc.getObject("Box")
obj.PropertiesList
['AttacherType', 'AttachmentOffset', 'ExpressionEngine', 'Height', 'Label', 'Label2', 'Length', 'MapMode', 'MapPathParameter', 'MapReversed', 'Placement', 'Shape', 'Support', 'Visibility', 'Width']
Re: App::PropertyDirection vs. App::PropertyVector?
I was just answering on "how to get the type of property".