Element is above another element

I use microstation 08.11.09.578, DGN 2D V7 Upgrade V8

I use programming language C#

I have 3 lines black, red, green
Is there a way to know if the red and green line is on the black line?

Parents
  • Hi,

    Is there a way to know if the red and green line is on the black line?

    There are plenty of answers available. Unfortunately, without knowing context (conditions, requirements) and your skills and knowledge , it is hard to guess what is the right one.

    On very general level, it is about vector math and comparing two position vectors, so the question does not relate to MicroStation in fact. I assume your knowledge of vector math is good enough to implement own comparing algorithm.

    In practice, the situation is more complex. What does it mean for you "is on another line?". Must be elements the same (vertices are the same)? Or one line can extend another, so one hide the second one partially? A special case is when one line is longer and hides the second one, which is "inside", completely.

    And of course, another issue is coordinates precision, first of all how to compare the coordinates. As you know (I hope you know, because how decimal numbers are implemented in processors, how it is represented in programming language and how they are used in CAD/GIS is mandatory knowledge), it is impossible to compare two floating precision numbers for equality (bad programmers try it ;-), so it must be defined what "the same coordinate" means in particular situation.

    In certain situations (when conditions are met), the simplest way is to use P/Invoke and to call C function mdlElmdscr_areIdenticalToTolerance with properly set COMPAREOPT_ options.

    With regards,

      Jan

  • call C function mdlElmdscr_areIdenticalToTolerance

    While that would be a useful recommendation for an AddIn, the OP likes to write a .NET app. (i.e. an EXE).

    Perhaps  can confirm whether he's building an AddIn (i.e. a DLL) or an executable?

    The problem using element descriptors is that they require memory allocation/deallocation, which is fine if the code executes in-process (i.e.. in an AddIn).  However, there's no mechanism to handle MicroStation memory allocation/deallocation from another process. 

     
    Regards, Jon Summers
    LA Solutions

  • the OP likes to write a .NET app. (i.e. an EXE).

    There is no such information in the questions. When C# is mentioned, NET Addin is preferred and standard way, so when any other - less often approach - is used, it must be mentioned clearly. As I wrote: When the question is not precise and details are not shared, no solution can be found (and questioner is deserved to fail).

    However, there's no mechanism to handle MicroStation memory allocation/deallocation from another process. 

    Even when right generally, in certain situations MicroStation can be requested to do it for you. But, often it leads to complex code and testing to be sure it works as expected, so rarely it is worth to do it ;-)

    Regards,

      Jan

Reply Children
No Data