I am new to the concept of triggers and haven't been able to spend a lot of time doing any detailed research - so right to the point.
I want to execute a bit of skill code when an item is selected/deselected. Can this be done with the use of a trigger? Is there an other approach which might be better? Any ideas anyone?
Many THANKS in advance,
There are SKILL triggers on select, leRegUserLayerSelectionFilter and leRegUserObjectSelectionFilter which are described in a CDNLive paper from 2006. These commands define a SKILL program which returns a t or nil when anything is selected to select or not select the thing.
There is no de-select version of these triggers.
In reply to Austin CAD Guy:
Thanks for the quick response! I'd like to follow up on this by readiing the CDNLive paper you mentioned. Can you point me to it?
In addition to what Ted has said, you might be able to modify the default bindkey command(s) to replace them with your own versions that do additional things. For example you might replace the left-mouse-click bindkey ("None<Btn1Down>" in bindkey coding) to call your function which is a wrapper, or to call an additional command (space separated in the t_SKILL_cmd string argument to the hiSetBindKey() function). Although not quite what you are looking for, take a look at: SourceLink Solution 11244518
In reply to J Wilwert:
We have used the triggers Ted mentioned in his post as well as a wrapper for the left click bindkey as suggested by Lawrence. For what its worth, here is what we do:
The wrapper code around the left mouse button will print information to the ciw about the selected item. If it is a rectangle, it will print the layer, width, length and area. For paths it prints the width, length and layer. For instances it prints the library name, cell name, instance name and xy location. For pcells, various parameter values are printed. This allows a user to get the most commonly used information without having to query the object.
We registered a skill function with the leRegUserObjectSelectionFilter to determine whether or not an instance should be selectable. We created a user interface to allow designers to lock down cell placements. Once a cell placement is locked, you cannot select that cell (based on the trigger code we wrote). This allows us to significantly reduce those inadvertant cell movements that can wreak havoc on a design before they are discovered. We used to run into problems when routing cells might shift by a small amount and we found out hours later that many connections were mis-aligned. This trigger has saved us many hours of rework.
In reply to dmay:
This is GREAT! This is exactly the direction I am going. First things first - I'll need to write a wrapper for the left mouse button and that should not be too difficult. (If any one has any snippets of code to share that would be grerat.) I want to be very carefull here and not change in any way the current function of the left mouse button. Derek, I really like your ideas about writing info to the ciw - something I've been wanting to do for a long time. I'm sure you have seen a positive impact on your productivity and I and wanting to do the same for my group. From there I'll want to register a skill function to take full advantage of the system's features as you have explained above.
procedure(mySel() mouseSingleSelectPt() item = car(selectedSet()) ;your code here ... printf("Selected item is a %L\n" item~>objType)); proc
hiSetBindKey("Layout" "None<Btn1Down>" "mySel()")hiSetBindKey("Schematics" "None<Btn1Down>" "mySel()")
procedure(mySel() item = car(selectedSet()) ;your code here printf("Selected item is a %L\n" item~>objType))hiSetBindKey("Layout" "None<Btn1Down>" "mouseSingleSelectPt() mySel()")
Thanks for this bit of code - it quickly headed me off in the right direction!
Just a quick follow up question - This works great in selecting a point - how can you make this work with the select area function?
Again, THANK YOU!
I would imagine that you would approach it in a similar way as before, perhaps run additional code after the built-in function:
hiSetBindKey( "Layout" "<DrawThru1>" "leSelBoxOrStretch() myPostAreaSelFunc()" )
Is this what you are asking/looking for? If you wanted to gather the box points yourself, you could do this but you would most likely lose some functionality since the leSelBoxOrStretch() function alows "direct edit" or box selection. Look at enterBox(), to get the box and geSelectArea() to perform an area selection.