Jump to content

Request Lisp PLEASE!- make line and copy position Y, paste it to position Z


ktbjx

Recommended Posts

  • Replies 63
  • Created
  • Last Reply

Top Posters In This Topic

  • Stefan BMR

    39

  • ktbjx

    21

  • Tharwat

    2

  • Grrr

    2

Popular Days

Top Posters In This Topic

I didn't test it. Is it working? It should be.clear.gif

i just tested it!!!! it did!!!!! OMG! its so fast! no more copy and paste!!!!

you're the man!

Link to comment
Share on other sites

Nice...

 

Now... Do you have time to refine it? :twisted:

 

 

 

 

Just joking... It is late here.

Only two things: you should localize all your variable, like start_point etc. And you should check if the selection set is valid. If you don't select any object, you will get an error message.

 

Congratulation for your first lisp.

Link to comment
Share on other sites

did i do it wrong sir?

 

I meant to start with something like this:

(defun C:test ( / ent elist end1 end2 newend1 newend2 newlst)

(while
	(cond
		((not (setq ent (car (entsel "\nSelect line: "))))
			(princ "\nYou missed, try again!")
		)
		((not (eq (cdr (assoc 0 (entget ent))) "LINE"))
			(princ "\nThe selected object is not a line!")
		)
		(T
			(setq elist (entget ent))
			(setq end1 (cdr (assoc 10 elist)))
			(setq end2 (cdr (assoc 11 elist)))
			
			(setq newend1 (list 10 (car end1) (cadr end1) (cadr end1)))
			(setq newend2 (list 11 (car end2) (cadr end2) (cadr end2)))
			
			(setq newlst (subst (list 10 (car end1) (cadr end1) (cadr end1)) (assoc 10 elist) elist))
			(entmod (setq newlst (subst (list 11 (car end2) (cadr end2) (cadr end2)) (assoc 11 newlst) newlst)))
			(alert 
				(strcat "\nCoordinates changed: 
					\nfrom " (vl-princ-to-string end1 )" to " (vl-princ-to-string (cdr (assoc 10 newlst)) ) "
					\nfrom " (vl-princ-to-string end2 )" to " (vl-princ-to-string (cdr (assoc 11 newlst)) ) " "
				)
			)
		)
	)
)
(princ)
)

Then when you get how this base code works, study how to transition the single entity's "transformation" into SS iteration.

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