11-22-2021, 08:17 PM (This post was last modified: 11-22-2021, 08:19 PM by audreyv.)
I've been using a python script to generate a curve and project it onto a surface.
The python script uses the RoboDK API and curve follow project. For some reason when I run the program on RoboDK, it generates the curve but does not project the curve onto the surface. It also says that the python script just keeps running, and doesn't stop until I manually choose for it to stop.
When I send the whole station to a coworker, it works for her just fine. I was wondering if it might be the version of RoboDK or Python or what might be causing this issue.
This program will create points and project those points on a window blank; x,y - coordinates form a sine wave
# x x-coordinate in mm
# y y-coordinate in mm
# z z-coordinate in mm
# y_steps y-coordinate increments between points
# x_steps x-
# Generate points that will be used to create sine wave path
POINTS = Make_Points(Point_Start, Point_End, Num_Points)
# Open communication with simulator
RDK = Robolink()
# Turn off auto rendering
# Automatically delete previously generated items (Auto tag)
list_items = RDK.ItemList()
for item in list_items:
# Turn rendering ON before starting the simulation
object_curve = RDK.AddCurve(POINTS)
ProjectionType = PROJECTION_CLOSEST
# Available values include:
#PROJECTION_NONE = 0 # No curve projection
#PROJECTION_CLOSEST = 1 # The projection will be the closest point on the surface
#PROJECTION_ALONG_NORMAL = 2 # The projection will be done along the normal.
#PROJECTION_ALONG_NORMAL_RECALC = 3 # The projection will be done along the normal. Furthermore, the normal will be recalculated according to the surface normal.
#PROJECTION_CLOSEST_RECALC = 4 # The projection will be the closest point on the surface and the normals will be recalculated
#PROJECTION_RECALC = 5 # The normals are recalculated according to the surface normal of the closest projection
# Ask the user to provide the object with the features
object_features = RDK.ItemUserPick("Select object with the features to project (curves and/or points)", ITEM_TYPE_OBJECT)
if not object_features.Valid():
# Ask the user to provide the object with the surface used as a reference
object_surface = RDK.ItemUserPick("Select Surface Object to project features", ITEM_TYPE_OBJECT)
if not object_surface.Valid():
# Create a duplicate copy of the surface object
new_object = RDK.Paste(object_surface.Parent())
# Hide the objects used to build the new object with the desired curves
# Turn Off rendering (faster)
# Add all curves, projected as desired (iterate through all curves until no more curves are found)