DXF coordinates problem (import)

Discussion in 'AutoCAD' started by Lodewijk Bogaards, Jan 9, 2004.

  1. Hi there,

    I'm working on a DXF import in a Delphi project. I have a complete
    parser and am able to read some really big drawings already. However, I
    have one problem I cannot figure out, which I only see in a trainstation
    DXF file I have. It manifests itself in two ways, both resulting in
    entities being drawn in the wrong place:

    1) Some circles have center point coordinates which are outside the
    defined space ($extmin, $extmax). I figured that maybe for some stupid
    reason I should invert the values if they fall outside the extmin,
    extmax boundries and that seemed to work, but only for the x axis.

    so in my original code

    .......
    center_point.x := c_x;
    center_point.y := c_y;
    center_point.z := c_z;
    .......

    I inserted this

    if c_x < pParent.FHeaderInfo.ExtMin.x then
    c_x := -c_x;

    and then the circles fall in exactly the right place (maybe that is a
    coincidence). However, when I make it more consistent code and add a

    if c_y < pParent.FHeaderInfo.ExtMin.y then
    c_y := -c_y;
    if c_z < pParent.FHeaderInfo.ExtMin.z then
    c_z := -c_z

    as well, some circles end up on the other end of the screen :(

    2) Some circles and arcs end up in the wrong place, but fall inside the
    extmin, extmax boundries. I am completely clueless why this happens.

    Some extra info: In both cases I have parsed the coordinates correct (I
    checked them manually), the entities are not inside a block or anything
    else and the layer on which they reside is visible and not frozen. Most
    of the entities on the same layer are in the correct place...

    Not every element is implemented in my engine yet, DXF is just too damn
    big to completely and perfectly implement. So the problem may be that I
    didn't handle some element, which translates the coordinate system in
    some way.

    Does anyone have a clue to what my problem is? You would make me a happy
    camper!

    Thanks,

    Lodewijk Bogaards.
     
    Lodewijk Bogaards, Jan 9, 2004
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.