SBR+: Import Geometry from Maps#

This example shows how you can use PyAEDT to create an HFSS SBR+ project from an OpenStreeMaps.

Perform required imports#

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

import os
from pyaedt import Hfss

Set non-graphical mode#

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

non_graphical = False

Define designs#

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

app = Hfss(
    designname="Ansys",
    solution_type="SBR+",
    specified_version="2023.2",
    new_desktop_session=True,
    non_graphical=non_graphical
)
Initializing new desktop!

Define Location to import#

Define latitude and longitude to import.

ansys_home = [40.273726, -80.168269]

Generate map and import#

Assign boundaries.

app.modeler.import_from_openstreet_map(ansys_home,
                                       terrain_radius=250,
                                       road_step=3,
                                       plot_before_importing=False,
                                       import_in_aedt=True)
C:\actions-runner\_work\pyaedt\pyaedt\testenv\lib\site-packages\pyaedt\modeler\advanced_cad\oms.py:102: UserWarning: The `geometries` module and `geometries_from_X` functions have been renamed the `features` module and `features_from_X` functions. Use these instead. The `geometries` module and function names are deprecated and will be removed in a future release.
  gdf = ox.geometries.geometries_from_point(center_lat_lon, tags={"building": True}, dist=max_radius)
C:\actions-runner\_work\pyaedt\pyaedt\testenv\lib\site-packages\pyvista\core\filters\poly_data.py:2951: 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\testenv\lib\site-packages\osmnx\graph.py:88: UserWarning: The clean_periphery argument has been deprecated and will be removed in a future release. Future behavior will be as though clean_periphery=True.
  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/Project2076.pyaedt\\Ansys/terrain.stl', 'color': 'brown', 'material': 'earth'}, 'buildings': {'file_name': 'C:/Users/ansys/Documents/Ansoft/Project2076.pyaedt\\Ansys\\buildings.stl', 'color': 'grey', 'material': 'concrete'}, 'roads': {'file_name': 'C:/Users/ansys/Documents/Ansoft/Project2076.pyaedt\\Ansys\\roads.stl', 'color': 'black', 'material': 'asphalt'}}}

Plot model#

Plot the model.

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"))
SBR City Import
True

Release AEDT#

Release AEDT and close the example.

app.release_desktop()
True

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

Gallery generated by Sphinx-Gallery