- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I have a couple of lists that I want to compare items and see if there is a match.
padLocAndNumList = (((1283.66 6030.51) "BUMP_4") ((1481.42 6030.51) "BUMP_5") ((1382.54 6129.39) "BUMP_1") ((1580.3 6129.39) "BUMP_2") ((1778.06 6129.39) "BUMP_3"))
padLocAndNumList is a list of a block centerpoint and its block attribute. The function uses this to create each:
(setq padLocNum (list (list (car centerPt) (cadr centerPt)) padNumber))
Each padLocNum gets added to the padLocAndNumList.
polyEndpoints = ((1382.54 6129.39) (1580.3 6129.39))
polyEndPoints are the endpoints of a polyline that were created using a function to get the first and last points of a polyline. The function uses this to create the list:
(setq coordList (append coordList (list (list (car vertex)(cadr vertex)))))
This gets returned to polyEndpoints.
Now I want to take the polyEndPoints and search the padLocAndNumList to find a coordinate match (either start or end point).
Admittedly I found this code and I understand what it does through a lot of testing, but I still don't understand why it doesn't work with my lists.
(Findmatches polyEndpoints padLocAndNumList)
(defun Findmatches (plineEnt padList / match matches)
(foreach pad padList
(if (setq match (find plineEnt pad))
(setq matches (cons match matches))
)
)
(setq matches (reverse matches))
)
(defun find (plineEnt pad / match)
(foreach item2 plineEnt (if (vl-position item2 pad) (setq match pad)))
match
)
When I watch in the watch window it looks like it matches the start point with the start point from Bump_1 and the end point with the end point from Bump_2, but it doesn't seem to work. I assume its a problem with my lists, but I can't figure this one out.
I would appreciate any help on this.
Thanks
Solved! Go to Solution.