Jump to content

Recommended Posts

Posted (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"]")))

 

image.png.0616a0e95751b315e3911a960383d45e.png

 

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 by phjlc
Posted

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

Posted

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.

Posted

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

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...