phjlc Posted November 14, 2023 Posted November 14, 2023 (edited) Hi again guys, so I have this code : (setq table (ssget "x" (list '(0 . "INSERT") '(8 . "___OIS-HL-SELECTION!")))) (setq lp (- (sslength table) 1)) (repeat (sslength table) (progn (setq c (strcat c " " (vla-get-textstring(nth 0 (vlax-invoke (vlax-ename->vla-object (ssname table lp)) 'getattributes))))) (setq d (strcat d "/" (vla-get-textstring(nth 0 (vlax-invoke (vlax-ename->vla-object (ssname table lp)) 'getattributes))))) (setq lp (- lp 1)) ) ) (setq c (substr c 2 (strlen c))) (setq d (substr d 2 (strlen d))) (initget c) (setq a (getkword (strcat "Callout Selection : ["d"]"))) But if you see in the very last is PV02, is there a way to change the order of ssget so* that PV02 is next to BA01b, [this is because I create the block PV02 last which indicate the order, and if i redo all of the other blocks after BA01b it will remove the field already reference to other blocks after BA01b] Edited November 14, 2023 by phjlc Quote
Steven P Posted November 14, 2023 Posted November 14, 2023 Not sure if you can order the selection set itself, You could do a while loop, extract each entity name into a separate list in turn, order that list and then another loop to create or re-create the selection set using ssadd with that list Quote
Lee Mac Posted November 14, 2023 Posted November 14, 2023 Construct a list within the repeat loop which may then be sorted using vl-sort - do not rely on the order of entities in a selection set. Quote
BIGAL Posted November 15, 2023 Posted November 15, 2023 Like Lee a SORT of the list will do just that be alphabetical. Trying to re-arrange order only would be very difficult. This makes selections for you based on a list, a hidden feature is it returns the button picked as a string but also the "BUT" variable holds a value of the button selected so you can get an answer from a second list as I think you want, the desired value. (nth (- but 1) lst2)). You can use it in any code with just a couple of lines of code. Multi radio buttons.lsp Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.