Menu

#1 Extended DXF export features

open
nobody
5
2018-01-14
2006-02-22
Mirco Adam
No

Would it be somehow possible to include the elevation
data into the exported DXF-file or alternatively to
introduce an alternate 3D style export based on simple
definitions like height of roadbed, ties and rails to
get the tracks reasonably right (and the splines along
which our virtual locos might ride)?

Discussion

  • Martin Fischer

    Martin Fischer - 2009-06-22
    • milestone: 536558 -->
     
  • Francesc Pinyol Margalef

    I've made a fork where elevation is kept in DXF export:
    https://sourceforge.net/u/cescp/xtrkcad-fork/ci/default/tree/

    It's a first attempt to make it possible to see the layout in 3D,
    by opening the exported DXF file with a CAD program (e.g. FreeCAD).

    In my code, I do not tilt the tracks in space. Instead, given the weak
    slopes used in layouts, I've just added the z coordinate in DXF
    output.

    Up to now, it's working with straight tracks, curved tracks, simple
    turnouts and double turnouts.

    What is not completely working yet are curved tracks (or curved
    sections of turnouts): as I do not kwnow how to specify tilts for
    arcs in DXF, centres are at the correct height, but the curves are
    completely horizontal. See attached files.

    Is this the right approach to have a 3D view of a layout?
    Can someone help with the issue about curved tracks?

     

    Last edit: Francesc Pinyol Margalef 2018-01-14
  • Francesc Pinyol Margalef

    Here is the xtc file.

     
  • Adam Richards

    Adam Richards - 2018-01-14

    Francesc,
    To quote from https://www.autodesk.com/techpubs/autocad/acad2000/dxf/

    Coordinate systems associated with an entity type
    Entities
    3D entities such as line, point, 3dface, 3D polyline, 3D vertex, 3D mesh, 3D mesh vertex

    These entities do not lie in a particular plane. All points are expressed in world coordinates. Of these entities, only lines and points can be extruded. Their extrusion direction can differ from the world Z axis.

    2D entities such as circle, arc, solid, trace, text, attrib, attdef, shape, insert, 2D polyline, 2D vertex, lwpolyline, hatch, image

    These entities are planar in nature. All points are expressed in object coordinates. All of these entities can be extruded. Their extrusion direction can differ from the world Z axis.

    Dimension

    Some of a dimension's points are expressed in WCS and some in OCS.

    Once AutoCAD has established the OCS for a given entity, the OCS works as follows: The elevation value stored with an entity indicates how far to shift the XY plane along the Z axis (from the WCS origin) to make it coincide with the plane that contains the entity. How much of this is the user-defined elevation is unimportant.

    So, if you want a curve in 3D space, you either have to use a 3D entity polyline - or (I guess) to reorientate the current OCS plane so that the 2D object lies on it. (I dont know if you can do this object by object, but I suppose it is plausible to think that if you set the extrusion direction to be orthogonal to the 2D object's plane that might do it?). Note if you do this, though, you will have to adjust the elevation to be in terms of that dimension - by projecting the elevation you want to be in the new Z for the curve OCS rather than the one in XtrkCAD which is in WCS.

    210 Extrusion direction. (optional; default = 0, 0, 1)
    DXF: X value; APP: 3D vector
    

    Hope that gives you a few clues...

    Adam

     

Log in to post a comment.