Allan B. Posted January 21, 2022 Author Posted January 21, 2022 Thank you for taking interest, The applications I have written are to long sent out. I will take today and check for spelling errors . I know that if I call up each items in the list separately without the foreach function, I have no problem. I am now also trying a different approach (foreach pt list (command pt "copy" etc,etc )) I will get back tomorrow. Allan Quote
Steven P Posted January 21, 2022 Posted January 21, 2022 You could always try a while loop and a counter - I tend to go that way by default but that's just me. Added some 'princ' to tell you how it is going on as an example below.. overkill but sometimes seeing it all written out helps (princ "\nMy List: ") (princ list) ;;Gives you the full list so you can see it (setq acount 0) (while (< acount (length list)) (setq pt (nth acount list)) (princ "\n - count: ") (princ acount) ; Position in list (princ " : pt: " ; (princ pt) ; point (command "copy" pt "" basept despt) (princ "COPY OK") ; Copied OK (setq acount (+ acount 1)) ) ; end while (princ "All Copied") If it struggles at that post what the princ statements say... should be a clue in them 1 1 Quote
Steven P Posted January 21, 2022 Posted January 21, 2022 (edited) You could also put in a check that your pt is of course selecting an object to copy... copy will fail if there is nothing selected to copy of course, something like this? ;;(if (setq mypoint (nentselp "Point" (list 0 0 0))) (if (setq mypoint (nentselp "Point" pt)) (progn (princ "Yes - An Object!") ;;do your copy command here ) (progn (princ "No - Not an object") ;;do something else here ) ) Another question, where are you getting the list of points from? Edited January 21, 2022 by Steven P Quote
Allan B. Posted January 21, 2022 Author Posted January 21, 2022 No luck yet. I setup 2 new circle entities and put them in a list, and verified them , no confusion with any other objects or lists. Than I defined your code as a defun() . next I ran the function, the result entity name _______ entity name _______ -count : 0 pt : < entity name --------->copy ok -count : 1 pt : < entity name---------> copy oK But nothing got copied Allan Quote
Allan B. Posted January 21, 2022 Author Posted January 21, 2022 Sorry Steve it did copy fine, now to to try it with my objects 1 Quote
Steven P Posted January 22, 2022 Posted January 22, 2022 I was expecting "entity name" to be a point (x y z) .... Quote
Allan B. Posted January 22, 2022 Author Posted January 22, 2022 As it happens I found something else, the structure of my main list has errors in its assembly, and that has been causing the copy command and foreach to fail after the 1st copy was made. I have to take a break from this for a few days, I will let you know how things turn out next week. And your code was very helpful THANK YOU Allan 1 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.