How to see all the properties an object has?
Andre_Comella
Member Posts: 72 PRO
Not sure if this is the right nomenclature, but it would be really helpful to be able to see all the properties an object has (i.e. everything I can access by doing foo.property).
For a more concrete example, I was making coordinate systems and sketch planes. The coordinate systems use .xAxis, and .zAxis while the sketch planes us .x and .y, and .normal. How would I know what these parameters are called? Debug and print both seem to label properties in some human-readable format, which is nice for reading but leaves me guessing and what to use in my code
For a more concrete example, I was making coordinate systems and sketch planes. The coordinate systems use .xAxis, and .zAxis while the sketch planes us .x and .y, and .normal. How would I know what these parameters are called? Debug and print both seem to label properties in some human-readable format, which is nice for reading but leaves me guessing and what to use in my code
0
Best Answer
-
keys(foo) - will give a list of all of the properties of an object.
www.smartbenchsoftware.com --- Renaissance --- Kestrel -- SmartLink
Experts in Onshape Automation - Custom Features and Integrated Applications1
Answers
-
keys(foo) - will give a list of all of the properties of an object.
www.smartbenchsoftware.com --- Renaissance --- Kestrel -- SmartLink
Experts in Onshape Automation - Custom Features and Integrated Applications1 -
Somewhat more idiomatic way: you can mouse over an identifier, and the mouseover documentation will often just link you to the FS docs.
E.g., if you've got a call like evMateConnector(context, ...), mousing over that tells you that it returns a thing of type CoordSystem, which links straight to the docs: https://cad.onshape.com/FsDoc/library.html#CoordSystem0 -
You can also find most of the types in the documentation.
It will list the name of the property and a description of what the type is.
https://cad.onshape.com/FsDoc/library.html#Plane
www.smartbenchsoftware.com --- Renaissance --- Kestrel -- SmartLink
Experts in Onshape Automation - Custom Features and Integrated Applications0 -
keys(foo) was exactly what I was looking for! Thank you!
0
Categories
- All Categories
- 10.2K Community Support
- 4.6K General
- 194 Account and subscriptions
- 353 Data management
- 1.6K Product Feedback
- 215 New in Onshape
- 14 Onshape Labs
- 75 CAM Studio
- 35 PCB Studio
- 107 Simulation
- 209 Onshape Mobile
- 315 App Store & Partners Apps
- 8.2K Using Onshape
- 1.8K Drawings
- 2.3K FeatureScript
- 324 Learning Center
- 253 Education Community


