I'm interested in finding which layers are in use at a particular point
in a layout - so something similar to leHiLayerTap but that would return
a list of the layers at the given point.
I've looked at the diva/assura/layout skill manuals without seeing
anything that looks appropriate.
Can anybody suggest where I should start looking?
Best wishes and happy new year :)
Cheers,
Roger
> I'm interested in finding which layers are in use at a particular point
> in a layout - so something similar to leHiLayerTap but that would return
> a list of the layers at the given point.
I really ought to do more searching before I request help.
It looks as though dbGetOverlaps/dbGetTrueOverlaps is what I need.
So something like:
procedure( printLayerAtPoint()
let( (cv point ovlps ovlp)
cv=geGetEditCellView()
point=enterPoint()
ovlps=dbGetOverlaps(cv list(point point))
foreach( ovlp ovlps
println(ovlp~>layerName)
)
)
)
That doesn't work if the point has a cell beneath it as cells don't have
a layerName property).
In the thread "virtual flattening of a pcell", Andrew Beckett said:
"What I always do in these situations is to use functions like
dbTransformPoint
and dbTransformBBox, to transform the points up through the hierarchy.
Of course, you need the correct transformation, which can be found by
dbConcatTransform-ing the transformations through the hierarchy
returned by the dbGetOverlaps.
(procedure (ABgetOverlapTransform overlap)
(let (transform)
(if (listp overlap)
(setq transform (dbConcatTransform
(ABgetOverlapTransform (cadr overlap))
(dbGetq (car overlap) transform)
))
(setq transform (list 0:0 "R0" 1.0)))
transform
))
This is the function I use to take one of the overlaps found by
dbGetOverlaps
or dbGetTrueOverlaps and find the transformation. Then I can transform the
points up to the starting cellView.
I think this is in effect what you mean by virtually flattening it."
Which I think should help in finding the layers in lower down cells.
Something else I came across whilst searching through old usenet
archives was the absolute gem that you can use ~>? on a database
reference (eg. db:1234567) to find out what properties it has. I'd
always wondered how this was done and am sure there must be other people
out there wondering the same.
Thanks for your help, even if it was just in past postings :)
Roger
;; return a list of layer purpose pairs at the given point
;; considering the top level of hierarchy down the specified (depth)
;; number of levels.
(defun XyzGetLppsAtPoint (d_cv pt @key (depth (dbGetMaxHierDepth)))
(let ((hash (makeTable 'lpps nil)))
(foreach ovlp_obj (dbGetOverlaps d_cv (list pt pt) t depth)
(let ((obj (XyzGetOvlpObj ovlp_obj)))
(when (obj~>isShape)
hash[obj~>lpp]=t)))
hash->?))
;; ovlp_obj is an element of the return value of dbGetOverlaps
;; RETURNS the object at the bottom of the hierachy which is described
by
;; the ovlp_obj.
(defun XyzGetOvlpObj (ovlp_obj)
(cond
((null ovlp_obj)
nil)
((dbobjectp ovlp_obj)
ovlp_obj)
((atom ovlp_obj)
(error "list or dbobject expected %L" ovlp_obj))
((null (cdr ovlp_obj))
(car ovlp_obj))
((listp (cadr ovlp_obj))
(XyzGetOvlpObj (cadr ovlp_obj)))
(t
(XyzGetOvlpObj (cdr ovlp_obj)))))
It's not in the documentation, though I suppose it could be added. And
I'm a bit unsure when it was put into Diva, so it may not work if you're
running something old.
In your .cdsinit add the following key binding. Then put the cursor at
the point of interest and press control-L. The layers will be shown in
the CIW with cell hierarchy information as well.
hiSetBindKey("Layout" "Ctrl<Key>l" "ivLayersAtXY()")
> hi Roger, you could also use something like the following.
> The trick is you need a function to handle the objects
> returned from dbGetOverlaps.
That works brilliantly, although I don't understand it all.
Thanks very much.
Cheers,
Roger
> It's not in the documentation, though I suppose it could be added. And
> I'm a bit unsure when it was put into Diva, so it may not work if you're
> running something old.
>
> In your .cdsinit add the following key binding. Then put the cursor at
> the point of interest and press control-L. The layers will be shown in
> the CIW with cell hierarchy information as well.
>
> hiSetBindKey("Layout" "Ctrl<Key>l" "ivLayersAtXY()")
I guess 5.1.41 USR2 counts as old then because I get an undefined
function error. Not to worry, as Jimka's solution works nicely.
Thanks,
Roger
Here is how the function works....
dbGetOverlaps returns a list of what i call overlap objects. an
overlap object
or ovlp_obj object, is either a dbobject or a list of one of the
following forms
signifying a path down the hierarchy to a target object
(inst (inst (inst ...(inst obj))))
or
(inst inst ... inst obj)
The first of which is what i get when i call the function, but the
second
is what you would assume reading the documentation. (at least the last
time i read the documentation it was confusing, maybe it has been fixed
in the mean time.)
The last obj in that list is either an instance or a shape.
My function XyzGetOvlpObj is what returns that object, traversing
the list as necessary to get to it.
XyzGetLppsAtPoint looks at the obj and decides if it is a shape,
if so adds its lpp to a hash table. A hash table used because there
might be more than one shape on the same lpp at the given point.
The hash table automatically maintains a unique list of keys.
hash->? returns the keys of the hash table which is just the list
of lpps.
It appears to be in recent IC5141 and IC5033 ISRs. It's not in IC5141 USR2 or
USR3 though; this suggests it was added fairly recently, as it must have missed
the code freeze for IC5141 USR3. I tested 5.10.41.500.2.29.
Regards,
Andrew.