Vytukas Posted February 13, 2011 Posted February 13, 2011 Hello, I'm new in this forum and new to visual lisp programming. So i need help with my code. (defun c:imp (/ file_to_process file_open sx_f text_list str_find s_x s_y icount1 icount2 icount cross_ent iname) (setq file_to_process (getfiled "\nChoose file" "F:\\" "txt" 16)) (setq str_list (ssadd)) (setq text_list (ssadd)) (setq iName 0) (vl-cmdf "._zoom" "_E") (if (setq file_open (open file_to_process "r")) (while (setq sx (read-line file_open)) (if (setq str_find (ssget "_X" (list (cons 0 "*TEXT")(cons 1 sx)))) (progn (setq text_list (ssadd (ssname str_find 0) text_list)) (setq str_list (ssadd (ssname str_find 0) str_list)) (setq iName (1+ iName)) (setq s_X (cadr (assoc 10 (entget (ssname str_find 0))))) (setq s_Y (caddr (assoc 10 (entget (ssname str_find 0))))) (setq iCount1 s_X) (setq iCount2 s_Y) (setq iCount "") (while iCount (setq iCount1 (1- iCount1)) (setq iCount2 (1- iCount2)) (if (setq cross_ent (ssget "_C" (list s_X s_Y 0) (list iCount1 iCount2 0) '((62 . 20)))) (progn (setq iCount nil) (setq str_list (ssadd (ssname cross_ent 0) str_list)) );progn );if );while );progn );if );while ) ;if (sssetfirst nil str_list) (close file_open) (princ) ) (princ) I want to find first polyline that is surrounding the text object, but when i run my code it finds it but doesn't select it. I think the problem is here: (if (setq cross_ent (ssget "_C" (list s_X s_Y 0) (list iCount1 iCount2 0) '((62 . 20)))) ;a polyline with color = 20 (progn (setq iCount nil) (setq str_list (ssadd (ssname cross_ent 0) str_list)) );progn );if But i can't get it work right. Can someone explain what i'm doing wrong ? Quote
Smirnoff Posted February 13, 2011 Posted February 13, 2011 1. Why Z in cutting frame coordinates (list s_X s_Y 0) (list iCount1 iCount2 0)? It is no need because will be ignored. And why it is Integer 0 not Real 0.0? 2. The best way to view your cutting frame temporarily add to your code (vl-cmdf "_.rectangle" (list s_X s_Y) (list iCount1 iCount2)) and set break point after it. Quote
Recommended Posts
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.