Join Josh Modglin for an in-depth discussion in this video Function: foreach, part of Learning AutoLISP & Visual LISP.
- [Instructor] Another loop function…is the FOREACH function.…The FOREACH function works with the values in a list…and it will continue looping through or iterating through…each item in the list…until all items have been looked at.…We first provide a list to the FOREACH function.…Notice the list that we have here is just numbers.…It's one, two, and so on until six.…That is one of the arguments in our FOREACH function.…The first argument is a temporary variable.…
So temporary, in fact…that as soon as the FOREACH function ends XVAR goes away.…It's not even listed as a local variable.…What happens is every single time FOREACH loops…it takes one of the values in the list…and assigns that value to the XVAR variable…or whatever name that we put here.…We see in our code here what's going to happen.…It's going to loop through each one of these numbers…and it's going to identify whether or not…the number is less than four.…
If the number's less than four…it's simply going to type that out.…If the number's four or greater…
Author
Released
3/10/2017- Reviewing LISP formatting
- Creating a defined function
- Getting and setting variables
- Using an if condition function
- Using a cond condition function
- Working with strings and lists
- Getting data from users
- Working with loops, selection sets, and geometry
- Creating and editing graphic entities
- Reviewing Visual LISP director functions
- Reading and writing to the registry
- Loading LISP files
- Error trapping
Skill Level Intermediate
Duration
Views
Related Courses
-
AutoCAD: Tool Palettes
with Shaun Bryant1h 54m Intermediate -
AutoCAD 2017 Essential Training
with Shaun Bryant8h 40m Intermediate -
AutoCAD 2017 New Features
with Shaun Bryant1h 25m Intermediate
-
Introduction
-
Welcome1m 2s
-
Exercise files56s
-
-
1. LISP Formatting
-
History1m 49s
-
Visual LISP IDE2m 32s
-
-
2. LISP Functionality
-
Creating a defined function2m 52s
-
Creating and using variables5m 26s
-
-
3. Visual LISP Introduction
-
Function: vl-Load-Com1m 29s
-
-
4. Working with Strings
-
Function: strcase1m 48s
-
Function: strcat1m 10s
-
Function: strlen2m 15s
-
Function: substr2m 42s
-
Visual LISP methods3m 22s
-
-
5. Working with Lists
-
Functions: nth and length1m 27s
-
CDR, CAR, CADR, and more2m 5s
-
Function: append52s
-
Visual LISP methods1m 36s
-
6. Getting Data From Users
-
Function: getstring3m 6s
-
Function: getdist3m 56s
-
Function: getreal1m 31s
-
Functions: entsel and entget2m 40s
-
Funtion: getfiled2m 23s
-
-
7. Loops
-
Function: while1m 43s
-
Function: repeat1m 25s
-
Function: foreach1m 52s
-
-
8. Selection Sets
-
Function: ssget1m 56s
-
Selection set filters1m 56s
-
-
9. Working with Geometry
-
Function: polar1m 53s
-
Function: angle2m 4s
-
Function: inters1m 47s
-
-
10. Creating and Editing Graphic Entities
-
Functions: assoc and subst2m 45s
-
Function: subst1m 47s
-
Function: entmod2m 30s
-
Function: entmake2m 22s
-
Function: entdel1m 20s
-
Visual LISP entity functions2m 20s
-
-
11. Creating and Editing Non-Graphic Entities
-
Function: tblsearch1m 22s
-
Visual LISP methods1m 37s
-
-
12. Storing Data
-
Function: namedobjdict1m 33s
-
-
13. Loading LISPs and Error Trapping
-
Loading a LISP file2m 11s
-
Error trapping2m 35s
-
-
Conclusion
-
Next steps19s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Function: foreach