StefanSchippers / xschem

A schematic editor for VLSI/Asic/Analog custom designs, netlist backends for VHDL, Spice and Verilog. The tool is focused on hierarchy and parametric designs, to maximize circuit reuse.
Other
297 stars 21 forks source link

Extended draw shapes capabilities #177

Closed georgtree closed 3 months ago

georgtree commented 4 months ago

Hello! It would be great to see the ability to draw more complex shapes - ellipse, Bézier curve, etc. These shapes will greatly simplify component symbols creation, currently I can only approximate it with segmented line. Also would be great to add scaling ability for already placed shapes.

Thank you in advance, George.

StefanSchippers commented 4 months ago

I have added a first implementation of bezier curves. They are essentially a variation built on top of the polygon shape. Draw a multipoint polygon (key=p) (npoints >= 3) , set attribute bezier=1 on this shape, it will transform into a composite quadratic bezier spline. I have done tests with quadratic and cubic bezier splines. Quadratic beziers seem more useful, since they can be bent more easily than higher order polynomial curves. I have to improve the UI for easier selecting and moving the control points, but it is already useable. You can also transform a closed polygon into a bezier and in this case it can be filled (by adding attribute fill=1).

Attached the example schematic. Please do a test. 1 test_bezier.zip

georgtree commented 4 months ago

Wow, that was really fast, I tested it and all works great, thank you! I will play with it a little bit more!

P.S and have proper ellipsis will be super cool, because it is a main element to create symbols that are circles in direct view but became ellipsis under angled perspective of view

StefanSchippers commented 4 months ago

Thank you for testing. I was a bit scared by the math, but turned out to be simpler than I thought.

For the ellipse I will look at it. One important question is if you need X/Y oriented ellipses or any angle.

In the mean time I see beziers approximate ellipses quite well. Just start at the correct point as shown. 1

georgtree commented 4 months ago

Hello, I need XY only for drawing pretty-looking symbols

StefanSchippers commented 4 months ago

I have improved a bit the bezier editing. If you select one you can click and drag directly the control points. This applies also for normal polygons. Please test. Thanks!

Last thing I need to improve a bit is selection. Now selecting a bezier works well if you click one of the endpoints or close to a control point. I need to let user select the curve also by clicking any location close to the bezier line.

1

georgtree commented 4 months ago

Hello, thank you, it is very convenient and works as expected!

georgtree commented 3 months ago

Hello! Sorry for asking, but do you have any thoughts about the time the ellipsis will be available to draw? I am not pushing you just ask because I have a lot of symbols to modify and want to understand if it is worth to wait for proper ellipsis implementation instead of bezier approximation... Thank you in advance!

georgtree commented 3 months ago

Hello, all works great, thank you! image

georgtree commented 3 months ago

Hello, find the issue - when component is flipped or rotated, I get this behaviour: image image Looks like the issue is in absolute definition of angles...

StefanSchippers commented 3 months ago

Yes this will be fixed soon. Thanks

georgtree commented 3 months ago

Hello, I tried with last commit, it works with ellipse that I place onto schematic, but if I generate symbol from tcl script, the problem is the same. image image

StefanSchippers commented 3 months ago

Yes, bare ellipses are fixed now. Next commit will address symbols with ellipses.

StefanSchippers commented 3 months ago

Last commit hopefully does correct transformations for ellipses inside symbols. Please test. Thank you for the feedback.

georgtree commented 3 months ago

Hello! Just tested, all works fine, thank you :)