Skill program

  • Thread starter sridhartv25@gmail.com
  • Start date
S

sridhartv25@gmail.com

Guest
Hello all,

Can anyone share a skill program to create labels in the layout(on the
instances) corresponding to the instance name in the schematic.
Using vituso xl we can generate a layout with instances from the
schematic itself, Now I want to place the text labels on the instances
in the layout corresponding to the instance name in the schematic.
Eagerly waiting for the replies,

Cheers,
Sridhar.
 
sridhartv25@gmail.com wrote, on 12/23/08 08:35:
Hello all,

Can anyone share a skill program to create labels in the layout(on the
instances) corresponding to the instance name in the schematic.
Using vituso xl we can generate a layout with instances from the
schematic itself, Now I want to place the text labels on the instances
in the layout corresponding to the instance name in the schematic.
Eagerly waiting for the replies,

Cheers,
Sridhar.

procedure(MYaddInstLabels(@key (cv geGetEditCellView()) (layerName
"text") (height 1.0) (orient "R0") (justification "centerCenter") (font
"stick"))
foreach(inst cv~>instances
dbCreateLabel(cv layerName inst~>xy inst~>name justification orient
font height)
)
t
)

Andrew.
 
Thanks andrew,
Really it looks so simple.
I had modifed your script, so that it places the label at the centre
of the insatnce.
One more thing is that I am trying to attach this label to the
instance but its not working,
Can u help me in this aspect.
 
sridhartv25@gmail.com wrote, on 12/31/08 08:03:
Thanks andrew,
Really it looks so simple.
I had modifed your script, so that it places the label at the centre
of the insatnce.
One more thing is that I am trying to attach this label to the
instance but its not working,
Can u help me in this aspect.
You can use leAttachFig() for this - see the documentation for more details.

Andrew.
 
On Dec 31 2008, 2:36 pm, Andrew Beckett
<andr...@DcEaLdEeTnEcTe.HcIoSm> wrote:
sridhart...@gmail.com wrote, on 12/31/08 08:03:

Thanks andrew,
Really it looks so simple.
I had modifed your script, so that it places the label at the centre
of the insatnce.
One more thing is that I am trying to attach this label to the
instance but its not working,
Can u help me in this aspect.

You can use leAttachFig() for this - see the documentation for more details.

Andrew.
Hello Andrew , yes I tried using the command leAttachFig() , but how
can I find the database Id of the label and also the datbase id of
instance.
Thanks in advance,
Wishing you a Happy New Year.

Cheers,
Sridhar.
 
On Jan 1, 10:39 am, "sridhart...@gmail.com" <sridhart...@gmail.com>
wrote:
On Dec 31 2008, 2:36 pm, Andrew Beckett

andr...@DcEaLdEeTnEcTe.HcIoSm> wrote:
sridhart...@gmail.com wrote, on 12/31/08 08:03:

Thanks andrew,
Really it looks so simple.
I had modifed your script, so that it places the label at the centre
of the insatnce.
One more thing is that I am trying to attach this label to the
instance but its not working,
Can u help me in this aspect.

You can use leAttachFig() for this - see the documentation for more details.

Andrew.

Hello Andrew , yes I tried using the command leAttachFig() , but how
can I find the database Id of the label and also the datbase id of
instance.
Thanks in advance,
Wishing you a Happy New Year.

