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
Hi, I have been busy with internal training and haven't had time to test it out. Give me a day or two...
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.