Jump to content

Recommended Posts

Posted

I want to move one object, and i use this:

(command "_.move" (nth i lst) "" p1 p2)

(nth i lst) is ()

What's wrong? How should be?

Posted

post the list of your variable lst to check them out for sure

Posted

AFAICT the syntax is correct:

 

(command "_.move"

(nth i lst) ;

""

p1

p2)

 

now if from a selection set it would be (ssname i lst)

Posted

Here is the whole lisp, command move do nothing... should work for pairs of point and text , where insertion point has the same x and y coordinates, z is different

 

 

(defun c:pz (/ layer punct)
 (princ "\nSELECTEAZA PUNCTELE")
 (setq ssp (ssget '((0 . "point"))))
 (princ "\nSELECTEAZA TEXTELE")
 (setq sst (ssget '((0 . "text"))))
 
 ;;;;;;;;;;;;;;;;;;;;;;LISTA PUNCTE
 (setq i 0)
 (setq listap nil)
(repeat (sslength ssp)
 (setq ename (ssname ssp i))
 (setq data (entget ename))
 (setq entName (cdr (assoc -1 data)))
 (setq punct (cdr (assoc 10 data)))
 (setq layer (cdr (assoc 8 data)))
 (setq culoare (cdr (assoc 62 data)))
 (setq listap (cons (list punct layer culoare entName) listap))
 (setq i (1+ i))
)

 ;;;;;;;;;;;;;;;;;;;;;;LISTA TEXTE
 (setq i 0)
 (setq listat nil)
(repeat (sslength sst)
 (setq ename (ssname sst i))
 (setq data (entget ename))
 (setq entName (cdr (assoc -1 data)))
 (setq pct (cdr (assoc 10 data)))
 (setq z (atof (cdr (assoc 1 data))))
 (setq ztext (caddr pct))
 (setq listat (cons (list pct z ztext) listat))
 (setq i (1+ i))
)
 ;;;;;;;;;;;;;;;;;;;;;
 
;
(setq listabuna nil)
(setq listaent nil)  
(setq i 0)
(repeat    (length listap)
 (setq text (nth i listat))
 (foreach punct listap
   (if    (= (car (car text)) (car (car punct)))
     (setq p (list
          (list
       (car(car punct))
       (cadr(car punct))
       (cadr text)
          ) ;_ end of list
         (setq la (cadr punct))
         (setq cul (caddr punct))
         (setq entitate (cadddr punct)) 
        )
     ) ;_ end of setq
     
   ) ;_ end of if
 ) ;_ end of foreach
 (setq listabuna (cons p listabuna))
 (setq listaent (cons entitate listaent))
 (setq i (1+ i))
) ;_ end of repeat



(setq i 0)
(repeat (length listabuna)
 (entmake  (list (cons 0 "POINT")
         (cons 8 (cadr (nth i listabuna)))
         (if
           (/= (caddr (nth i listabuna)) nil)
           (cons 62 (caddr (nth i listabuna)))
           (cons 62 256)
           )
         (cons 10 (car(nth i listabuna)))))
 
 (command "_.move"
      (nth i listaent)
      ""
      (setq pti(car (nth i listat)))
      (setq ptf
      (list
        (car (car (nth i listat)))
        (cadr (car (nth i listat)))
        (cadr  (nth i listat)))))
 (setq i (1+ i))
 )


(setq sse (ssadd))
(foreach ent listaent (ssadd ent sse))
(command "erase" sse "")

 (princ)
 )

Posted

You need to focus to debug the listabuna variable; it is not so good as should be*.

Also, pay attention that DXF code 62 isn't available if color is set as ByLayer.

 

(buna = the good one)

Posted
Also, pay attention that DXF code 62 isn't available if color is set as ByLayer.

 

True :thumbsup:

 

MSasu, were you able to wirte the code for BDAY greeting?

Posted
MSasu, were you able to wirte the code for BDAY greeting?

I'm afraid that not, yet!

Posted
I'm afraid that not, yet!

 

No big deal Mircea, just bringing a little bit fun for us all.

 

Cheers :)

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