I have a master layout and with various levels of heirarchy. My aim is to find and draw boxes around shapes belonging to a particular layer.
The problem comes in when I come across an instance which is a pcell while I am traversing through the hierarchy.
If I try to openthe instance using dbOpenCellViewByType(), it obviously opens with the default parameters and the purpose is lost.
I intend to do some processing on pcell layout with the instantiated parameters "without flatenning" the layout.
If you have the instance id while traversing the hierarchy, then you can access the pcell submaster using:
Any shapes you find in this master will need to be transformed to the current level of hierarchy. If shpId is the id of a shape in the master, you can do this:
ll = dbTransformPoint(car(shpId~>bBox) inst~>transform)ur = dbTransformPoint(cadr(shpId~>bBox) inst~>transform)newBox = list(ll ur)ornewBox = mapcar('(lambda (x) dbTransformPoint(x inst~>transform)) shpId~>bBox)
You can not open the pcell, add the new shape and then to save it.
You have to create a new inst eventaually withthe parameters changed.
E.g. the code bellow will create a new pcell of tipe libname/cellname/layout on the x:y coordinates, no rotation withparamaters W and L
masterId = dbOpenCellViewByType("libname" "cellName" "layout"); isntId = dbCreateParamInst( cv() masterId "my_inst_name" list(x y) "R0" list( list("W" "float" 0.5) list("L" "float" 0.6)))
Have a look on dbCreateParamInst()
Eventually you can try dbCreateParamInstByMasterName("libname" "cellName" "layout" ...)
Do you intend that the new shape be put at the top level of the hierarchy?
Pcell instances create a virtual memory master that reflects the results of the execution of the pcell code based on the parameter values. For each set of parameter values, there is one instance master (instHeader). An instHeader may point to multiple masters.
You should not modify the VM instance master of the pcell. It can corrupt the VM master as well as the cached master.
Like Derek said, you would have to find the shape in the master and then draw a shape at the top level for each instance using that instance's transform. (I would use dbTransformBBox but I'm lazy)
For shapes nested in deeper levels of hierarchy, you would need to find the instance path and concat the transforms. See dbGetTrueOverlaps and dbConcatTransform for more information on this.
In reply to theopaone:
Thanks for all the repliesinst~>master is what i was looking for....obviously some transformations has to be done before puting a rect around BBox of a shape
Will figure it out using your replies earlier.
Thanks for all the pointers