Jump to content

move point to vertex and draw 3d poly


whosa

Recommended Posts

  • 1 year later...
On 5/6/2020 at 4:56 PM, ronjonp said:

is it posible to update this code work with Alignment PI ?

 

Thanks

(defun c:s2o (/ a b c d el m s)
  ;; RJP » 2020-04-29
  ;; Could give bad results for multiple vertices that are within the 'search distance'
  (cond
    ((and (setq d (getdist "\nPick a distance to search: "))
	  (setq s (ssget ":L" (list '(0 . "CIRCLE,INSERT,POINT,LWPOLYLINE"))))
     )
     (foreach e	(vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
       (if (= "LWPOLYLINE" (cdr (assoc 0 (setq el (entget e)))))
	 (setq b (cons (vl-remove-if '(lambda (x) (/= 10 (car x))) el) b))
	 (setq a (cons (list (cdr (assoc 10 el)) e) a))
       )
     )
     (if (setq b (mapcar 'cdr (apply 'append b)))
       (foreach	p a
	 (setq c (mapcar '+ (car p) '(0 0)))
	 (cond
	   ((setq m (vl-some '(lambda (x)
				(if (equal c x d)
				  x
				)
			      )
			     b
		    )
	    )
	    (setq b (vl-remove m b))
	    (entmod (append (entget (cadr p)) (list (cons 10 (append m (list (last (car p))))))))
	   )
	 )
       )
     )
    )
  )
  (princ)
)

 

 

On 5/6/2020 at 4:56 PM, ronjonp said:

Yup.

(defun c:s2o (/ a b c d el m s)
  ;; RJP » 2020-04-29
  ;; Could give bad results for multiple vertices that are within the 'search distance'
  (cond
    ((and (setq d (getdist "\nPick a distance to search: "))
	  (setq s (ssget ":L" (list '(0 . "CIRCLE,INSERT,POINT,LWPOLYLINE"))))
     )
     (foreach e	(vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
       (if (= "LWPOLYLINE" (cdr (assoc 0 (setq el (entget e)))))
	 (setq b (cons (vl-remove-if '(lambda (x) (/= 10 (car x))) el) b))
	 (setq a (cons (list (cdr (assoc 10 el)) e) a))
       )
     )
     (if (setq b (mapcar 'cdr (apply 'append b)))
       (foreach	p a
	 (setq c (mapcar '+ (car p) '(0 0)))
	 (cond
	   ((setq m (vl-some '(lambda (x)
				(if (equal c x d)
				  x
				)
			      )
			     b
		    )
	    )
	    (setq b (vl-remove m b))
	    (entmod (append (entget (cadr p)) (list (cons 10 (append m (list (last (car p))))))))
	   )
	 )
       )
     )
    )
  )
  (princ)
)

 

 

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.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...