I have this cell:
and upon placement in a model its orientation is set using matrixidentity and looks like this:
Whereas I want the cells to be placed with a CCW rotation so that they are perpendicular to the element the are placed upon like so:
I've been looking into old posts on rotating lines/cells perpendicular to an element. Typical responses that I see are calculate the tangent vector of the point on the element by:
- Converting the element to a B-spline
- Use BsplineCurve.EvaluatePointTangent
I am unfamiliar with this method and any examples I have found don't make a lot of sense to me. In particular I am not totally sure what values I should be using for the arguments Tangent and Parameter. I understand Tangent is a point3d expression but I dont know what value I need to provide it. The only point3d I know I am using is that for the insertion point of the cells. As for parameter, I think I read in a thread that Parameter is a value between 0 and 1 which corresponds as a percentage (expressed as a decimal) of the point on the overall length of the target element measured from the startpoint e.g. 0 = startpoint and 1= endpoint. As that is my understanding(rightly or wrongly), I have assigned a double variable which calculates: distance of point on element from start point/BsplineCurve.ComputeCurveLength. It gives the correct percentages (expressed as a decimal) yet I am at a loss what to do next. The VBA help states BsplineCurve.EvaluatePointTangent should be assigned to a point3d. I have created a new point3d variable but unsure how I extract the tangent vector and then use it apply the required rotation as the only properties it gives me are .X .Y & .Z values. I'm a bit in the dark on this topic and have probably made some incorrect assumptions so any pointers would be appreciated.