Extract the bounding box of a solid
Pinned
Python API
-
I am trying to write the code for a EM-LF simulation with several electrodes.
Using the GUI, in the simulation settings, when I assign the electrode solid to a field sensor setting a bouding box is automatically extracted and is linked to the field sensor setting.How can I extract this bounding box from code so that i can run everything from it?
-
There is a function that returns the bounding box of an entity.
Let us assume you have an entity called 'object 1'. The following code should return the coordinate vectors of two diagonally opposite corners of the bounding box:import s4l_v1.model as model import XCoreModeling entity = model.AllEntities()['object 1'] bb_lower, bb_upper = XCoreModeling.GetBoundingBox([entity])
You can then use the
model.CreateWireBlock()
function to create an object which you can use in your simulation settings.For more detail:
help(XCoreModeling.GetBoundingBox) help(model.CreateWireBlock)