Jump to content

move point to vertex and draw 3d poly


whosa

Recommended Posts

Hi,

 

I i'm get crazy with this task. 

 

I need to:

 

  1. Moving all the 4 points to the rectangle vertex keeping the zValue of the 4 points
  2. make a 3D closed poly through this vertez

 

Someone can help me with a lisp?

 

Many thank

test.JPG

 

test.dwg

Edited by whosa
Link to comment
Share on other sites

As I understand your question you would like to do something like the following.  Given several mtext objects that are at different z values, you would like to move them to vertices of a rectangle but maintain the z value of each text item.

 

Noting that a 2D polyline must lie on a plane and the plane is defined by the first vertex of the pline you can use the following approach.

 

Given the following we would like to move the text to the corners of the rectangle.

image.png.56397b74a26aba2595a29f497586e0fc.png

Set running osnap to Insertion  and Endpoint  and create the yellow polyline (pline) being careful to snap to the insertion points of the text and the endpoints of the rectangle.  Note that I have added extra vertices.

Turn off osnap insertion but leave Endpoint active and use move while snapping to the vertices (Endpoints) of the yellow line to ensure the z values do not change. 

image.png.6813fa3ae9602b5444e114e1282f1484.png

Delete the yellow pline.

image.thumb.png.addbe1a0d744a8aad2382f921b49ab74.png

 

 

 

 

Link to comment
Share on other sites

Thanks for you reply. I know how to do that one to one. In this project I have 790 ICs like this.

 

I need to move 3160 point by hand. 😃

 

Maybe this could be done by lisp. This will be amazing. Yesterday @dlanorh did a miracle with an lisp

Edited by whosa
Link to comment
Share on other sites

Nothing to do?

 

Maybe only draw automatically 3Dpoly from 4 selected 3d point could help.

 

I will move all this point with osnapZ=1 by hand.

Edited by whosa
Link to comment
Share on other sites

For anyone this is a part two of the whosa post to do road kerbs. A similar request now solved.

 

To whosa how many more questions are you really going to ask for ? This is standard day to day field survey stuff. The best solution is go back to the original data it will be some form of XYZ file hopefully it also has codes as well. Post that then we can really see how we can help.

 

For Lrm like the other post the "point",s are the correct part to join not the mtext, so pick inside and do some form of ray trace angle to sort the join order, its easy for a rectang or always convex shape draw a "H" of points to test.

 

This is from field survey auto strung, blocks added. This is what whosa wants. There are many answers out there start with Civ3D.

 

image.thumb.png.e9ea9f1802997f949168a415d62d44ea.png

Edited by BIGAL
  • Like 1
Link to comment
Share on other sites

Anyway

(defun c:quickanddirty ( / lst ss pt1 pt2)
(while (setq ss (ssget '((0 . "POINT"))))
(setq lst '())
(setq pt1 (getpoint "\npick point inside"))
(repeat (setq x (sslength ss))
(setq pt2 (cdr (assoc 10 (entget (ssname ss (setq x (- x 1)))))))
(setq lst (cons (list (angle pt1 pt2) pt2) lst))
)
(setq lst (vl-sort lst '(lambda (x y) (< (car x)(car y)))))
(command "_line")
(while (= (getvar "cmdactive") 1 )
(repeat (setq x (length lst))
(command (cadr (nth (setq x (- x 1)) lst)))
)
(command "C")
)
)
)

 

 

screenshot192.png

  • Thanks 1
Link to comment
Share on other sites

Thanks, 

7 hours ago, BIGAL said:

Anyway


(defun c:quickanddirty ( / lst ss pt1 pt2)
(while (setq ss (ssget '((0 . "POINT"))))
(setq lst '())
(setq pt1 (getpoint "\npick point inside"))
(repeat (setq x (sslength ss))
(setq pt2 (cdr (assoc 10 (entget (ssname ss (setq x (- x 1)))))))
(setq lst (cons (list (angle pt1 pt2) pt2) lst))
)
(setq lst (vl-sort lst '(lambda (x y) (< (car x)(car y)))))
(command "_line")
(while (= (getvar "cmdactive") 1 )
(repeat (setq x (length lst))
(command (cadr (nth (setq x (- x 1)) lst)))
)
(command "C")
)
)
)

 

 

screenshot192.png

 

Many Thanks, much appreciated. 

 

I'm so sorry for all this question. I received this topo from a client and it is full of strange stuff. I need to convert it in 3D and I start to be crazy. 

 

To move the point under the vertex i found it but this LISP move the point Parallel to a line;

 

I need to move the 4 points on the vertex of the blue rectangle keeping the Z value. 

 

This will be my last question  @BIGAL

 

(defun c:s2o (/ e el p p2 s)
  ;; RJP - 9/12/2017
  (if (and (setq e (car (entsel "\nSelect Object: ")))
           (not (vl-catch-all-error-p (vl-catch-all-apply 'vlax-curve-getendparam (list e))))
           (princ "\nSelect points: ")
           (setq s (ssget ":L" (list '(0 . "POINT"))))
      )
    (foreach pt (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
      (setq p (cdr (assoc 10 (setq el (entget pt)))))
      (setq p2 (vlax-curve-getclosestpointto e p))
      (entmod (append el (list (cons 10 (list (car p2) (cadr p2) (caddr p))))))
    )
  )
  (princ)
)

 

Edited by whosa
Link to comment
Share on other sites

Try this:

(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 . "POINT,LWPOLYLINE"))))
     )
     (foreach e	(vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
       (if (= "POINT" (cdr (assoc 0 (setq el (entget e)))))
	 (setq a (cons (list (cdr (assoc 10 el)) e) a))
	 (setq b (cons (vl-remove-if '(lambda (x) (/= 10 (car x))) el) b))
       )
     )
     (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)
)

 

2020-04-29_10-26-58.gif

Edited by ronjonp
  • Like 1
Link to comment
Share on other sites

13 hours ago, ronjonp said:

Try this:


(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 . "POINT,LWPOLYLINE"))))
     )
     (foreach e	(vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
       (if (= "POINT" (cdr (assoc 0 (setq el (entget e)))))
	 (setq a (cons (list (cdr (assoc 10 el)) e) a))
	 (setq b (cons (vl-remove-if '(lambda (x) (/= 10 (car x))) el) b))
       )
     )
     (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)
)

 

2020-04-29_10-26-58.gif

 

 

Many thanks, work very well. 

 

 

 

 

Link to comment
Share on other sites

is it posible to update this code work with blocks , points and circles ?

 

Thanks

Edited by prodromosm
Link to comment
Share on other sites

9 hours ago, prodromosm said:

is it posible to update this code work with blocks , points and circles ?

 

Thanks

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

40 minutes ago, prodromosm said:

Thank you ronjonp

You're welcome. 🍻

Be aware that if you use attributed blocks there might be some strange results.

Link to comment
Share on other sites

  • 1 year later...

ronjonp, I am trying to get this LISP to work in CIVIL 3D 2021 and it will not allow me to select any Points to move. It will allow me to select blocks but not points. Am I doing something wrong? Any help will be greatly appreciated.

 

Thank you!

Link to comment
Share on other sites

Having been doing Civil work for like 40 years you never move a true cogo point. Why would you not just join the pline to the points re rectang. Ok it wont be a true rectang but close enough.

 

Its almost impossible to put simply  a curved pline through points, we designed roads for years then never went exactly through a series of points they would always be a Best Fit.

 

Look at image in my post above.

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...