@Anonymous wrote:
...except the largest polyline, it will NOT play nice. ....that something in the latter half of the program is overriding the assignments made in the first half, but I can't figure it out. Can someone help me out here?
....
You seem to have some disagreement in the code:
....
(and (> (vla-get-length b) 20)(< (vla-get-length b) 5000))
)
;;the object is NOT closed and has length GREATER THAN 50"
....
But fixing that wouldn't change your problem.
I think you're right -- it's getting changed to the Layer you want, and then changed again. I think it's because this part:
(setq c (cons (list (setz (vlax-curve-getStartPoint b))
(setz (vlax-curve-getEndPoint b))
(vla-get-length b)
b
)
c
)
)
;;creating all point list of all lines
is putting every object with its endpoints into that list, regardless of object type [not only lines as described]. In the case of that frame, it probably was put on the FRAMES Layer, but at this point, it's still the 'b' object, and with its start and end points is put into the 'c' list. It is confirmed as being vertical, because its start and end points do align vertically, so since that appears to be the only criterion, later this:
(foreach x (setq c (sortlist c > caar))
(addprop (last x) "HILMOT-ROLLERS")
;;moving all other lines to this layer
)
moves it to the ROLLERS Layer.
If you have only Line entities put into that 'c' list, or only things less than a certain length, or something, this shouldn't happen.
BUT I would suggest a different approach. Instead of a series of (if) functions looking at characteristics of each 'b' object, use (cond) instead. With the series of (if)'s, even after it has found the category something belongs in, and has changed it to the appropriate Layer, it still has to go through evaluating it for whether it belongs in any of the other categories, even though it won't. If you use (cond) instead, it will do what it needs to when it finds the right characteristics, and then it will stop looking at that object, and move on to the next one. So no object will be processed more than once, as your code is apparently doing.
Kent Cooper, AIA