Support Forum

Bulding of coding disc

SIDYA

Tuesday 30th June 2020
Attachments:
(only for registered users)

klayout editor.PNG

Hi all, I am a new member in this support forum and i think that i will gain a lot of knowledge with you. I have a question: i want build a coding disc with klayout editor but i don't know how can i do. It is small difficult for me. I am attaching an example of a coding disc that my coding disc should look like using the generator sequence next to it. I want to use the numbers on the left to build my coding disc. The grid numbers represent the black parts and the others the white parts. Thanks your for your replays Best regards Sidya
Jürgen
LayoutEditorFull
Tuesday 30th June 2020
Attachments:
(only for registered users)
 coding-disc.lec

coding-disc.png

To archive that you need to create a little macro. The macro may look like (for a coding disc with a random content): ```` #!/usr/bin/layout #name=Macro: coding disc #help=macro to create a coding disc void block(int start, int stop){ int rInner=14000; int rOuter=15000; double arcScale=0.0001; int layer=5; pointArray pa; pa.attach(rInner*math::sin(start*arcScale),rInner*math::cos(start*arcScale)); pa.attach(rOuter*math::sin(start*arcScale),rOuter*math::cos(start*arcScale)); pa.attach(rOuter*math::sin(stop*arcScale),rOuter*math::cos(stop*arcScale)); pa.attach(rInner*math::sin(stop*arcScale),rInner*math::cos(stop*arcScale)); pa.attach(rInner*math::sin(start*arcScale),rInner*math::cos(start*arcScale)); layout->drawing->currentCell->addPolygon(pa,layer); } int main(){ int pos=0; while (pos<62800) { int width=stdlib::rand()%100; block(pos,pos+width); pos+=width+stdlib::rand()%100; } layout->drawing->scaleFull(); } ```` ![coding-disc.png](/api/img.php?thread=20200630-3235&file=coding-disc.png)
SIDYA

Tuesday 30th June 2020
Jürgen, thanks you for your replay ! As you can see, I don't use random values but values that correspond to my research results. Can you explain your code a little bit please? I really need to understand this. Thank you in advance Jürgen Best regards, Sidya
SIDYA

Wednesday 1st July 2020
Hi Jürgen, can you reply my previous message please ? It is very important for me. Thanks, Sidya
Jürgen
LayoutEditorFull
Wednesday 1st July 2020
Requests from customers with commercial maintainance/support always have priority, so a reply to post in this forum to users without it, may take some time. To your question: The proc *block* will create a single block on the radius with start- and end- angle as parameter. The *block* proc is triggered with random values in the **for** loop. You just need to call it with the required values and adjust the constance in the *block* proc like inner- and outer- radius and layer.
SIDYA

Wednesday 1st July 2020
Okay thank you for your message but I have never used C ++ before that is why. Can you give me an example with these two positions: position 1: start- angle: 0° end angle: 0.75° radius: 6400µm position 2: start- angle: 1.5° end angle: 9.375° radius: 6400µm Thank you in advance Best regards
Jürgen
LayoutEditorFull
Wednesday 1st July 2020
You need to adjust three lines: ``` int rInner=6400000; // the inner radius in nm so for a inner radius of 6.4mm you need to set it to 6400000 int rOuter=6500000; // the outer radius for a width of 100µm you need to set it to rInner+100000 or 6500000 double arcScale=0.0001;// the arc scale, to get a resoliution of 0,01deg you need to set it to 2*pi/36000 ``` then you will get a block of 1,5deg to 9.37deg with a block(150,937);
SIDYA

Wednesday 1st July 2020
Okay thank you for your message but I have never used C ++ before that is why. Can you give me an example with these two positions: position 1: start- angle: 0° end angle: 0.75° radius: 6400µm position 2: start- angle: 1.5° end angle: 9.375° radius: 6400µm Thank you in advance Best regards
SIDYA

Wednesday 1st July 2020
Thanks you Jürgen, Here is my code, please, can you tell me how did you find block(150,937) ? and how can i build the next block ? #!/usr/bin/layout #name=Macro: coding disc #help=macro to create a coding disc void block(int start, int stop){ int rInner=590000; int rOuter=690000; double arcScale=0.0001; int layer=38; pointArray pa; pa.attach(rInner*math::sin(start*arcScale),rInner*math::cos(start*arcScale)); pa.attach(rOuter*math::sin(start*arcScale),rOuter*math::cos(start*arcScale)); pa.attach(rOuter*math::sin(stop*arcScale),rOuter*math::cos(stop*arcScale)); pa.attach(rInner*math::sin(stop*arcScale),rInner*math::cos(stop*arcScale)); //pa.attach(rInner*math::sin(start*arcScale),rInner*math::cos(start*arcScale)); layout->drawing->currentCell->addPolygon(pa,layer); } int main(){ //int pos=0; //for (pos=0; pos<=96000; pos++) { // int width=400; block(150.937); // pos+=width+200; //} layout->drawing->scaleFull(); } Thank you in advance Best regards
SIDYA

