christmas decorations for the schematic editor. Svenn shoul

F

fogh

Guest
Hi All,

I have started writing a toolbar for placing instances in a schematic. I am a
bit too busy for this now, but please contribute if you want.
I should rephrase that: contribute any change you make. Consider this code as
GPL licensed : do not distribute it encrypted or in context-file only format ;
and do send back the improvements.

/*
Frederic Oghdayan , november 2004.
generate a schematic toolbar for the current technology.

TODO:
- group by category,
- skip categories||cells with names like "obsolete" "don t use" ...
- trigger with schematic editor.
- use dlSaveDlist and dlDlistToIcon to generate readymade icons as library
owner. If speed allows, appear/disappear with instance mode.
- find&use grey std color background
- avoid empty icons: make the symbol fatter before turning it to a DL.
X- make more columns depending on available screen height
X- close all cell in scratch mode (and refresh?)
- select by menu which libraries/categories/cells should be in the bar
*/

hiSetBindKey("Schematics" "CtrlShift<Key>t" "CmTechSchIcons()")

procedure(CmTechSchIcons() ;;this proc generates globals with name "^CmTechSch"
let(
;nil
(techlibname cv dl icon iconsymname itemsymname menusymname callback cols rows
handlename w (usablescreenheigth 600) (iconwidth 32) )
usablescreenheigth=if(isCallable('getMaxScreenCoords)
round(80%*cadr(getMaxScreenCoords()))
usablescreenheigth)

;;techlibname="gpdk"
techlibname=techGetTechFile(geGetEditCellView())->libName
CmTechSchItemList=foreach(mapcar ddsym setof(cell ddGetObj(techlibname)->cells
member("symbol" cell~>views~>name))
cv=dbOpenCellViewByType(ddsym->lib->name ddsym->name "symbol")
dbReopen( cv "s" ) ;this saves specifying cellViewType.
foreach(s cv~>shapes
unless(car(s->lpp)=="device" dbDeleteObject(s))
)
dbComputeBBox(cv)
dl=geCellViewToDlist(cv)
;; do this only as library owner and make an autoload
mechanism.;;dlSaveDlist(dl strcat("CmTechSch" "_" techlibname "_" ddsym->name
".displaylist.il") strcat("CmTechSch_DL" "_" techlibname "_" ddsym->name ) )
icon=dlDlistToIcon(dl iconwidth iconwidth )
iconsymname=strcat("CmTechSchFixedMenuIcon" "_" techlibname "_" ddsym->name)
set(stringToSymbol(iconsymname) copy(icon))
itemsymname=strcat("CmTechSchFixedMenuItem" "_" techlibname "_" ddsym->name)
menusymname=strcat("CmTechSchFixedMenu" "_" techlibname "_" ddsym->name)
callback=strcat("schHiCreateInst(\"" ddsym->lib->name "\" \"" ddsym->name "\"
\"" "symbol\"" ")" )
set(
stringToSymbol(itemsymname)
hiCreateMenuItem(
?name stringToSymbol(itemsymname)
?itemText ddsym->name
?itemIcon symeval(stringToSymbol(iconsymname))
?callback callback
)
);set item
dbPurge(cv)
stringToSymbol(itemsymname) ;;mapcar return value
);foreach ddsym

cols=1.0*iconwidth*length(CmTechSchItemList)/usablescreenheigth
if( (cols-floor(cols))/cols < 17%
cols=floor(cols) ;;cram it in
cols=ceiling(cols)
)
printf("%L\n" cols)
rows=ceiling(1.0*length(CmTechSchItemList)/cols)
handlename=strcat("CmTechSchFixedMenuHandle" "_" techlibname)
set(
stringToSymbol(strcat("CmTechSchFixedMenu" "_" techlibname))
hiCreateVerticalFixedMenu(
stringToSymbol(handlename)
CmTechSchItemList
rows
cols
)
)

;; look at schEnableSchFixedMenu() in schView/schFixMenu.il
;;2- trigger in schematic editor
;;CmTechSchFixedMenu_gpdk
;;
w=(isCallable('geGetEditCellViewWindow)&&geGetEditCellViewWindow(geGetEditCellView())
)||(isCallable('geGetCellViewWindow)&&geGetCellViewWindow(geGetEditCellView()))


hiAddFixedMenu(
?window w
?fixedMenu symeval(stringToSymbol(strcat("CmTechSchFixedMenu" "_" techlibname)))
)

);let
);proc
 
Hey Svenn, you did not like it ?

fogh wrote:
Hi All,

I have started writing a toolbar for placing instances in a schematic.
I am a bit too busy for this now, but please contribute if you want.
I should rephrase that: contribute any change you make. Consider this
code as GPL licensed : do not distribute it encrypted or in context-file
only format ; and do send back the improvements.

/*
Frederic Oghdayan , november 2004.
generate a schematic toolbar for the current technology.

TODO:
- group by category,
- skip categories||cells with names like "obsolete" "don t use" ...
- trigger with schematic editor.
- use dlSaveDlist and dlDlistToIcon to generate readymade icons as
library owner. If speed allows, appear/disappear with instance mode.
- find&use grey std color background
- avoid empty icons: make the symbol fatter before turning it to a DL.
X- make more columns depending on available screen height
X- close all cell in scratch mode (and refresh?)
- select by menu which libraries/categories/cells should be in the bar
*/

hiSetBindKey("Schematics" "CtrlShift<Key>t" "CmTechSchIcons()")

procedure(CmTechSchIcons() ;;this proc generates globals with name
"^CmTechSch"
let(
;nil
(techlibname cv dl icon iconsymname itemsymname menusymname callback
cols rows handlename w (usablescreenheigth 600) (iconwidth 32) )
usablescreenheigth=if(isCallable('getMaxScreenCoords)
round(80%*cadr(getMaxScreenCoords()))
usablescreenheigth)

;;techlibname="gpdk"
techlibname=techGetTechFile(geGetEditCellView())->libName
CmTechSchItemList=foreach(mapcar ddsym setof(cell
ddGetObj(techlibname)->cells member("symbol" cell~>views~>name))
cv=dbOpenCellViewByType(ddsym->lib->name ddsym->name "symbol")
dbReopen( cv "s" ) ;this saves specifying cellViewType.
foreach(s cv~>shapes
unless(car(s->lpp)=="device" dbDeleteObject(s))
)
dbComputeBBox(cv)
dl=geCellViewToDlist(cv)
;; do this only as library owner and make an autoload
mechanism.;;dlSaveDlist(dl strcat("CmTechSch" "_" techlibname "_"
ddsym->name ".displaylist.il") strcat("CmTechSch_DL" "_" techlibname "_"
ddsym->name ) )
icon=dlDlistToIcon(dl iconwidth iconwidth )
iconsymname=strcat("CmTechSchFixedMenuIcon" "_" techlibname "_"
ddsym->name)
set(stringToSymbol(iconsymname) copy(icon))
itemsymname=strcat("CmTechSchFixedMenuItem" "_" techlibname "_"
ddsym->name)
menusymname=strcat("CmTechSchFixedMenu" "_" techlibname "_" ddsym->name)
callback=strcat("schHiCreateInst(\"" ddsym->lib->name "\" \""
ddsym->name "\" \"" "symbol\"" ")" )
set(
stringToSymbol(itemsymname)
hiCreateMenuItem(
?name stringToSymbol(itemsymname)
?itemText ddsym->name
?itemIcon symeval(stringToSymbol(iconsymname))
?callback callback
)
);set item
dbPurge(cv)
stringToSymbol(itemsymname) ;;mapcar return value
);foreach ddsym

cols=1.0*iconwidth*length(CmTechSchItemList)/usablescreenheigth
if( (cols-floor(cols))/cols < 17%
cols=floor(cols) ;;cram it in
cols=ceiling(cols)
)
printf("%L\n" cols)
rows=ceiling(1.0*length(CmTechSchItemList)/cols)
handlename=strcat("CmTechSchFixedMenuHandle" "_" techlibname)
set(
stringToSymbol(strcat("CmTechSchFixedMenu" "_" techlibname))
hiCreateVerticalFixedMenu(
stringToSymbol(handlename)
CmTechSchItemList
rows
cols
)
)

;; look at schEnableSchFixedMenu() in schView/schFixMenu.il
;;2- trigger in schematic editor
;;CmTechSchFixedMenu_gpdk
;;
w=(isCallable('geGetEditCellViewWindow)&&geGetEditCellViewWindow(geGetEditCellView())

)||(isCallable('geGetCellViewWindow)&&geGetCellViewWindow(geGetEditCellView()))



hiAddFixedMenu(
?window w
?fixedMenu symeval(stringToSymbol(strcat("CmTechSchFixedMenu" "_"
techlibname)))
)

);let
);proc
 
fogh wrote:
Hey Svenn, you did not like it ?

fogh wrote:

Hi All,

I have started writing a toolbar for placing instances in a
schematic. I am a bit too busy for this now, but please contribute if
you want.
I should rephrase that: contribute any change you make. Consider this
code as GPL licensed : do not distribute it encrypted or in
context-file only format ; and do send back the improvements.
Well I like it even though I only just got it working. There are no
symbol views in the techlibs for AMS processes - they are all stored in
a separate library called PRIMLIB. I just had to specify the techlib
manually to "fix" it.

It'll be more useful when it can ignore the "don't use" cells. I am too
busy myself to look at it at the moment.

Ignoring "parasitics" type categories might be useful as well.

Cheers,

Roger
--
Nottingham One Day Juggling Convention
5th March 2005 - 10am-Late
http://www.nottsjuggling.co.uk
 
Svenn Are Bjerkem wrote:
Roger Light wrote:

fogh wrote:

Hey Svenn, you did not like it ?

fogh wrote:

Hi All,

I have started writing a toolbar for placing instances in a
schematic. I am a bit too busy for this now, but please contribute
if you want.
I should rephrase that: contribute any change you make. Consider
this code as GPL licensed : do not distribute it encrypted or in
context-file only format ; and do send back the improvements.



Well I like it even though I only just got it working. There are no
symbol views in the techlibs for AMS processes - they are all stored
in a separate library called PRIMLIB. I just had to specify the
techlib manually to "fix" it.


How did you do this? I get a division by zero error because
CmTechSchItemList is empty. That means that the foreach mapcar ddsym is
failing.

fogh:
I have a hard time understanding your code. The purpose of the program
is to create a schematic toolbar for the current technology, but I don't
quite get what the code will result in.

Ah. You must have a techfile pointing to a library that contains only
symbolics, while the symbols are located in another, less technology
specific, library.

The assumption in the script is that the techfile associated with your
schematic contains all the symbols you want to see on the bar. You can
force the name to the library that has the symbols, like I did at first
with "gpdk".

What the script does is
for every symbol in the PDK library
- open the symbol in scratch mode, so there is no risk of messing up
what is on disk.
- keep only the drawing of the symbol
- turn this drawing into an icon (with a intermediary step to
display-list format)
- make a callback for the icon that instantiates the symbol

and then collect the icons in a vertical menu.
 

Welcome to EDABoard.com

Sponsor

Back
Top