Skip to content

create graphic line #1358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions _unittest/test_21_Circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,3 +448,7 @@ def test_35_netlist_data_block(self):
def test_36_create_voltage_probe(self):
myprobe = self.aedtapp.modeler.components.create_voltage_probe(probe_name="test_probe", location=[0.4, 0.2])
assert type(myprobe.id) is int

def test_37_draw_graphical_primitives(self):
line = self.aedtapp.modeler.components.create_line([[0, 0], [1, 1]])
assert line
26 changes: 26 additions & 0 deletions pyaedt/modeler/PrimitivesCircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,32 @@ def arg_with_dim(self, Value, sUnits=None):

return val

@pyaedt_function_handler()
def create_line(self, points_array, color=0, line_width=0):
"""Draw a graphical line.

Parameters
----------
points_array :
A nested list of point coordinates. For example,
``[[x1, y1], [x2, y2], ...]``.
color :
Color or the line. The default is ``0``.
line_width :
Width of the line. The default is ``0``.
Returns
-------

>>> oEditor.CreateLine
"""

pointlist = [str(tuple(i)) for i in points_array]
id = self.create_unique_id()
return self.oeditor.CreateLine(
["NAME:LineData", "Points:=", pointlist, "LineWidth:=", line_width, "Color:=", color, "Id:=", id],
["NAME:Attributes", "Page:=", 1],
)


class ComponentInfo(object):
"""Class that manage Circuit Catalog info."""
Expand Down