I am looking for a comand in skill to get the list of elements under a polygonal shape.
There is a command
here the output of this command is a list of elements. But this command only takes the input as a list of two points.
I want to give a list of more number of points as input to the code and the output it will return a list of elements under the polygon formed by the list of input points.
If anybody knows how to get it done please repply.
The only way to do this is to decompose the polygon into rectangles and run dbGetTrueOverlaps on each rectangle. If your polygons are not orthogonal, then you'll have to do some approximating. Cadence has a routine called dbLayerTile that will take an input shape and decompose it into trapezoids. If the original shape is orthogonal, then the results will be rectangles. The drawback to this routine is that it will actually create the trapezoids (or rectangles) in your layout where the source shapes are located. If you need to be able to work in a read-only mode, then you would have to mess around with a scratch cell to do your layer tiling. You alternative is to write your own polygon to trapezoid routine or find one out on the web.
In reply to dmay:
Derek is correct, using dbLayerTile will break an orthogonal polygon into rectangles which can then be fed to dbGetTrueOverlaps. The first argument for dbLayerTile is a cellView ID so you could open a scratch cellView using dbOpenCellViewByType in "s" mode (including IC6.1.3) and create the resulting rectangles there. dbLayerTile returns the dbId's for the rectangles so you could then process them from there. I often open a scratch cellView and keep it open just for this type of issue, sharing it among multiple programs.
In reply to Austin CAD Guy:
Thans a lot , it solved my problem.
But now I have one more issue that is when I am using " dbGetTrueOverlaps " command , if there is any Guardring or any multipartpath present inside that area, This command returns list of dbid of the multipartpath along with all the individual contacts and vias and layers.
I want dbID of the MultipartPath only.
And How to diferentiate a " Path " and a " Multipartpath " in the layout.
car(geGetSelSet()) ~>?? for both Path and Multipartpath gives the same kind of properties.
In reply to AmitBiswas:
One way that you could check is to see if rodGetObj() returns a rod object id or nil, if a rodObj:0x... is returned, then the path is possibly a multipart path. Then you could check the subShapes attribute of the rodObject to see if the path is indeed a multi-part path, or just a named rod path with no sub-parts. (Create->Multipart Path could create a rod path with no subparts, but then it is really just a rod-named path).
I hope that this answers your question, or at least helps you.
In reply to skillUser:
Thank you Lawrence, because of you only now I have a bug free code.
Really it reduced my lot of work. Now I hve one more doubt How to get the dbid of last placed object in the layout,
because I want to get the dbid of the polygon but hiCreatepolygon does not return any dbid.
Sounds like you want to use a combination of enterPolygon and dbCreatePolygon. The enterPolygon routine will allow you to define your own polygon creation interface. When it completes, you can use dbCreatePolygon to create the actual polygon and the return value of this routine is your dbId.
Acually I want to get the dbID of last placed object in the layout.I intentionally used lehiCreatePolygon command (whhich does not return any dbid).
I can not use dbcreatePolygon command because I want to create the polygon using human interface after that I will check the points of that polygon.
and in enterPolygon command also I need to give the list of points as an argument.
Thanks & Regards,
The points argument is not required. This simple example (similar to the one in the documentation for enterPolygon) will allow you to create a polygon interactively:
procedure(myPolygon() enterPolygon( ?prompts list("Point at the first point of the polygon:" "Point at the next point of the poygon") ?doneProc "myPolygonDp" ?cmdName "My Polygon" ))
procedure(myPolygonDp(w done pts) let((polyId) if( done then printf("Polygon entered was %L.\n" pts) polyId = dbCreatePolygon( w->editCellView leGetEntryLayer() pts) else println("Polygon entry aborted.") ) polyId ))
The "doneProc" automatically has three arguments supplied, the "w" is the window id, done is t/nil indicating whether the user completed the action or aborted (e.g. by pressing "Esc" during the enterFunction command), and points are the digitized points that the user supplied.
I'm not sure that it is safe to rely on the selection giving the most recently added shape first. However, it may just always work this way. A similar thing that you might be able to rely on more soundly is the cellview shapes attribute, for example:
cv = geGetEditCellView()
;; the following should give the most recent shape
;; the folowing should give the most recent polygon shape
car(setof(sh cv~>shapes sh~>objType=="polygon"))
Hope it helps.
The "doneProc" for enterPolygon automatically passes the windowId the points and a t/nil (done) to indicate if the routine was completed or not. Cadence provides hooks for doneProcs or callbacks to some of their interactive routines and these are usually passed a fixed set of arguments. The documentation should explain what these arguments are. If you are having trouble finding the doc (or are too lazy to look it up), you can use the following trick to find out how many arguments are needed and what type of arguments they are:
procedure(myPolygonDp(@optional a b c d) println(list(a b c d)))
This will take an optional number of arguments and default the rest to nil. It will then print out their values. In the preceding example, it would be easy to see that the windowId and points are passed to the routine. It would be less clear what the second argument (done) is since you would simply get a t. There is usually enough information for me to write the routine. The code given in the documentation is self-explanatory since it checks the value of done and draws a polygon in w using pts.
As for your second question, I have observed the same as you (the last object created appears first in the selectedSet for all objects). I do not know if this will work all the time. A safer approach could be to get a list of all objects in the cell. Call the leHiCreatePolygon code. Then get a new list of all the objects in the cell and identify which object is not in the original set.
cv = geGetEditCellView()polygons = setof(x cv~>shapes x~>objType=="polygon")leHiCreatePolygon()newPolygon = car(setof(x cv~>shapes x~>objType=="polygon" && !memq(x polygons)))
I have to agree with Derek, do not rely on the order of the data retrieved from the database. It is poor programming to rely on an undocumented order which may change depending on spaces in the virtual memory.
You can also use @rest to get all the arguments regardless of the number and then print them:
procedure(myPolygonDp2( @rest argList ) println( argList ))
The second argument is gets set to nil if you cancel the enterfunction so you can clean up your code, such as restoring data as it was before the command started.
- Derek - can you email me directly, I need to get some user input.
Why don't you make this a new topic as it it is different from what we dicussed in this topic and may be of interest to others who will be creating forms. Then I will be able to answer and get the widest audience.