Kubotek Forum

KeyCreator CAD & CKD Viewer Technical discussion of CAD/CAM and integrated partner products
Subscribe to post
User avatar
Soli - (10/7/2018 3:17:44 PM)
RE:KXL: Level sets as pictures

Dana,

What you wrote is not entirely true.
Picture Manager saves a group of levels but can't display the levels saved in levels set.
Your and my codes does.
I work a lot with level sets and I know is important to see the content of levels set not only in assembly but in current part too.

I played with the previous macros and I combined them in a single one.

How it works?
If the user select an existing level set, the content of levels is displayed in the current part.
If the user write a new name in the input row, a new level set is saved.

Here the macro begins
------------------------------------------------------------------------------------------------------------------
clear $$existLevelSets
slist $$existLevelSets
LevelSetList  $$existLevelSets
Int  bAllowNew = 1
Int  bSort = 0
clear $LevelSetName
string $LevelSetName
SelectString "CREATE NEW LEVEL SET or READ AN EXISTING ONE" , $$existLevelSets , bAllowNew , bSort  , $LevelSetName
counter=0
:loop_compare
strcmp $$existLevelSets[counter] , $LevelSetName , result
if (result == 0)
goto read_level_set
counter = counter + 1
if (counter < sizeof ($$existLevelSets))
goto loop_compare
//CREATE NEW LEVEL SET
clear $message_string
string $message_string
sprint $message_string , "Create new set named = %s" , $LevelSetName
Int  nType = 4
MessageBox $message_string ,  nType
error=@error
if (error == 6)
goto continue
if (error == 7)
exit
:continue
Clear  bPopulate
Int  bPopulate = 1
LevelSetCreate $LevelSetName , bPopulate
notestate
exit
:read_level_set //READ EXISTING LEVEL SET
clear apLevels
HLevel apLevels[0]
LevelSetGetDisplayedLevels $LevelSetName , apLevels
LevelMod NDISP
notestate
clear $$levels_numbers
slist $$levels_numbers
int counter=0
:loop
GetLevelInfo apLevels[counter] ,   , $$levels_numbers[counter]
LevelMod DISP , $$levels_numbers[counter]
notestate
counter = counter+1
if (counter < sizeof (apLevels))
goto loop
exit
--------------------------------------------------------------------------------------------------------------

Login