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. "PYAEDT_NON_GRAPHICAL" is needed to generate documentation only. 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.1",
    new_desktop_session=True,
    non_graphical=non_graphical
)

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\pyvista\core\filters\poly_data.py:2848: 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\utils_graph.py:85: FutureWarning: You are adding a column named 'geometry' to a GeoDataFrame constructed without an active geometry column. Currently, this automatically sets the active geometry column to 'geometry' but in the future that will no longer happen. Instead, either provide geometry to the GeoDataFrame constructor (GeoDataFrame(... geometry=GeoSeries()) or use `set_geometry('geometry')` to explicitly set the active geometry column.
  gdf_edges["geometry"] = np.nan

{'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': 'D:/Projects/Project8006.pyaedt\\Ansys/terrain.stl', 'color': 'brown', 'material': 'earth'}, 'buildings': {'file_name': 'D:/Projects/Project8006.pyaedt\\Ansys\\buildings.stl', 'color': 'grey', 'material': 'concrete'}, 'roads': {'file_name': 'D:/Projects/Project8006.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.479 seconds)

Gallery generated by Sphinx-Gallery