Kubotek Forum

KeyCreator & KeyCreator Viewer Technical discussion of CAD/CAM and integrated partner products
Kubotek Forum > KeyCreator & KeyCreator Viewer > KXL: Level sets as pictures View modes: 
User avatar
Advanced member
Advanced member
Dana - 2/8/2018 3:09:37 PM
   
KXL: Level sets as pictures
I think I suggested something like this as an enhancement some time ago, but it came up again when a colleague asked my why the saved level sets, which are used in part referencing, can't be retrieved and displayed in the current part.  Yes, Picture Manager does that, but it seems a waste to have two independent sets of levels.  Anyway, i wrote this kxl, which lets you select a level set and display those levels in the current part, just like PM.  Unlike PM it doens't save view or zoom, big deal.  Enjoy.


DOSUB "DEFINES.KXL"
clear dbox, $$levelsets, displevels, levnums
$progname = "Level Set Display v0.9"

// DMH 180208
// This program displays a list of saved level sets and then displays the selected set

n = -1

LevelSetList $$levelsets
$$levelsets[0] = "default" // fill it in for the list box

dg_init_dialog 25, 80, 5, $progname, 0 , 0, 4, 0
dbox = @ERROR
dg_add_button dbox, 0,  21,  33, 14, "&Cancel", 0, 0, DG_CANCEL | DG_DEFAULT
dg_add_list dbox, 1, 4, 4, 15, 70, 0, $$levelsets, 0, 0, DG_RET_ON_SEL
dg_add_note dbox, 2, 1.5, 4, "Select level set to display:"
dg_draw_dialog dbox
dg_run_dialog dbox
dg_get_list dbox, 1
n = @error
dg_erase_dialog dbox
dg_free_dialog dbox

if (n >= 0)
    goto showlevels
goto end

:showlevels
$$levelsets[0] = "" // clear it back out because really the default set is unnamed
LevelSetGetDisplayedLevels $$levelsets[n], displevels
numlevs = sizeof(displevels)

if (numlevs < 1)
    Goto badlevset
slist $$levnums[numlevs]
l = 0
$levs = ""

:loop
if (l>0)
    StrCat $levs, ","
getlevelinfo displevels[l], $name, $curlev
StrCat $levs, $curlev
l = l + 1
if (l < numlevs)
    goto loop

LevelMod NDISP
LevelMod PDISP, $levs
notestate
goto end

:badlevset
Pause "Bad level set... exiting!"

:end
clear dbox, $$levelsets, displevels, levnumsm, n, l, curlev, levs


User avatar
Advanced member
Advanced member
Soli - 10/7/2018 7:19:33 AM
   
RE:KXL: Level sets as pictures
Dna Hello,

Interesting, We are thinking in a similar way.

I also have a similar macro:

-------------------------------------------------------------------------------------------------------
clear $$acsLevelSets
SList  $$acsLevelSets
LevelSetList  $$acsLevelSets
Int  bAllowNew = 0
Int  bSort = 1
clear $LevelSetName
string $LevelSetName
SelectString "SELECT THE SET LEVELS TO BE DISPLAYED" , $$acsLevelSets , bAllowNew , bSort  , $LevelSetName
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
------------------------------------------------------------------------------------------------------------

I use also a macro that creates a level set for an actual map of levels:

------------------------------------------------------------------------------------------------------------

clear $$existLevelSets
slist $$existLevelSets
clear $$acsLevelSets
SList $$acsLevelSets
LevelSetList  $$existLevelSets
counter_search=0
:loop_search
sprint $$acsLevelSets[counter_search+2] , "%s" , $$existLevelSets[counter_search]
counter_search = counter_search+1
if (counter_search < sizeof ($$existLevelSets))
goto loop_search
$$acsLevelSets[0] = "EXISTING SETS LEVELS; DON'T USE THEM"
$$acsLevelSets[1] = "******************************************"
Int  bAllowNew = 1
Int  bSort = 0
clear $LevelSetName
string $LevelSetName
SelectString "CREATE NEW SET LEVELS" , $$acsLevelSets , bAllowNew , bSort  , $LevelSetName
counter=0
:loop_compare
strcmp $$acsLevelSets[counter] , $LevelSetName , result
if (result == 0)
pause "THE LEVEL SET --- %s --- EXIST; PRESS ENTER TO EXIT ",$LevelSetName
if (result == 0)
EXIT
counter = counter + 1
if (counter < sizeof ($$acsLevelSets))
goto loop_compare
goto create_set
:create_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
-----------------------------------------------------------------------------------------------------------

Regards,
Solomon Steinberg

P.S.
I don't forget how you helped in the past, with levels map.

 

Solomon Steinberg,
Israel

DELL OPTIPLEX 7050
NVIDIA QUADRO P2000
KEYCREATOR 13.5
KEYCREATOR 15.5



User avatar
Advanced member
Advanced member
Soli - 10/7/2018 7:23:51 AM
   
RE:KXL: Level sets as pictures
I meant, Dana Hello
Solomon Steinberg,
Israel

DELL OPTIPLEX 7050
NVIDIA QUADRO P2000
KEYCREATOR 13.5
KEYCREATOR 15.5



User avatar
Advanced member
Advanced member
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
--------------------------------------------------------------------------------------------------------------

Solomon Steinberg,
Israel

DELL OPTIPLEX 7050
NVIDIA QUADRO P2000
KEYCREATOR 13.5
KEYCREATOR 15.5



1
Login