convertpoly


alf
 Share

Recommended Posts

nie działa, ale dorzuciłam do tego:

(defun c:2D2 (/ s i)
  (if (setq s (ssget '((0 . "POLYLINE") (-4 . "<not") (-4 . "&") (70 . 120) (-4 . "not>"))))
    (repeat (setq i (sslength s))
      (OldStyle2LwPolyline (ssname s (setq i (1- i))))
    )
  )
  (princ)
)

 

 

jeszcze to, to ze strony https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/td-p/7124499:  i teraz działa. Nie wnikam jak ;-), dzięki!

;; OldStyle2LwPolyline (2008/03/31)
;; Replace a 2d polyline with a light weight polyline
;;
;; Argument : 2d polyline (ename)
;; Return : light weight polyline (ename)

(defun OldStyle2LwPolyline (pl / plst xdata vtx vlst elst)
  (setq	plst  (entget pl '("*"))
	xdata (assoc -3 plst)
	vtx   (entnext pl)
  )
  (while (= (cdr (assoc 0 (setq vlst (entget vtx)))) "VERTEX")
    (if	(zerop (logand (cdr (assoc 70 vlst)) 16))
      (setq elst (cons (vl-remove-if-not
			 (function
			   (lambda (x)
			     (member (car x) '(10 40 41 42))
			   )
			 )
			 vlst
		       )
		       elst
		 )
      )
    )
    (setq vtx (entnext vtx))
  )
  (if (setq new
	     (entmakex
	       (append
		 (list
		   '(0 . "LWPOLYLINE")
		   '(100 . "AcDbEntity")
		   (assoc 410 plst)
		   (assoc 8 plst)
		   (cond
		     ((assoc 39 plst))
		     (T '(39 . 0))
		   )
		   '(100 . "AcDbPolyline")
		   (cons 90 (length elst))
		   (cons 70 (logand 129 (cdr (assoc 70 plst))))
		   (cons 38 (last (caar elst)))
		   (assoc 210 plst)
		 )
		 (apply 'append (reverse elst))
		 (if xdata
		   (list xdata)
		 )
	       )
	     )
      )
    (entdel pl)
  )
  new
)
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share