Jump to content

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


Recommended Posts

Posted

Now you can update the line with the new position:

(entmod el)

  • 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

Posted

Then increase the counter

(setq i (+ 1 i))

and close the loop.

Posted

I'm out for 10 minutes. Keep me updated with your progress.

Posted
I'm out for 10 minutes. Keep me updated with your progress.

i came up with this! :D

 

(defun c:test ( / ss n i e el)
(setq ss (ssget "_:L" '((0 . "LINE"))))
(setq i 0)
(setq n (sslength ss))

(while (< i n)
(setq e (ssname ss i))
(setq el (subst new_end_point end_point el))
( (-1 . <Entity name: 7ff6db706600>)
(0 . "LINE") 
(330 . <Entity name: 7ff6db7051f0>) 
(5 . "1E8")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(100 . "AcDbLine")
(10 19.2702 -4.33456 -4.33456)
(11 20.351 -13.4291 -13.4291)
(210 0.0 0.0 1.0) )

(setq start_point (assoc 10 el))
(setq new_start_point (list 10 (cadr start_point) (caddr start_point) (caddr_start_point)))
(entmod el)
(setq i (+ 1 i))
)
(princ)
)

 

is it wrong?

Posted

Maybe it would be easier if you started with entsel behaviour, and then transition to SS.

Posted
Maybe it would be easier if you started with entsel behaviour, and then transition to SS.

did i do it wrong sir?

Posted

Delete this part

( (-1 . <Entity name: 7ff6db706600>)
(0 . "LINE")
(330 . <Entity name: 7ff6db7051f0>)
(5 . "1E8")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(100 . "AcDbLine")
(10 19.2702 -4.33456 -4.33456)
(11 20.351 -13.4291 -13.4291)
(210 0.0 0.0 1.0)
)

Posted

This is the el value, it is not part of the code.

Posted
Delete this part

( (-1 . <Entity name: 7ff6db706600>)
(0 . "LINE")
(330 . <Entity name: 7ff6db7051f0>)
(5 . "1E8")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(100 . "AcDbLine")
(10 19.2702 -4.33456 -4.33456)
(11 20.351 -13.4291 -13.4291)
(210 0.0 0.0 1.0)
)

 

like this???

 

(defun c:test ( / ss n i e el)
(setq ss (ssget "_:L" '((0 . "LINE"))))
(setq i 0)
(setq n (sslength ss))

(while (< i n)
(setq e (ssname ss i))
(setq el (subst new_end_point end_point el))
(setq start_point (assoc 10 el))
(setq new_start_point (list 10 (cadr start_point) (caddr start_point) (caddr_start_point)))
(entmod el)
(setq i (+ 1 i))
)
(princ)
)

Posted

Almost.

First (setq el... should be (setq el (entget e))

Posted

The second goes after (setq new_start_point

Posted

And this is just the start of the line. You need to do the same with the end, which is (assoc 11 el)

Posted
(defun c:test ( / ss n i e el)
(setq ss (ssget "_:L" '((0 . "LINE"))))
(setq i 0)
(setq n (sslength ss))

(while (< i n)
(setq e (ssname ss i))
(setq el (entget e))
(setq start_point (assoc 10 el))
(setq new_start_point (list 10 (cadr start_point) (caddr start_point) (caddr_start_point)))
(setq el (entget e))
(setq start_point (assoc 11 el))
(setq new_start_point (list 11 (cadr start_point) (caddr start_point) (caddr_start_point)))
(entmod el)
(setq i (+ 1 i))
)
(princ)
)

Posted

The "second" (setq el should be (setq el (subst new_start_point start_point el)).

Then another one just before (entmod el).

THERE IS A TYPO in (list 10 (cadr .... The last list should have a space between caddr and start_point.

Posted
The "second" (setq el should be (setq el (subst new_start_point start_point el)).

Then another one just before (entmode el).

THERE IS A TYPO in (list 10 (cadr .... The last list should have a space between caddr and start_point.

(defun c:test ( / ss n i e el)
(setq ss (ssget "_:L" '((0 . "LINE"))))
(setq i 0)
(setq n (sslength ss))

(while (< i n)
(setq e (ssname ss i))
(setq el (entget e))
(setq start_point (assoc 10 el))
(setq new_start_point (list 10 (cadr start_point) (caddr start_point) (caddr start_point)))
(setq el setq el (subst new_start_point start_point el))
(setq End_point (assoc 11 el))
(setq new_End_point (list 11 (cadr End_point) (caddr End_point) (caddr End_point)))
(entmod el)
(setq i (+ 1 i))
)
(princ)
)

Posted

You have (setq el setq el....

(setq el (subst new_start_point start_point el))

Posted

And add this line just before (entmod el)

[/i](setq el (subst new_End_point End_point el))[i]

Posted
You have (setq el setq el....

(setq el (subst new_start_point start_point el))

(defun c:test ( / ss n i e el)
(setq ss (ssget "_:L" '((0 . "LINE"))))
(setq i 0)
(setq n (sslength ss))

(while (< i n)
(setq e (ssname ss i))
(setq el (entget e))
(setq start_point (assoc 10 el))
(setq new_start_point (list 10 (cadr start_point) (caddr start_point) (caddr start_point)))
(subst new_start_point start_point el)
(setq End_point (assoc 11 el))
(setq new_End_point (list 11 (cadr End_point) (caddr End_point) (caddr End_point)))
(entmod el)
(setq i (+ 1 i))
)
(princ)
)

Posted
And add this line just before (entmod el)

[/i](setq el (subst new_End_point End_point el))[i]

i get it now!

(defun c:test ( / ss n i e el)
(setq ss (ssget "_:L" '((0 . "LINE"))))
(setq i 0)
(setq n (sslength ss))

(while (< i n)
(setq e (ssname ss i))
(setq el (entget e))
(setq start_point (assoc 10 el))
(setq new_start_point (list 10 (cadr start_point) (caddr start_point) (caddr start_point)))
(setq el (subst new_start_point start_point el))
(setq End_point (assoc 11 el))
(setq new_End_point (list 11 (cadr End_point) (caddr End_point) (caddr End_point)))
(setq el (subst new_End_point End_point el))
(entmod el)
(setq i (+ 1 i))
)
(princ)
)

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