RoboDK Forum
PYTHON API GETPOINTS NOT WORKING可打印版本

+- RoboDK Forum (//www.sinclairbody.com/forum)
+-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN)
+--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API)
+--- Thread: PYTHON API GETPOINTS NOT WORKING (/Thread-PYTHON-API-GETPOINTS-NOT-WORKING)



PYTHON API GETPOINTS NOT WORKING-sig.johnnson-04-07-2023

From the documentation:
Code:
GetPoints(feature_type=1, feature_id=0)
Retrieves the point under the mouse cursor, a curve or the 3D points of an object. The points are provided in [XYZijk] format in relative coordinates. The XYZ are the local point coordinate and ijk is the normal of the surface.

Parameters
feature_type (int) – set to FEATURE_SURFACE to retrieve the point under the mouse cursor, FEATURE_CURVE to retrieve the list of points for that wire, or FEATURE_POINT to retrieve the list of points.

feature_id (int) – used only if FEATURE_CURVE is specified, it allows retrieving the appropriate curve id of an object

Returns
List of points

From the actual `.py` file:
Code:
def GetPoints(self, feature_type=FEATURE_HOVER_OBJECT_MESH)
...
if feature_type < FEATURE_HOVER_OBJECT_MESH:
raise Exception("Invalid feature type, use FEATURE_HOVER_OBJECT_MESH, FEATURE_HOVER_OBJECT or equivalent")

The API documentation allows the use of `FEATURE_CURVE` and `FEATURE_POINTS`, but the actual code prevents this. Additionally, the actual code takes only one argument, disallowing the `feature_id` parameter that the API documentation specifies.

Am I doing something wrong, or is this a bug?

Python 3.11.1
RoboDK 5.4.3
Windows 10 Pro


RE: PYTHON API GETPOINTS NOT WORKING-Albert-04-08-2023

一个维efinition of GetPoints is global and returns the the selected object (Robolink) and the other definition of GetPoints applies to one specific object (Item).

I recommend you to take a look at the example you can find in the Item GetPoints:
//www.sinclairbody.com/doc/en/PythonAPI/robodk.html#robodk.robolink.Item.GetPoints


RE: PYTHON API GETPOINTS NOT WORKING-sig.johnnson-04-10-2023

Thanks, Albert! That solved my problem.