1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91 | ;-----------------------------------------------------------------------
; Copyright (c) 2019-2024 by Altair Engineering, Inc.
; Author: Heinz Bruederlin
;
; Add Vision launcher in tools menu.
;
; load script into cadence CIW with
; > load("<path/to/script/launchVision.il")
;
; the script can be loaded multiple times, because
; we delete all procedures with 'putd'.
;
;-----------------------------------------------------------------------
; set path to vision tool including the trailing "/"
; if not found via $PATH variable.
;
CeLaunchVisionPath=""
;-----------------------------------------------------------------------
; set name of vision tool.
;
CeLaunchVisionTool="starvisionpro"
;-----------------------------------------------------------------------
; set the tcl userware commands executed at startup of vision tool.
;
CeLaunchVisionCmd="gui showReadDialog spice"
;-----------------------------------------------------------------------
; launch vision tool.
;
putd('CeLaunchVision nil)
procedure(CeLaunchVision()
prog( (cmd)
cmd = sprintf(nil "%s%s -userwareEval \"%s\" &"
CeLaunchVisionPath CeLaunchVisionTool CeLaunchVisionCmd)
printf("executing %s\n" cmd)
system(cmd)
)
)
;-----------------------------------------------------------------------
; search for tools menu and append one entry
;
putd('CeLaunchVisionMenu nil)
procedure(CeLaunchVisionMenu()
prog( (bannerMenuList pulldownItem menuList menuItem
toolsPulldownItem isInstalled launchVision)
bannerMenuList = hiGetBannerMenus(window(1))
toolsPulldownItem = nil
isInstalled = nil
while(bannerMenuList
pulldownItem = eval(car(bannerMenuList))
if(pulldownItem ->_menuTitle == "&Tools"
toolsPulldownItem = pulldownItem
)
bannerMenuList = cdr(bannerMenuList)
menuList = pulldownItem ->_menuItemList
while(menuList
menuItem = car(menuList)
menuList = cdr(menuList)
if(menuItem == 'CeLaunchVisionMenu then
isInstalled = pulldownItem
)
)
)
if(isInstalled then
printf("Vision launcher already installed in %s\n"
isInstalled->_menuTitle)
else
launchVision = hiCreateMenuItem(?name 'CeLaunchVisionMenu
?itemText "Launch Vision ..."
?callback "CeLaunchVision()")
if(toolsPulldownItem == nil then
CeExportMsg("Tools menu not found, creating it")
toolsPulldownItem = hiCreatePulldownMenu(
'CeToolsMenu "&Tools" list(launchVision))
hiInsertBannerMenu(window(1) toolsPulldownItem 99)
else
hiInsertMenuItem(toolsPulldownItem launchVision 99)
)
)
)
)
;-----------------------------------------------------------------------
; start example
;
;CeLaunchVision()
CeLaunchVisionMenu()
|