All this code does is populate an array wtih the names of all the part classes in the current model, then passes that to a list_pop_up, which returns the index in the array of the selected item. The list_pop_up routine returns a boolean integer telling whether or not something was actually selected (eg the user didn't hit cancel). So if this return value is true then just return the part class referenced in the array...
routine select_a_pclass() : Part_Class
Const
max_pclass 250
Var
result , the_pclass : Part_Class
num_pclasses_found , pick_process , list_picked : Integer
the_pclasses : Array[ max_pclass ] of String
Begin
num_pclasses_found = 0
the_pclass = first_pclass
while( the_pclass <> NULL ) do
the_pclasses[ num_pclasses_found ] = the_pclass->name
num_pclasses_found = num_pclasses_found + 1
the_pclass = the_pclass->next_pclass
endwhile
--do a list popup using the_pclasses
list_picked = list_pop_up( 'Select a part class' , the_pclasses , pick_process , true )
if( list_picked ) then
return get_part_class( the_pclasses[ pick_process ] )
endif
End
No comments:
Post a Comment