Wednesday 1st July 2020
Attachments:
(only for registered users)

code.PNG

Thanks you Jürgen, Here is my code, please, can you tell me how did you find block(150,937) ? and how can i build the next block ? #!/usr/bin/layout #name=Macro: coding disc #help=macro to create a coding disc void block(int start, int stop){ int rInner=590000; int rOuter=690000; double arcScale=0.0001; int layer=38; pointArray pa; pa.attach(rInner*math::sin(start*arcScale),rInner*math::cos(start*arcScale)); pa.attach(rOuter*math::sin(start*arcScale),rOuter*math::cos(start*arcScale)); pa.attach(rOuter*math::sin(stop*arcScale),rOuter*math::cos(stop*arcScale)); pa.attach(rInner*math::sin(stop*arcScale),rInner*math::cos(stop*arcScale)); //pa.attach(rInner*math::sin(start*arcScale),rInner*math::cos(start*arcScale)); layout->drawing->currentCell->addPolygon(pa,layer); } int main(){ //int pos=0; //for (pos=0; pos<=96000; pos++) { // int width=400; block(150.937); // pos+=width+200; //} layout->drawing->scaleFull(); } Thank you in advance Best regards
Jürgen
LayoutEditorFull
Wednesday 1st July 2020
You will need a block command for any block you need: ```` int main(){ block(150,937); block(1200,1567); block(1856,2356); //... list all blocks layout->drawing->scaleFull(); } ````
SIDYA

Wednesday 1st July 2020
Attachments:
(only for registered users)
 Doc1.pdf
Thanks you Jürgen but if I run the program, it doesn't display anything as you can see in the attachment. Do you know why it does that? Sidya
Jürgen
LayoutEditorFull
Wednesday 1st July 2020
remove line 28, there is one } to much, the final scaleFull will not be executed and you may not see the created design.
SIDYA

Wednesday 1st July 2020
Yes I have already resolved this problem but I don't understand how to calculate the numbers that are in the block. For example how we found block (150,937) ?
Jürgen
LayoutEditorFull
Wednesday 1st July 2020
with arcScale of 2*pi/36000 the values are in 0.01deg. So a block 150,937 is a arc from 1.5 deg to 9.37 deg.
SIDYA

Thursday 2nd July 2020
Okay thanks very much ! I will see that
SIDYA

Thursday 2nd July 2020
Hi Jürgen, i would like to know if it is possible to give coordinates to a rectangle (case) that we want to draw. For example i want draw a case at the following coordinates: x= 25.6mm y=15.5mm rotation angle: 165° I apologize for my level of English, I am not an English speaker !!! Thanks in advance
SIDYA

Friday 3rd July 2020
Attachments:
(only for registered users)
 Doc2.pdf
Hi Jürgen, it's okay, I solved the problem of the previous message. I would now like to know if it is possible to replace the polygon with an arc of a circle. I tried but it didn't work.
Jürgen
LayoutEditorFull
Friday 3rd July 2020
Of course that is possible. You need to call the polygonArc method instead of the polygon method. That method will need some other parameters. The description is in the manual: https://layouteditor.org/layoutscript/api/cell#16
SIDYA

Saturday 4th July 2020
Attachments:
(only for registered users)

doc.PNG

I tried several times but it didn't work. can you help me please ?
Jürgen
LayoutEditorFull
Saturday 4th July 2020
The required parameter of an polygon-arc are: point center -> center of the arc int radiusInner -> inner radius int radiusOuter,-> outer radius double angleStart -> angle where the arc starts double angleStop- angle where the arc stops int layer -> layer
SIDYA

Saturday 4th July 2020
Attachments:
(only for registered users)

doc.PNG

I have tried several methods but it does not work. Is there a problem with line 10 ?
SIDYA

Sunday 5th July 2020
Attachments:
(only for registered users)

doc.PNG

I changed my code several times but it couldn't work. Can you check if there is a problem with the first 17 lines of the code please ?
SIDYA

Sunday 5th July 2020
Attachments:
(only for registered users)

doc.PNG

this is another code i wrote but it doesn't work...
Jürgen
LayoutEditorFull
Monday 6th July 2020
To use arc as block segments the macro may look like: ```` #!/usr/bin/layout #name=Macro: coding disc #help=macro to create a coding disc void block(int start, int stop){ int rInner=14000; int rOuter=15000; double arcScale=0.0001; int layer=5; point center; center.set(1000,4000); layout->drawing->currentCell->addPolygonArc(center,rInner,rOuter,start/100,stop/100,layer); } int main(){ int pos=0; block(0,100); block(200,500); block(1000,9000); block(10000,35000); layout->drawing->scaleFull(); } ```
SIDYA

Monday 6th July 2020
Ok thank you very much !