Jump to content

Recommended Posts

Posted

Hi all,

 

I am beginner in the lisp. I am trying to make a lisp which allows the user to modify the polyline shape to the reference shape with out changing source object start and end points. I have developed a program for this. The problem is it is working when reference has less verteces than source. When the reference has more verteces than source it not functioning correctly. here is the code i have written

 

 

(defun c:gdaln()

(setq GDT_li '())

(setq obj1 (car(entsel "\nselect Reference center line:")))

(setq obj2 (car(entsel "\nSelect center line:")))

(setq obj1_li (entget obj1))

(setq obj2_li (entget obj2))

(setq coun 0)

(while (

(if (= (car(nth coun obj1_li)) 10)

(progn

(setq GDT_li (append gdt_li (list (nth coun obj1_li))))

))

(setq coun (+ coun 1))

)

(setq coun 0)

(setq po1 '())

(setq fobj '())

(while (/= (car(nth coun obj2_li)) 10)

(setq fobj (append fobj (list (nth coun obj2_li))))

(setq coun (+ 1 coun))

(if (= (car(nth coun obj2_li)) 10)

(progn

(setq po1 (append po1 (list (nth coun obj2_li))))

))

)

(setq coun 0)

(setq po2 '())

(while (/= (car(nth coun (reverse obj2_li))) 10)

(setq coun (+ 1 coun))

(if (= (car(nth coun (reverse obj2_li))) 10)

(progn

(setq po2 (append po2 (list (nth coun (reverse obj2_li)))))

))

)

(setq coun 0)

(setq po_li '())

(setq fobj (append fobj (list (nth 0 po1))))

(setq fobj (append fobj (list '(40 . 0))))

(setq fobj (append fobj (list '(41 . 0))))

(setq fobj (append fobj (list '(42 . 0))))

(while (

(setq fobj (append fobj (list (nth coun GDT_li))))

(setq fobj (append fobj (list '(40 . 0))))

(setq fobj (append fobj (list '(41 . 0))))

(setq fobj (append fobj (list '(42 . 0))))

(setq coun (+ 1 coun))

)

(setq fobj (append fobj (list (nth 0 po2))))

(setq fobj (append fobj (list '(40 . 0))))

(setq fobj (append fobj (list '(41 . 0))))

(setq fobj (append fobj (list '(42 . 0))))

(setq fobj (append fobj (list '(210 0.0 0.0 1.0))))

(entmod fobj)

)

 

Please refer the attachment for my requirement

 

Please help me how to correct this.

 

 

Thanks,

Kumar.

Correct functionality.gif

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