Hi all,I want to write a VBA macro which will allow me to draw a perpendicular line from the nearest located element (located from the known point) to a known point. Illustration below
Here are my questions1. How do I locate the nearest element based on the known point?2. How do I generate a line element perpendicular from the located element to the known point?Thanks for the help in advance.
at first, please read and follow MicroStation Programming forum best practices. At this case it means always exactly specifiy what product (because this forum is used also for e.g. MicroStation PowerDraft issues) and what version (name + build number) do you use. Also to use standard form of subject content helps others with easier orientation.
Jacky Lei said:How do I locate the nearest element based on the known point?
Implement IPrimitiveCommandEvents object, it allows (together with other things) to identify element automatically. See MicroStation VBA help for details and examples.
Jacky Lei said:How do I generate a line element perpendicular from the located element to the known point?
It is your responsibility to implement algorithm to create perpendicular element. When primitive command is used, all necessary data (identified element, current position of cursor, active view) is available. MicroStation VBA also provides methods to calculate vector perpendicular to an element, so a final code should be quite simple.
Labyrinth Technology | dev.notes() | cad.point
Jacky Lei said:I want to write a VBA macro
But you've tagged your post with Excel, DGNV8, MicroStation V8i SDK, VBA and macro. Follow Jan's advice. In addition, don't tag your post with irrelevant information because it's misleading. What is tag Excel supposed to tell us? What does DGNV8 tell us? Macro could mean a BASIC macro or VBA.
Regards, Jon Summers LA Solutions