Would something similar be able to work in a case like the attached?set_points_example.3dm (143.7 KB)
Two curves with the same structure, the planar curve is a reference. I would want to amend every point location on the 3D Curve to match the XY location of the 2D curve, along matching indexes.
Currently I am trying with the below, but I might be up the wrong tree. I can change the points location, but that isn’t actually reflected in the Rhino document. Currently I’m trying to just set one point, and get that working. Eventually, the aim is to set all points , for a quick and dirty cage edit. Although if the cage edit is still worked out on a point by point basis, then it will probably be quite slow. Ideal scenario is to move the curve points of the MorphControl once, and update the captive object once.
# Match Control Point Locations
# Designed for matching control points of a Control cage to a target location
#Matching XY locations
import rhinoscriptsyntax as rs
import Rhino as rh
import scriptcontext as sc
#My Test Target Location for Setting Point 
target_location = rs.CreatePoint(-342,79,52)
source_guid = rs.GetObject("Pick Morph Control with points to transform", filter = 131072)
source_object = rs.coercerhinoobject(source_guid)
morphcontrol_curve = source_object.Geometry.Curve
print "Location Before:", morphcontrol_curve.Points .Location
points_list = morphcontrol_curve.Points
result = points_list.SetPoint(0, target_location)
print "Location was changed behind the curtain"
print "Location After:", morphcontrol_curve.Points .Location
#Rhino.Geometry.Transform.Translation() # between each original/offset point
# Rhino.Geometry.Collections.NurbsCurvePointList.SetPoint(0, target_location)
# Maybe can just use Replace?
# Maybe transform points? sc.doc.Objects.Transform()
# Eventually match all points on a curve as below
# target = rs.GetObject( "Pick curve to match to", filter = 4 ) ```