.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "examples\02-SBR+\SBR_City_Import.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_examples_02-SBR+_SBR_City_Import.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_examples_02-SBR+_SBR_City_Import.py:


SBR+: Import Geometry from Maps
-------------------------------
This example shows how you can use PyAEDT to create an HFSS SBR+ project from an
OpenStreeMaps.

.. GENERATED FROM PYTHON SOURCE LINES 8-12

Perform required imports
~~~~~~~~~~~~~~~~~~~~~~~~
Perform required imports and set up the local path to the PyAEDT
directory path.

.. GENERATED FROM PYTHON SOURCE LINES 12-16

.. code-block:: Python


    import os
    from pyaedt import Hfss








.. GENERATED FROM PYTHON SOURCE LINES 17-20

Set AEDT version
~~~~~~~~~~~~~~~~
Set AEDT version.

.. GENERATED FROM PYTHON SOURCE LINES 20-23

.. code-block:: Python


    aedt_version = "2024.1"








.. GENERATED FROM PYTHON SOURCE LINES 24-28

Set non-graphical mode
~~~~~~~~~~~~~~~~~~~~~~
Set non-graphical mode. 
You can set ``non_graphical`` either to ``True`` or ``False``.

.. GENERATED FROM PYTHON SOURCE LINES 28-31

.. code-block:: Python


    non_graphical = False








.. GENERATED FROM PYTHON SOURCE LINES 32-36

Define designs
~~~~~~~~~~~~~~
Define two designs, one source and one target.
Each design is connected to a different object.

.. GENERATED FROM PYTHON SOURCE LINES 36-45

.. code-block:: Python


    app = Hfss(
        designname="Ansys",
        solution_type="SBR+",
        specified_version=aedt_version,
        new_desktop_session=True,
        non_graphical=non_graphical
    )








.. GENERATED FROM PYTHON SOURCE LINES 46-49

Define Location to import
~~~~~~~~~~~~~~~~~~~~~~~~~
Define latitude and longitude to import.

.. GENERATED FROM PYTHON SOURCE LINES 49-51

.. code-block:: Python

    ansys_home = [40.273726, -80.168269]








.. GENERATED FROM PYTHON SOURCE LINES 52-55

Generate map and import
~~~~~~~~~~~~~~~~~~~~~~~
Assign boundaries.

.. GENERATED FROM PYTHON SOURCE LINES 55-62

.. code-block:: Python


    app.modeler.import_from_openstreet_map(ansys_home,
                                           terrain_radius=250,
                                           road_step=3,
                                           plot_before_importing=False,
                                           import_in_aedt=True)





.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    C:\actions-runner\_work\pyaedt\pyaedt\.venv\lib\site-packages\pyvista\core\filters\poly_data.py:2942: PyVistaFutureWarning: The default value of the ``capping`` keyword argument will change in a future version to ``True`` to match the behavior of VTK. We recommend passing the keyword explicitly to prevent future surprises.
      warnings.warn(
    C:\actions-runner\_work\pyaedt\pyaedt\.venv\lib\site-packages\osmnx\graph.py:106: FutureWarning: The clean_periphery argument has been deprecated and will be removed in the v2.0.0 release. Future behavior will be as though clean_periphery=True. See the OSMnx v2 migration guide: https://github.com/gboeing/osmnx/issues/1123
      G = graph_from_polygon(

    {'name': 'default', 'version': 1, 'type': 'environment', 'center_lat_lon': [40.273726, -80.168269], 'radius': 250, 'include_buildings': True, 'include_roads': True, 'parts': {'terrain': {'file_name': 'C:/Users/ansys/Documents/Ansoft/Project655.pyaedt\\Ansys/terrain.stl', 'color': 'brown', 'material': 'earth'}, 'buildings': {'file_name': 'C:/Users/ansys/Documents/Ansoft/Project655.pyaedt\\Ansys\\buildings.stl', 'color': 'grey', 'material': 'concrete'}, 'roads': {'file_name': 'C:/Users/ansys/Documents/Ansoft/Project655.pyaedt\\Ansys\\roads.stl', 'color': 'black', 'material': 'asphalt'}}}



.. GENERATED FROM PYTHON SOURCE LINES 63-66

Plot model
~~~~~~~~~~
Plot the model.

.. GENERATED FROM PYTHON SOURCE LINES 66-75

.. code-block:: Python


    plot_obj = app.plot(show=False, plot_air_objects=True)
    plot_obj.background_color = [153,203,255]
    plot_obj.zoom = 1.5
    plot_obj.show_grid = False
    plot_obj.show_axes = False
    plot_obj.bounding_box = False
    plot_obj.plot(os.path.join(app.working_directory, "Source.jpg"))




.. image-sg:: /examples/02-SBR+/images/sphx_glr_SBR_City_Import_001.png
   :alt: SBR City Import
   :srcset: /examples/02-SBR+/images/sphx_glr_SBR_City_Import_001.png
   :class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

 .. code-block:: none


    True



.. GENERATED FROM PYTHON SOURCE LINES 76-79

Release AEDT
~~~~~~~~~~~~
Release AEDT and close the example.

.. GENERATED FROM PYTHON SOURCE LINES 79-81

.. code-block:: Python


    app.release_desktop()




.. rst-class:: sphx-glr-script-out

 .. code-block:: none


    True




.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (1 minutes 18.309 seconds)


.. _sphx_glr_download_examples_02-SBR+_SBR_City_Import.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: SBR_City_Import.ipynb <SBR_City_Import.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: SBR_City_Import.py <SBR_City_Import.py>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_