It looks like you're new here. If you want to get involved, click one of these buttons!
Hi
I am using Python scrfipting in marco develpoment to draw patterns. I need to make a ''customized eraser". So I tried the 'erase' function. But it seems like it can only delete an existing obiect that is inserted.
And when I tried a cuntomized shape like:
erase(pya.Box(x1, y1, x1+length, y1+width1)) it gives that: 'erase' is not defined
when I tried:
cell.shapes(layer).erase(pya.Box(x1, y1, x1+length, y1+width1)) it gives: unexpected object type.
It only works when I tried:
cell.shapes(layer).erase(cell.shapes(layer).insert(pya.Box(x1, y1, x1+length, y1+width1)))
But this does not help, because I need to clear everything which is surrounded by a customized shape.
So how to make a general customized eraser or is there any other function to realize my purpose?
Comments
It is beacuse my pattern has a background, I need to clear some certain parts in order to fit my structure in it. And it dose not help to just erase the background by hand in Editor mode.
Hi,
I think you misunderstood the meaning of "erase": it will take out a specific object from the object collection, not void the area under the shape.
What you need is a "boolean NOT" operation. Or you need a selective delete. "NOT" is available within the DRC framework, but it will not preserve the hierarchy not labels of the original layer. A selective delete is a difficult operation if hierarchy is involved and shapes need to be deleted from subcells.
I can't give advise without knowing more about the application you're planning.
Matthias
Hi Matthias
This is my script. I have made the certain shape for the 'eraser' and the background. What I need to do is something like from image 1 to image 2.
I think it is really difficult to use the 'boolean' operator for my case. It can be much easier if there is a function to customize the shape of 'erase' in Editor mode.
script
Thank you
Hi,
Please format your code using Markdown formatting - put a line with a triple backtick before and after the code. The above form is not quite readable.
I think boolean operations are basically the easiest way to implement your request. Your script is already producing a layout with the "erase" layer.
You can then use a DRC script like this:
If you care to write your script in Ruby you can basically integrate the eraser generation into the DRC script and skip the intermediate file step.
Matthias
Hi Matthias,
I finally find the function 'Region'. Just use
pya.Region(A)-pya.Region(B)
, then it gives what I need. And this is what so called 'boolean'. Because I am a noob of coding, it really took me a while to understand how it goes.Anyway, thank you for being so helpful.
Zhan
Hi Zhan,
very good ... that is actually even better. I did not dare to propose this, but this will allow you to implement the feature in a single piece of code.
"Regions" are basically what is a "layer" on the canvas. The region object allows manipulating and analysing layers in manifold ways. It's a very mighty concept.
I just would like to point out this:
Regards,
Matthias