Jump to content

Recommended Posts

Posted
(defun c:test ( / ss n i e el start_point End_point new_start_point new_End_point romabels )
(setq ss (ssget "_:L" '((0 . "LINE"))))
(setq romabels (Getreal "\nEnter X Value: "))
(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 (romabels) (cadr 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 (romabels) (cadr End_point) (caddr End_point)))
(setq el (subst new_End_point End_point el))
(entmod el)
(setq i (+ 1 i))
)
(princ)
)

 

 

basically my routine just change the coordinate...
StartX = input value

StartY = old StartX

StartZ = old StartY

 

EndX = input value

EndY = old EndX

EndZ = old EndY

 

But it says Error Bad Function "whatever the input value is"

Posted (edited)
(setq start_point (cdr (assoc 10 el)))
(setq new_start_point (list 10 (romabels) (cadr start_point) (caddr start_point)))
(setq el (subst new_start_point (assoc 10 el) el))
(setq End_point (cdr (assoc 11 el)))
(setq new_End_point (list 11 (romabels) (cadr End_point) (caddr End_point)))
(setq el (subst new_End_point (assoc 11 el) el))
(entmod el)

 

This

 

(cadr start_point) (caddr start_point)

 

won't work with this

 

(setq start_point (assoc 10 el))

 

Learn how to use the vlide

 

Edited by dlanorh
clarity
Posted
1 hour ago, dlanorh said:

(setq start_point (cdr (assoc 10 el)))
(setq new_start_point (list 10 (romabels) (cadr start_point) (caddr start_point)))
(setq el (subst new_start_point (assoc 10 el) el))
(setq End_point (cdr (assoc 11 el)))
(setq new_End_point (list 11 (romabels) (cadr End_point) (caddr End_point)))
(setq el (subst new_End_point (assoc 11 el) el))
(entmod el)

 

This

 


(cadr start_point) (caddr start_point)

 

won't work with this

 


(setq start_point (assoc 10 el))

 

Learn how to use the vlide

 

 

what do you mean???

 

 

 

 

If i do this, it works just fine

(setq new_start_point (list 10 (cadr start_point) (cadr start_point) (caddr start_point)))

 

 

 

but if i do this, it gives me error

(setq new_start_point (list 10 (romabels) (cadr start_point) (caddr start_point)))

romabels is taken here at the begining

(setq romabels (Getreal "\nEnter X Value: "))

 

 

 

Posted

Romabels is a variable not a function. There should not be parentheses around it.

(setq new_start_point (list 10 romabels (cadr start_point) (caddr start_point)))

 

  • Like 1
Posted

start_point is a dotted pair which is a different type of list.

Posted
1 hour ago, Roy_043 said:

Romabels is a variable not a function. There should not be parentheses around it.


(setq new_start_point (list 10 romabels (cadr start_point) (caddr start_point)))

 

 

missed that :cry:

Posted
42 minutes ago, dlanorh said:

start_point is a dotted pair which is a different type of list.

 

My mistake, this isn't true. However

 

(cadr start_point) (caddr start_point)

returns the x and y coordinates, not the y and z coordinates

Posted

An alternative


(defun c:test ( / ss ent start_point End_point romabels )
(setq ss (ssget "_:L" '((0 . "LINE"))))
(setq romabels (Getreal "\nEnter X Value: "))
(setq ent (ssname ss 0))
(setq start_point(getpropertyvalue ent "startpoint" ))
(setq end_point (getpropertyvalue ent "endpoint" ))
(setq start_pointx (car start_point))
(setq start_pointy (cadr start_point))
(setq start_pointz (caddr start_point))
(setq end_pointx (car end_point))
(setq end_pointy (cadr end_point))
(setq end_pointz (caddr end_point))
(setpropertyvalue ent "startpoint" (list romabels start_pointx start_pointy))
(setpropertyvalue ent "endpoint" (list romabels end_pointx end_pointy))
)
(C:test)

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