LISP -- Create Closed polyline from Text

Discussion in 'AutoCAD' started by kam--mik, Sep 28, 2004.

  1. kam--mik

    kam--mik Guest

    I managed to import some polylines from a text file. The codes are attached
    below.
    After importing, I found that the polylines are "OPEN", I would like to know
    how to make them to be "Closed" polylines

    Thanks!



    (defun make-3dpolyline (ptlist)
    (entmake (list '(0 . "POLYLINE")
    '(100 . "AcDbEntity")
    '(100 . "AcDb3dPolyline")
    '(70 . 8)
    ) ;_ list
    ) ;_ entmake
    (repeat (length ptlist)
    (setq pt (car ptlist)
    ptlist (cdr ptlist)
    ) ;_ setq
    (entmake (list '(0 . "VERTEX")
    '(100 . "AcDb3dPolylineVertex")
    (cons 10 pt)
    '(70 . 32)
    ) ;_ list
    ) ;_ entmake
    ) ;_ repeat
    (entmake '((0 . "SEQEND")))
    ) ;_ make-3dpolyline
     
    kam--mik, Sep 28, 2004
    #1
  2. kam--mik

    Kelie Guest

    see if this work

    after the polyline is created, add this line

    (vla-put-closed
    (vlax-ename->vla-object (entlast))
    :vlax-true
    )

    regards,
     
    Kelie, Sep 28, 2004
    #2
  3. kam--mik

    kam--mik Guest

    Hi Kelie,

    I figured it out finally. When we define the polyline, the code 70 represent
    the closure of polyline.
    (value 8 for 3dpolyline and value 1 for closed polyline)

    Therefore the value would be 9 in this case.



    (entmake (list '(0 . "POLYLINE")
    '(100 . "AcDbEntity")
    '(100 . "AcDb3dPolyline")
    '(70 . 9) ;<---------
    ) ;_ list
    ) ;_ entmake
     
    kam--mik, Sep 28, 2004
    #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.