ansys / pyprimemesh

Pythonic Meshing Client for Ansys Prime Server
https://prime.docs.pyansys.com/
MIT License
20 stars 9 forks source link

Bug located in Scope Volume Zone for display #425

Open agvarghe opened 1 year ago

agvarghe commented 1 year ago

🔍 Before submitting the issue

🐞 Description of the bug

When trying to display mesh by defining scope to Volume Zone the display shows empty . i have executed the following commands

#display for volume in part.get_volume_zones(): display(scope=prime.ScopeDefinition(model,entity_type=prime.ScopeEntity.VOLUME,evaluation_type=prime.ScopeEvaluationType.ZONES, zone_expression=model.get_zone_name(volume)+"*" ))

Can you look into this

📝 Steps to reproduce

` import os import time from ansys.meshing import prime from ansys.meshing.prime.graphics import Graphics from ansys.meshing.prime import lucid

input Files

workindDirectory="E:\PyPrimeMesh\Scripts" cadFileName="two_box.scdoc" export_file = os.path.join(workindDirectory,'exported_cdb.cdb')

with prime.launch_prime(timeout= 30 ) as client: model=client.model meshUtil=lucid.Mesh(model) startTime=time.time()

#CAD Import
fileIO=prime.FileIO(model)
fileIO.import_cad(os.path.join(workindDirectory,cadFileName),
                params=prime.ImportCadParams(model=model,
                                            part_creation_type=prime.PartCreationType.BODY,
                                            cad_reader_route=prime.CadReaderRoute.PROGRAMCONTROLLED,
                                            length_unit=prime.LengthUnit.MM))
stopTime=time.time()
print(stopTime-startTime)

#Draw Model
display=Graphics(model)
#display()

#Generate Surface Mesh
meshUtil.surface_mesh(min_size=0.5, max_size=4)
#display()

#Compute Regions
for part in model.parts:
    part.compute_topo_volumes(params=prime.ComputeVolumesParams(model,
                                                            create_zones_type=prime.CreateVolumeZonesType.PERVOLUME))

    part.delete_topo_entities(params=prime.DeleteTopoEntitiesParams(model,
                                                                            delete_geom_zonelets=True))

    print(len(part.get_volumes()))
    for zone in part.get_volume_zones():
        print("Volume Zone Name : ", model.get_zone_name(zone))

    #Generate Volume
    meshUtil.volume_mesh(volume_fill_type=prime.VolumeFillType.TET)

    #display
    for volume in part.get_volume_zones():
        display(scope=prime.ScopeDefinition(model,entity_type=prime.ScopeEntity.VOLUME,evaluation_type=prime.ScopeEvaluationType.ZONES,
                                        zone_expression=model.get_zone_name(volume)+"*"
                                        ))

    #Part Summary
    summary=part.get_summary(params=prime.PartSummaryParams(model))
    print("Total number of cell zones," , summary.n_cell_zonelets)
    print("Total cell count," , summary.n_cells)
    print("Total number of tet cells,", summary.n_tet_cells)
    print("Total number of tri faces,", summary.n_tri_faces)

    #Write pmdat
    meshUtil.write(os.path.join(workindDirectory,"2box.pmdat"))

`

💻 Which operating system are you using?

Windows

📀 Which ANSYS version are you using?

2023R1

🐍 Which Python version are you using?

3.8

📦 Installed packages

