Skip to content

Added boolean option to create_polyline to create as non model #896

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
Feb 25, 2022
Merged
Show file tree
Hide file tree
Changes from all 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_08_Primitives3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ def test_19_create_polyline(self):
assert isinstance(P.color, tuple)
get_P = self.aedtapp.modeler["Poly1"]
assert isinstance(get_P, Polyline)
P2 = self.aedtapp.modeler.create_polyline(
arrofpos, cover_surface=False, name="Poly_nonmodel", matname="Copper", non_model=True
)
assert P2.model == False

@pyaedt_unittest_check_desktop_error
def test_20_create_polyline_with_crosssection(self):
Expand Down
Binary file added doc/source/Resources/merge_utility.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 12 additions & 4 deletions pyaedt/modeler/Primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ def __init__(
xsection_height=1,
xsection_num_seg=0,
xsection_bend_type=None,
non_model=False,
):

self._primitives = primitives
Expand Down Expand Up @@ -210,8 +211,11 @@ def __init__(
self._segment_types = segment_type

varg1 = self._point_segment_string_array()

varg2 = self._primitives._default_object_attributes(name=name, matname=matname)
if non_model:
flag = "NonModel#"
else:
flag = ""
varg2 = self._primitives._default_object_attributes(name=name, matname=matname, flags=flag)

new_object_name = _retry_ntimes(10, self.m_Editor.CreatePolyline, varg1, varg2)

Expand Down Expand Up @@ -1328,6 +1332,7 @@ def create_polyline(
xsection_height=1,
xsection_num_seg=0,
xsection_bend_type=None,
non_model=False,
):
"""Draw a polyline object in the 3D modeler.

Expand Down Expand Up @@ -1392,6 +1397,8 @@ def create_polyline(
``None``, in which case the bend type is set to
``"Corner"``. For the type ``"Circle"``, the bend type
should be set to ``"Curved"``.
non_model : bool, optional
Either if the polyline will be created as model or unmodel object.

Returns
-------
Expand Down Expand Up @@ -1477,6 +1484,7 @@ def create_polyline(
xsection_height=xsection_height,
xsection_num_seg=xsection_num_seg,
xsection_bend_type=xsection_bend_type,
non_model=non_model,
)
return new_polyline

Expand Down Expand Up @@ -3293,7 +3301,7 @@ def _refresh_all_ids_from_aedt_file(self):
o._is_updated = True
return len(self.objects)

def _default_object_attributes(self, name=None, matname=None):
def _default_object_attributes(self, name=None, matname=None, flags=""):

if not matname:
matname = self.defaultmaterial
Expand All @@ -3319,7 +3327,7 @@ def _default_object_attributes(self, name=None, matname=None):
"Name:=",
name,
"Flags:=",
"",
flags,
"Color:=",
color,
"Transparency:=",
Expand Down