I am really grateful if you can help me understand a few question that I am currently having:
1.I used “incremental loop” in all three steps in order to get the similar effect as “Graft” data datatree in regular gh, but I don’t understand the “Output” generated by the loop, i.e. the amount of data will increase following its index number, instead of one geometry at each places as I intended:
Could you please take a look at my current script (inside Ghpython) python question.gh (115.1 KB)
is there anyway to streamline the whole process e.g. I don’t need to loop to convert the GUID to Point3D everytime and I don’t need to “loop” and “append” in order to move geometries,
If you’re learning use Rhinocommon where possible also read docs, that’s the best way to get your head around this.
import Rhino.Geometry as rg
import math
#Get crv parameters t for each point
params = crv1.DivideByCount(div,True)
#Get list of points for each t
pts = [crv1.PointAt(p) for p in params]
#Output crv lst
crvs = []
#Get crv2 mid pt
crv2_midPt = crv2.PointAt((crv2.Domain[1] - crv2.Domain[0]) / 2)
#For each point, copy the curve to point, rotate if you want
for pt in pts:
vec = pt - crv2_midPt
crv = crv2.Duplicate()
crv.Translate(vec)
crv.Rotate(math.radians(rot),rg.Vector3d(0,0,1),pt)
crvs.append(crv)
Rhinoscriptsyntax library was initially created to help people to transition from RhinoScript (Visual Basic) to Python since you’re not transitioning just learning proper classes, methods, properties etc.; Since we’re doing analogies - if want to play the piano, you definitely do not start with the keyboard. Build good habits from the start, it will pay off in the future. Rhinocommon is also a lot faster (as Rhinoscriptsyntax is just a wrapper written in Rhinocommon), and unlike RS makes you understand a lot of the concepts necessary anyway.
Otherwise or if you’re in rush just use the canvas, nothing you’re doing so far can’t be quickly sketched out in Grasshopper