It looks like you're new here. If you want to get involved, click one of these buttons!
I'm experimenting with guide shapes, which is a very nice feature! I would like to make a PCell that draws some geometry along a path, which can be edited by the user. It seems making a DPath as guide shape is the natural way to implement this, and I did some tests and it indeed works great.
However, I ran into one issue: the Partial tool automatically "simplifies" the path when it is edited; in particular if three or more neighboring points are on a line, it removes the middle points. This is sensible behavior for simple paths, indeed the path is the same after simplification, but for my guide path it poses a problem because my PCell will actually have some extra geometry at the points of the path, even if they are all on a line.
Here is a screen capture to show the example. As minimal example, I made a PCell that has only a DPath parameter and no actual geometry. At the start the path is initialized to 4 points, all on a line. When editing the shape with the Partial tool, one of the points disappears due to simplification.
So I have the following questions:
Thanks!
Here is the ruby code for the example PCell, which is based on the example in the PCell documentation:
module MyLib
include RBA
# Remove any definition of our classes (this helps when
# reexecuting this code after a change has been applied)
MyLib.constants.member?(:PathTest) && remove_const(:PathTest)
MyLib.constants.member?(:MyLib) && remove_const(:MyLib)
# The PCell declaration for the circle
class PathTest < PCellDeclarationHelper
include RBA
def initialize
super
# declare DPath parameter
param(:s, TypeShape, "", :default => DPath::new([DPoint::new(0, 0), DPoint::new(100, 0), DPoint::new(200, 0), DPoint::new(300, 0)], 1))
end
def coerce_parameters_impl
end
def produce_impl
# Actual geometry implementaiton...
end
end
class MyLib < Library
def initialize
self.description = "Test Library"
layout.register_pcell("PathTest", PathTest::new)
register("MyLib")
end
end
MyLib::new
end
Comments
@Caspar_IQM I understand. I think this behaviour can be disabled, but only by enhancement of the core system. It's a side effect of the path constructor. I'd not say that is an intended feature. I have created a ticket to change this: https://github.com/KLayout/klayout/issues/1008
I recall I have fixed something similar for polygons, but not for paths.
Matthias
Great, thanks for the support!