Creating a local file of 3DMesh and 3DPoly vertices

Discussion in 'AutoCAD' started by timbar, Jul 6, 2003.

  1. timbar

    timbar Guest

    I am downloading topographic data which I use to create 3d meshes in AutoCAD (using a 3dMesh script file). I also download 3d line data which I use to create 3d polylines in AutoCAD (using a 3dPoly script file).

    I'd like to create a list of the vertices for the 3d meshes and polylines.

    I'd like to create a local file (a comma separated variable text file, if possible) that lists the vertex number and the X, Y, and Z coordinates of each vertex. These data are available in the Properties Panel for each vertex. I'd like to write them out to a local file.

    Can someone recommend an existing LISP routine (or suggest an approach) that would allow me to create local external text files of vertex data from polygon meshes and 3d polylines in AutoCAD?

    Thanks in advance for your input.

    Tim Barbour
     
    timbar, Jul 6, 2003
    #1
  2. timbar

    David Bethel Guest

    Something like this should work:

    ;;;WRITE VERTEX DATA TO ASCII FILE
    ;;;ARG -> PLINE_ename FLAG_int
    ;;;RET -> nil
    (defun write-vertex (p f / vd wf)
    (and (= (type p) 'ENAME)
    (= (type f) 'INT)
    (= "POLYLINE" (cdr (assoc 0 (entget p))))
    (setq wf (open "vertex.dat" "w"))
    (while (/= "SEQEND" (cdr (assoc 0 (setq vd (entget (entnext p))))))
    (and (= (logand (cdr (assoc 70 vd)) f) f)
    (prin1 (cdr (assoc 10 vd)) wf)
    (write-line "" wf))
    (setq p (entnext p)))
    (close wf))
    (prin1))


    70 Polyline flag (bit-coded); default is 0:
    1 = This is a closed polyline (or a polygon mesh closed in the M direction).
    2 = Curve-fit vertices have been added.
    4 = Spline-fit vertices have been added.
    8 = This is a 3D polyline.
    16 = This is a 3D polygon mesh.
    32 = The polygon mesh is closed in the N direction.
    64 = The polyline is a polyface mesh.
    128 = The linetype pattern is generated continuously around the vertices
    of this polyline.


    (setq flg 64)
    (setq pl (entlast))
    (write-vertex pl flg)

    You'll have to fiure out witch bit flags to use.

    -David
     
    David Bethel, Jul 6, 2003
    #2
  3. timbar

    David Bethel Guest

    That should have been vertex flags. -David

    70 Vertex flags:
    1 = Extra vertex created by curve-fitting.
    2 = Curve-fit tangent defined for this vertex. A curve-fit tangent
    direction of 0 may be omitted from DXF output
    but is significant if this bit is set.
    4 = Not used
    8 = Spline vertex created by spline-fitting
    16 = Spline frame control point
    32 = 3D polyline vertex
    64 = 3D polygon mesh
    128 = Polyface mesh vertex
     
    David Bethel, Jul 6, 2003
    #3
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.