# Locate particular point on a line and draw perpendicular line to it

## MicroStation V8i

This is where you can find and contribute to discussions, ideas, and other information about MicroStation V8i.

#### Locate particular point on a line and draw perpendicular line to it

• rated by 0 members
• This post has 7 Replies |
• 2 Followers
• Do you want to draw perpendicular line from known point on element? If so, you can do it using converting element to BSpline and then getting its FrenetFrame. Or if you like to know perpendicular vector to another vector in 2d, then just swap its X and Y coordinates. In 3d it is not as simple, because you need to identify up vector, so you can do a cross product and then another one cross product to get perpendicular vector...

Jons suggestion helps you to project point B on element from point A, so then line AB will be perpendicular to element, because function PointAtDistance returns distance along element to point which is closest to input point, so to point on perpendiculal. Then, when you use this distance in function PointAtDistance, you will get that point.

Or look into VBA help about functions ProjectPointOnPerpendicular, ProjectPointOnPerpendicular1 and ProjectPointOnPerpendicular2

HTH

• but LineElement.DistanceAtPoint returns distance on particular line element,how is it helpful to place a line at particular point,

As i am very much confused on how to do this, it would be very helpful if i am provided with a sample code on how to do this.

regards,

• AccuSnap is a user option. It potentially helps your user locate a point. Your commands should allow a user to enable AccuSnap, and accept the data points that it generates. However, AccuSnap is not intended to be used programmatically.

You have other ways available to project a point onto an element. For example, if you have a line element, then methods LineElement.DistanceAtPoint and LineElement.PointAtDistance provide a way to snap a point programmatically to a line.

• hi jon,

regarding locating the points, i already have x,y co-ordinates i should make the mouse point to those co-ordinates on the line element can i do it with ACCUSNAP and then draw the line perpendicular to the line element from the SNAP'ed  point .

• You're asking two distinct questions …

1. How do I locate a point on a graphic element?
2. How do I draw a line perpendicular to an existing line?

#### Locate a Point

Create a class that Implements ILocateCommandEvents. Your locate class will behave like other MicroStation tools: in other words, a user familiar with MicroStation will intuitively understand your tool.

#### Draw a Perpendicular Line

MicroStation is a 3D drawing tool. When you ask a question such as "How do I draw a line perpendicular to an existing line?", you must also ask the question "Which way is up?", because otherwise there is an infinite number of answers to your first question.

The solution to "Which way is up?" is a rotation matrix (Matrix3d). The matrix tells your computation the plane on which to draw the line.

#### VBA Help

When writing C#, you probably want to use the MicroStation VBA COM server. VBA objects are described in

VBA help.

Regards, Jon Summers
LA Solutions

• hi jan,

i forgot to mention that i m using c# .net

• Hi skeigh,

in what language do you want to do it? VBA, plain MDL, C++?

Regards,

Jan

• Hello,

How do i locate particular point(x,y) on a line element, i have element id and (x,y) co-ordinate on it. i have to locate that x,y co-ordinate and draw perpendicular line to it??how would i do this,