Author Topic: limit contour  (Read 1557 times)

0 Members and 1 Guest are viewing this topic.

Aldo

  • Newt
  • Posts: 22
limit contour
« on: September 28, 2016, 02:09:18 PM »
Dear
I Contours in cad which must be processed in civil 3d, the inquiry is whether there is any way to generate a contour that delimits these contour lines, attach a file showing clearly what I need, I appreciate the care provided and support I provided.
regards

ronjonp

  • Needs a day job
  • Posts: 7529
Re: limit contour
« Reply #1 on: September 28, 2016, 03:28:20 PM »
Here's a quick one that should work on your example based off of THIS thread. Welcome to TheSwamp  :)
Code - Auto/Visual Lisp: [Select]
  1. (defun c:out (/ _daisychainsort e i l ss)
  2.   (defun _daisychainsort (pt lst / tmp newlst dsort)
  3.     (defun dsort (pt lst / d1 d2)
  4.       (vl-sort lst (function (lambda (d1 d2) (< (distance pt d1) (distance pt d2)))))
  5.     )
  6.     (setq tmp (dsort pt lst))
  7.     (while (setq tmp (dsort (car tmp) (cdr tmp))) (setq newlst (cons (car tmp) newlst)))
  8.     (reverse newlst)
  9.   )
  10.   (if (setq ss (ssget '((0 . "LWPOLYLINE"))))
  11.     (progn (repeat (setq i (sslength ss))
  12.         (setq e (ssname ss (setq i (1- i))))
  13.         (setq l (cons (vlax-curve-getstartpoint e) l))
  14.         (setq l (cons (vlax-curve-getendpoint e) l))
  15.       )
  16.       (setq l (_daisychainsort (car l) l))
  17.       (entmakex (apply 'append
  18.              (list (list   '(0 . "LWPOLYLINE")
  19.                '(100 . "AcDbEntity")
  20.                '(8 . "Boundary")
  21.                '(100 . "AcDbPolyline")
  22.                (cons 90 (length l))
  23.                '(70 . 1)
  24.               )
  25.               (mapcar '(lambda (x) (cons 10 x)) l)
  26.              )
  27.            )
  28.       )
  29.     )
  30.   )
  31.   (princ)
  32. )
« Last Edit: September 28, 2016, 03:36:16 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Aldo

  • Newt
  • Posts: 22
Re: limit contour
« Reply #2 on: September 28, 2016, 05:24:36 PM »
Excellent, it's just what I wanted, very grateful

ronjonp

  • Needs a day job
  • Posts: 7529
Re: limit contour
« Reply #3 on: September 28, 2016, 06:50:34 PM »
Excellent, it's just what I wanted, very grateful
Glad to help 😁

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC