News:

Please note new Forum URL: forum.designcad.com

Main Menu
DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

GetSelect (full selection set)

Started by prl, January 07, 2009, 08:02:29 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

prl

Overview:  the getselect function doesn't actually access the full selection set and hence the below code doesn't work properly when solids are involved:

dim ent(5000)
maxsel = sys(80)
'get entity numbers of selection and store in array
for j = 1 to maxsel
  getselect j, ent(j)
next j



To fully store the selection set in the ent() array, you can do the below:

dim ent(5000), glist(5000)
.
.
.
maxsel = sys(80)
tglcount = 0 'total grid line counter
'get entity numbers of selection and store in array
for j = 1 to maxsel
  getselect j, ent(j)
  entity ent(j)
  if sys(90) = 32 then 'grid header, check for number of grid lines
     glcount = sys(99) 'grid line count
     for jj = 1 to glcount
       tglcount = tglcount + 1
       glist(tglcount) = ent(j) +  jj
     next jj
  endif
next j
sys(1)=0
sys(80)=0

'add the missing grid lines to the stored selection set
for j = 1 to tglcount
    maxsel = maxsel + 1
    ent(maxsel) = glist(j)
next j
.
.
.




You now have the proper selection set count in variable maxsel, and also the entity ids in the array ent(). 

Thanks to Dempsey, Lar, and Dt.  I pinched some code and understanding from you guys.