Cheers,
Sridhar.
Andrew I got the database id of instance by using the command
dbFindAnyInstByName( ).
But how to find out the dbid of label.
However foreach(inst cv~>instances , here inst is the dbid of
insatnce so I donot to use the command dbFindAnyInstByName( ).

Cheers,
Sridhar.
 
On Jan 1, 11:27 am, "sridhart...@gmail.com" <sridhart...@gmail.com>
wrote:
On Jan 1, 10:39 am, "sridhart...@gmail.com" <sridhart...@gmail.com
wrote:

On Dec 31 2008, 2:36 pm, Andrew Beckett

andr...@DcEaLdEeTnEcTe.HcIoSm> wrote:
sridhart...@gmail.com wrote, on 12/31/08 08:03:

Thanks andrew,
Really it looks so simple.
I had modifed your script, so that it places the label at the centre
of the insatnce.
One more thing is that I am trying to attach this label to the
instance but its not working,
Can u help me in this aspect.

You can use leAttachFig() for this - see the documentation for more details.

Andrew.

Hello Andrew , yes I tried using the command leAttachFig() , but how
can I find the database Id of the label and also the datbase id of
instance.
Thanks in advance,
Wishing you a Happy New Year.

Cheers,
Sridhar.

Andrew I got the database id of instance by using the command
dbFindAnyInstByName( ).
But how to find out the dbid of label.
However foreach(inst cv~>instances , here inst is the dbid of
insatnce so I donot to use the command dbFindAnyInstByName( ).

Cheers,
Sridhar.



Ahh I got it Andrew , at first I didnot check the return value of
command dbCreateLabel , later I found its the dbid of label ok.

But still is there is any other simple way by which we can find the
database id of labels instances.

Cheers,
Sridhar
 
sridhartv25@gmail.com wrote, on 01/01/09 06:54:
Hello Andrew , yes I tried using the command leAttachFig() , but how
can I find the database Id of the label and also the datbase id of
instance.
Thanks in advance,
Wishing you a Happy New Year.
Cheers,
Sridhar.
Andrew I got the database id of instance by using the command
dbFindAnyInstByName( ).
But how to find out the dbid of label.
However foreach(inst cv~>instances , here inst is the dbid of
insatnce so I donot to use the command dbFindAnyInstByName( ).

Cheers,
Sridhar.


Ahh I got it Andrew , at first I didnot check the return value of
command dbCreateLabel , later I found its the dbid of label ok.

But still is there is any other simple way by which we can find the
database id of labels instances.

Cheers,
Sridhar
I was about to say that you should use the return value of the function you used
to create the label - and you already had the instance id as part of the
previous code...

If you want to find all the labels with a particular string, you can do:

procedure(abFindLabelByLabel(cv theLabel)
setof(shape cv~>shapes shape~>objType=="label" && shape~>theLabel==theLabel)
)

This function will return a list of label objects which have the text of the
label matching the argument passed in.

There's no builtin function to do this directly (because it wouldn't be used
very often - whereas you're always wanting to find instances/nets/terminals by
name - plus the fact that an instance/net/terminal name must be unique, whereas
label text doesn't have to be).

Regards,

Andrew.
 
On Jan 1, 12:54 am, "sridhart...@gmail.com" <sridhart...@gmail.com>
wrote:
On Jan 1, 11:27 am, "sridhart...@gmail.com" <sridhart...@gmail.com
wrote:





On Jan 1, 10:39 am, "sridhart...@gmail.com" <sridhart...@gmail.com
wrote:

On Dec 31 2008, 2:36 pm, Andrew Beckett

andr...@DcEaLdEeTnEcTe.HcIoSm> wrote:
sridhart...@gmail.com wrote, on 12/31/08 08:03:

Thanks andrew,
Really it looks so simple.
I had modifed your script, so that it places the label at the centre
of the insatnce.
One more thing is that I am trying to attach this label to the
instance but its not working,
Can u help me in this aspect.

You can use leAttachFig() for this - see the documentation for more details.

Andrew.

Hello Andrew , yes I tried using the command leAttachFig() , but how
can I find the database Id of the label and also the datbase id of
instance.
Thanks in advance,
Wishing you a Happy New Year.

Cheers,
Sridhar.

Andrew I got the database id of instance by using the command
dbFindAnyInstByName( ).
But how to find out the dbid of label.
However  foreach(inst cv~>instances  , here inst is the dbid of
insatnce so I donot to use the command dbFindAnyInstByName( ).

Cheers,
Sridhar.

Ahh I got it Andrew , at first I didnot check the return value of
command dbCreateLabel , later I found its the dbid of label ok.

But still is there is any other simple way by which we can find the
database id of labels instances.

Cheers,
Sridhar- Hide quoted text -

- Show quoted text -
Hi,
I am really interested in your code and usage. Do you mind posting
the finished code in its entirety.
Sounds fascinating :)
Thank you,
Eric
 
Why not ...
This is the code of Andrew , I had just modified to move the label at
the centre of the instance and attach it to the instance,


Skill starts here (Learned from Riad Kaced)

procedure(AddInstLabel(@key (cv geGetEditCellView()) (layerName
"text") (height 1.0) (orient "R0") (justification "centerCenter")
(font
"roman"))
foreach(inst cv~>instances
;leAttachFig(inst~>name inst)
;leAttachFig(deGetCellView(inst~>name) inst)

q = leftEdge(inst)
w = rightEdge(inst)
e = topEdge(inst)
r = bottomEdge(inst)
x = (q+w)/2
y = (e+r)/2
h=dbCreateLabel(cv layerName x:y inst~>name justification orient
font height)
;leAttachFig(h inst) ;can also go with this for attaching
leAttachFig(h dbFindAnyInstByName( cv inst~>name))
;dbFindAnyInstByName( cv "inst~>name")
)
t
)
AddInstLabel()



;Usage Just copy the code in to the icfb You will get the result.


;Andrew , can you suggest suggest some thingelse to make the code
still better.
 
Hi Sridhar,

You skill code looks very fair. You could enhance by:
1. working with local variables, using let (avoid prog as much as
possible).
2. dbFindAnyInstByName is redundant since you have already the db
object of your instance, i.e inst.

Besides, You could use Skill Lint to analyze your code.

Regards,
Riad.
 
You skill code looks very fair. You could enhance by:
1. working with local variables, using let (avoid prog as much as
possible).
2. dbFindAnyInstByName is redundant since you have already the db
object of your instance, i.e inst.
Agree with Riad. To be even a little more picky, I'd say that the function returning
a fixed value (t) is not very instructive. I understand it was in the original code given
by Andrew, and it was supposed to be a quick one-liner, but since you ask for comments
here goes...

What should it return, you might ask ? Anything that's likely to be useful for who's
calling the function. In this case I'd suggest returning a list containing the dbIds
of the newly created labels.

Merging also Riad's comments, that would give the code below. The foreach(mapcar loop
builds a list with all the return values of the code body, which is the dbId of the
label at each iteration. The let() makes variables local.

Cheers,
Stéphane

procedure(AddInstLabel(@key (cv geGetEditCellView()) (layerName "text") (height 1.0) (orient "R0")
(justification "centerCenter") (font "roman"))
let( (label)
foreach(mapcar inst cv~>instances
label=dbCreateLabel(
cv
layerName
list((leftEdge(inst)+rightEdge(inst))/2 (topEdge(inst)+bottomEdge(inst))/2)
inst~>name
justification
orient
font
height
) ; dbCreateLabel
leAttachFig(label inst)
label
) ; foreach
) ; let
) ; procedure
 
On Jan 19, 4:05 am, "S. Badel" <stephane.ba...@REMOVETHISepfl.ch>
wrote:
You skill code looks very fair. You could enhance by:
1. working with local variables, using let (avoid prog as much as
possible).
2. dbFindAnyInstByName is redundant since you have already the db
object of your instance, i.e inst.

Agree with Riad. To be even a little more picky, I'd say that the function returning
a fixed value (t) is not very instructive. I understand it was in the original code given
by Andrew, and it was supposed to be a quick one-liner, but since you ask for comments
here goes...

What should it return, you might ask ? Anything that's likely to be useful for who's
calling the function. In this case I'd suggest returning a list containing the dbIds
of the newly created labels.

Merging also Riad's comments, that would give the code below. The foreach(mapcar loop
builds a list with all the return values of the code body, which is the dbId of the
label at each iteration. The let() makes variables local.

Cheers,
Stéphane

procedure(AddInstLabel(@key (cv geGetEditCellView()) (layerName "text") (height 1.0) (orient "R0")
(justification "centerCenter") (font "roman"))
let( (label)
  foreach(mapcar inst cv~>instances
   label=dbCreateLabel(
    cv
    layerName
    list((leftEdge(inst)+rightEdge(inst))/2 (topEdge(inst)+bottomEdge(inst))/2)
    inst~>name
    justification
    orient
    font
    height
   ) ; dbCreateLabel
   leAttachFig(label inst)
   label
  ) ; foreach
) ; let
) ; procedure
That does what I need, except I need it to not label the Vias
How would I do that?

Thanks!
Eric
 
eric.d.fitzsimmons@gmail.com wrote, on 01/19/09 21:53:
On Jan 19, 4:05 am, "S. Badel" <stephane.ba...@REMOVETHISepfl.ch
wrote:
You skill code looks very fair. You could enhance by:
1. working with local variables, using let (avoid prog as much as
possible).
2. dbFindAnyInstByName is redundant since you have already the db
object of your instance, i.e inst.
Agree with Riad. To be even a little more picky, I'd say that the function returning
a fixed value (t) is not very instructive. I understand it was in the original code given
by Andrew, and it was supposed to be a quick one-liner, but since you ask for comments
here goes...

What should it return, you might ask ? Anything that's likely to be useful for who's
calling the function. In this case I'd suggest returning a list containing the dbIds
of the newly created labels.

Merging also Riad's comments, that would give the code below. The foreach(mapcar loop
builds a list with all the return values of the code body, which is the dbId of the
label at each iteration. The let() makes variables local.

Cheers,
Stéphane

procedure(AddInstLabel(@key (cv geGetEditCellView()) (layerName "text") (height 1.0) (orient "R0")
(justification "centerCenter") (font "roman"))
let( (label)
foreach(mapcar inst cv~>instances
label=dbCreateLabel(
cv
layerName
list((leftEdge(inst)+rightEdge(inst))/2 (topEdge(inst)+bottomEdge(inst))/2)
inst~>name
justification
orient
font
height
) ; dbCreateLabel
leAttachFig(label inst)
label
) ; foreach
) ; let
) ; procedure

That does what I need, except I need it to not label the Vias
How would I do that?

Thanks!
Eric
Inside the foreach, put:

unless(leIsContact(inst)
label=dbCreateLabel(
..
leAttachFig(...)
label
)

The leIsContact() function will tell you whether an instance is a via or not. In
IC61 this isn't necessary because vias are not instances (you get to them using
cv~>vias).

Regards,

Andrew.

--
Andrew Beckett
Senior Solution Architect - Cadence Design Systems Ltd (UK)
 
On Jan 20, 3:50 am, Andrew Beckett <andr...@DcEaLdEeTnEcTe.HcIoSm>
wrote:
eric.d.fitzsimm...@gmail.com wrote, on 01/19/09 21:53:





On Jan 19, 4:05 am, "S. Badel" <stephane.ba...@REMOVETHISepfl.ch
wrote:
You skill code looks very fair. You could enhance by:
1. working with local variables, using let (avoid prog as much as
possible).
2. dbFindAnyInstByName is redundant since you have already the db
object of your instance, i.e inst.
Agree with Riad. To be even a little more picky, I'd say that the function returning
a fixed value (t) is not very instructive. I understand it was in the original code given
by Andrew, and it was supposed to be a quick one-liner, but since you ask for comments
here goes...

What should it return, you might ask ? Anything that's likely to be useful for who's
calling the function. In this case I'd suggest returning a list containing the dbIds
of the newly created labels.

Merging also Riad's comments, that would give the code below. The foreach(mapcar loop
builds a list with all the return values of the code body, which is the dbId of the
label at each iteration. The let() makes variables local.

Cheers,
Stéphane

procedure(AddInstLabel(@key (cv geGetEditCellView()) (layerName "text") (height 1.0) (orient "R0")
(justification "centerCenter") (font "roman"))
let( (label)
  foreach(mapcar inst cv~>instances
   label=dbCreateLabel(
    cv
    layerName
    list((leftEdge(inst)+rightEdge(inst))/2 (topEdge(inst)+bottomEdge(inst))/2)
    inst~>name
    justification
    orient
    font
    height
   ) ; dbCreateLabel
   leAttachFig(label inst)
   label
  ) ; foreach
) ; let
) ; procedure

That does what I need, except I need it to not label the Vias
How would I do that?

Thanks!
Eric

Inside the foreach, put:

unless(leIsContact(inst)
   label=dbCreateLabel(
   ..
   leAttachFig(...)
   label
)

The leIsContact() function will tell you whether an instance is a via or not. In
IC61 this isn't necessary because vias are not instances (you get to them using
cv~>vias).

Regards,

Andrew.

--
Andrew Beckett
Senior Solution Architect - Cadence Design Systems Ltd (UK)- Hide quoted text -

- Show quoted text -
The code below will omit the vias being labeled if not on IC61. I
did change the orient and font.

Thanks again Andrew,
Eric


procedure(AddInstLabel(@key (cv geGetEditCellView()) (layerName
"text") (height 1.0) (orient "MXR90")
(justification "centerCenter") (font "stick"))
let( (label)
foreach(mapcar inst cv~>instances
unless(leIsContact(inst)
label=dbCreateLabel(
cv
layerName
list((leftEdge(inst)+rightEdge(inst))/2 (topEdge(inst)+bottomEdge
(inst))/2)
inst~>name
justification
orient
font
height
) ; dbCreateLabel
leAttachFig(label inst)
label
) ; leIsContact
) ; foreach
) ; let
) ; procedure
AddInstLabel()
 
sridhartv25@gmail.com wrote:
Hello all,

Can anyone share a skill program to create labels in the layout(on the
instances) corresponding to the instance name in the schematic.
Using vituso xl we can generate a layout with instances from the
schematic itself, Now I want to place the text labels on the instances
in the layout corresponding to the instance name in the schematic.
Eagerly waiting for the replies,

Cheers,
Sridhar.
The demo version of LinuxCAD was addedd to

www.LinuxCAD.com

it is at the very bottom of the front page it says:


"download demo"
 

Welcome to EDABoard.com

Sponsor

Back
Top