------------------------ ---------
aiohttp                  3.8.4
aiosignal                1.3.1
ansys-api-meshing-prime  0.1.1
ansys-meshing-prime      0.3.0
anyio                    3.6.2
appdirs                  1.4.4
argon2-cffi              21.3.0
argon2-cffi-bindings     21.2.0
arrow                    1.2.3
asttokens                2.2.1
async-timeout            4.0.2
attrs                    22.2.0
backcall                 0.2.0
beautifulsoup4           4.12.0
bleach                   6.0.0
bokeh                    2.4.3
certifi                  2022.12.7
cffi                     1.15.1
charset-normalizer       3.1.0
colorama                 0.4.6
comm                     0.1.3
contourpy                1.0.7
cycler                   0.11.0
debugpy                  1.6.6
decorator                5.1.1
defusedxml               0.7.1
docutils                 0.19
executing                1.2.0
fastjsonschema           2.16.3
fonttools                4.39.0
fqdn                     1.5.1
frozenlist               1.3.3
grpcio                   1.51.3
idna                     3.4
imageio                  2.26.0
importlib-metadata       4.13.0
importlib-resources      5.12.0
ipycanvas                0.13.1
ipydatawidgets           4.3.3
ipyevents                2.0.1
ipykernel                6.22.0
ipython                  8.11.0
ipython-genutils         0.2.0
ipyvtklink               0.2.3
ipywidgets               7.7.4
isoduration              20.11.0
jedi                     0.18.2
Jinja2                   3.1.2
jsonpointer              2.3
jsonschema               4.17.3
jupyter-client           8.1.0
jupyter-core             5.3.0
jupyter-events           0.6.3
jupyter-server           2.5.0
jupyter-server-proxy     3.2.2
jupyter-server-terminals 0.4.4
jupyterlab-pygments      0.2.2
jupyterlab-widgets       1.1.3
kiwisolver               1.4.4
Markdown                 3.4.3
MarkupSafe               2.1.2
matplotlib               3.7.1
matplotlib-inline        0.1.6
mistune                  2.0.5
multidict                6.0.4
nbclassic                0.5.3
nbclient                 0.7.2
nbconvert                7.2.10
nbformat                 5.8.0
nest-asyncio             1.5.6
notebook                 6.5.3
notebook-shim            0.2.2
numpy                    1.24.2
packaging                23.0
pandocfilters            1.5.0
panel                    0.14.4
param                    1.13.0
parso                    0.8.3
pickleshare              0.7.5
Pillow                   9.4.0
pip                      21.1.1
pkgutil-resolve-name     1.3.10
platformdirs             3.1.1
pooch                    1.7.0
prometheus-client        0.16.0
prompt-toolkit           3.0.38
protobuf                 3.20.3
psutil                   5.9.4
pure-eval                0.2.2
pycparser                2.21
pyct                     0.5.0
Pygments                 2.14.0
pyparsing                3.0.9
pyrsistent               0.19.3
python-dateutil          2.8.2
python-json-logger       2.0.7
pythreejs                2.4.2
pyvista                  0.38.4
pyviz-comms              2.2.1
pywin32                  305
pywinpty                 2.0.10
PyYAML                   6.0
pyzmq                    25.0.2
requests                 2.28.2
rfc3339-validator        0.1.4
rfc3986-validator        0.1.1
scooby                   0.7.1
Send2Trash               1.8.0
setuptools               56.0.0
simpervisor              0.4
six                      1.16.0
sniffio                  1.3.0
soupsieve                2.4
stack-data               0.6.2
statistics               1.0.3.5
terminado                0.17.1
tinycss2                 1.2.1
tornado                  6.2
tqdm                     4.65.0
traitlets                5.9.0
traittypes               0.2.1
trame                    2.3.2
trame-client             2.7.4
trame-components         2.1.0
trame-deckgl             2.0.1
trame-markdown           2.0.2
trame-matplotlib         2.0.1
trame-plotly             2.1.0
trame-rca                0.3.0
trame-router             2.0.1
trame-server             2.9.1
trame-simput             2.3.1
trame-vega               2.0.2
trame-vtk                2.3.5
trame-vuetify            2.2.4
typing-extensions        4.5.0
uri-template             1.2.0
urllib3                  1.26.15
vtk                      9.2.6
wcwidth                  0.2.6
webcolors                1.12
webencodings             0.5.1
websocket-client         1.5.1
widgetsnbextension       3.6.3
wslink                   1.10.1
yarl                     1.8.2
zipp                     3.15.0
WARNING: You are using pip version 21.1.1; however, version 23.0.1 is available.
You should consider upgrading via the 'e:\github_pyprimemesh\.venv\scripts\python.exe -m pip install --upgrade pip' command.
hlee0122 commented 1 year ago

Hi @agvarghe just to clarify, are you trying to display a particular volume zone within the part? Have you specified the part/entity expression for the volume zone that you want to display?

agvarghe commented 1 year ago

Hi @hlee0122 Yes i am expecting to draw a volume zone , I havnt defined the part scope nor entity type , instead i just defined the evaluation type and zone expression