I am trying to create a line of a specific length that is perpendicular to a given point on a user-selected element. Can any one tell me what functions will return either the perpendicular or tangent angle at that point on the element? This needs to work for any element type for which one can create a perpendicular, so I don't want to have to create a case statement by element type to get this info if possible. FYI, the user of this vba will indicate with a datapoint which side of the selected element the new line will be created.
Thanks,
Stephanie
Unknown said: I am trying to create a line of a specific length that is perpendicular to a given point on a user-selected element. This needs to work for any element type for which one can create a perpendicular.
Convert the element to a B-spline, then evaluate the tangent at the given point.
Regards, Jon Summers LA Solutions
Jon,
How does one convert an element to a B-spline?
S
Unknown said: How does one convert an element to a B-spline?
BSplineCurve.FromElement
In other words, get your Element object, then copy it into the BSplineCurve using that method:
Dim oElement As XxxElement ... get element from somewhere Dim oBSpline As BSplineCurve ' For BsplineCurve objects, this method will generally succeed if the ' Element's IsTraversableElement property is True oBSpline.FromElement oElement
The BSplineCurve has nice mathematical properties that let you compute all sorts of things. The point here is that you asked for an element-type-independent way of calculating a perpendicular, which is what this conversion provides.
Now that I've got the B-spline, I'm assuming I'd need to use the EvaluatePointTangent function to get the tangent. The documentation for this -- Point3d = object.EvaluatePointTangent (Tangent, Parameter) -- doesn't indicate how/whether to send a Parameter value and specify the point on the element to compute the tangent. Can you fill me in or am I barking up the wrong tree here?
Unknown said: Now that I've got the B-spline, I'm assuming I'd need to use the EvaluatePointTangentfunction to get the tangent. The documentation for this -- Point3d = object.EvaluatePointTangent (Tangent, Parameter) -- doesn't indicate how/whether to send a Parameter value and specify the point on the element to compute the tangent.
The way a lot of parametric analysis works is to normalise the object in question so that its value lies between 0 and 1. That is, if you were to project a point along the line or curve or B-spline, supplying a parameter value 0.0 indicates the beginning of the line. Supplying a parameter value 1.0 means the end of the line. Values between 0.0 and 1.0 indicate somewhere along the line. Values less than zero and greater than one are illegal and meaningless.
Common names for the parameter in algebraic formulæ are t, u, and v.
This Forum is not really the best place to give a class on parametric geometry — there are text books and other means that will do a better job than me.
You can use ComputeMinimumDistance method of curve. Referenced ClosestPoint is filled to be perpendicular... Or if you don't want to fight with BSplines, you can use this:
If Element.IsIntersectableElement Then PerpPoint = Element.AsIntersectableElement.ProjectPointOnPerpendicular2(startPoint, Matrix3dZero) End If
Thanks, DanPaul, but I don't think this is going to work. I don't know the endpoint that is not on the element to use the ProjectPointOnPerpendicular2. I know only the point on the element from which to start creating the perpendicular. Looks like I'm going to have to re-learn some math for this one.
Hello DanPaul,
could you check the link to THIS DISCUSSION. I think meanwhile the discussion moved to somewhere else... :-)
Regards, Mathias
Isn't this the same as the M-Sta tool you get with this key-in
"Construct Line AA Icon"
I Hope this Helps!