- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am pretty new to lisp and have created a few programs for my work. One program I use creates holes within a rectangle by creating a boundary within an area then storing the len and wid and creating holes within. There are basically a bunch of cond statements that compare the hole distance and then creates more holes if the spacing is exceeded. I want to be able to use a selection set to select all of the rectangles at once and then apply the cond statements to each rectangle and create all the holes at once. I have the selection stored and all and the code extracts the values I need from the selection set so that I can create the pattern, however the issue I am having is that the cond. statements only apply to the last rectangle in the selection set (I believe that the selection set order is based on creation order if selected with a window). I think that every time a new len and wid of the rectangle is defined it overwrites the previous data and does not execute the conditional statements until the last entity is selected. I am wondering if anyone has any thoughts on how I could approach this problem? I know that I can create new variables within the code to match the number of entities within the selection set (I have a while loop that I am pretty sure makes sure the code is executed before the next selected entity is created). I could store a new version of len and wid for each selected entity say len1 and wid1 using read and set, but I don't know how to use the cond statement to compare a newly stored variable without literally copying and pasting all of the cond statements.
For example:
(cond ((and (> wid1 len1)(< len 8.5)(< wid 8.5)
(entmake (list (cons 0 "CIRCLE")(cons 10 holex3y1)(cons 40 0.25)(cons 62 2)))
(entmake (list (cons 0 "CIRCLE")(cons 10 holex3y2)(cons 40 0.25)(cons 62 2)))
)
)
)
Is it possible to compare (widx) and (lenx) x being the current entity in the selection set that I need the program to evaluate?
Any thoughts on this would be greatly appreciated (I can post example portions of the code as well but figured I'd get the issue fleshed out in writing before that). Thanks!
Solved! Go to Solution.