Grasshopper

algorithmic modeling for Rhino

Hello guys,

Unfortunately, I've encountered an other problem with my script. I try to project the points from the top surface to the one below (picture), but all of the points seem to be projected to the exact same location on the top surface (lower left corner) and nothing happens on the projection surface below.

I believe that it may have something to do with the way that I define the direction of the projection.
Unfortunately, I don't know how else to define a direction vector that points in the -z direction. Or is that even the wrong logical approach to feeding it a direction?

Any ideas?

Furthermore, it'd be great, if someone could recommend some general tips to make the py-container faster!?
I've about 7 functions and it takes the container 223ms to execute, but I'm not done yet.
Is it more efficient to split the script to more containers?

Thanks.

Views: 278

Attachments:

Replies to This Discussion

Hi Marc,
rs.ProjectPointToSurface function can accept lists of points too, not only a single point. So you do not need the "for loop". Other than that, when asked for direction always use a unit vector (in this case -z: [0,0,-1]). But these two things are just cosmetic, your code would work without them too.
It's difficult to say, what's causing the problem without the .gh file attached, but look like your "projectPtsToSrf" function returns only the first point from the "ProjPtsLt" list. Just remove the "[0]" part, and I think that will get you all the projected points.

Thanks for your optimisation help. You were wright that your comment is rather cosmetical, but it saved me a loop and I learned something new about a command.

I found out why it didn't work though.
The direction vector pointed in the wrong direction, because of the way a vector is calculated between two points. In fact, the z-value was positive instead of negative. I only had to switch out the first and second point in the command, so that: 
(0-0, 0-0, -1-0) = (0, 0, -1)

The other way around, it was wrong because:
(0-0, 0-0, 0-[-1]) = (0, 0, 1)

Thanks again! :)

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service