- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi comunity!
I have several functions which work together. Simplified code is here:
(defun loop (sset functiontext / entity) ;receive selection set and text of function as input and do that function on every object of selection set
(if sset
(progn
;(loop code for loop through every object of selection set
(eval (read functiontext )) ;evaluate function within loop
;)end of loop
);progn
);if
); defun
(defun mainfunction (entity point1 point2 param / ) ; main function, which will be evaluated within the loop
(command "_POINTCLOUDCROP" entity point1 point2 param)
);defun
(defun C:test (/ ss point1 point2 param func) ;command, which should join everything together and receive input from user
(setq ss (ssget)) ;select objects
(setq point1 (getpoint "\nSpecify first corner point")) ;specify arguments
(setq point2 (getcorner point1 "\nSpecify second corner point :"))
(setq param "_Inside")
(setq func (strcat "(mainfunction entity (list " (vl-princ-to-string point1) ") " (vl-princ-to-string point2) " \"" (vl-princ-to-string param ) "\")" )) ;build a text of function to execute
(if ss
(loop ss func) ;start loop
);if
);defun
I assume there is somewhere error in building the text of function to execute. Similar simple functions with 1 argument works fine, but here i need to transfer several arguments: lists (points) and string. And I got errors "bad function", "unknown command".
I believe there is some very simple solution with correct syntax, but can't find that in manuals.
Can you help me?
Solved! Go to Solution.