Code that I have tried so far to find the relevant surface:
@n5064368 wrote:
I’ve exported a step file from fusion 360 to CFD and can find the part and volume I’m interested via the API (python) but cannot see how to get the part’s surface ids. I’m wanting to apply velocity to them ahead of running the solver. Is it possible to get a surface ID eg 603 when my part ID is say 4. I can’t see how to traverse from part to its surface. The api example assumes you already know the id and not how to find a surface id. Thanks.
python
from CFD import Setup
from CFD import DSE
DSE.UI.ShowMessage("Starting ip!")
study = Setup.DesignStudy.Create()
scenario = study.getActiveScenario()
parts = Setup.PartList()
scenario.parts(parts)
for part in parts:
if "inlet" in part.name():
# This is the inlet
DSE.UI.ShowMessage(part.name())
DSE.UI.ShowMessage(str(part.id()))
# Can I get surface from the bounding box?
box = part.boundingBox()
DSE.UI.ShowMessage(str(box.getMin()))
DSE.UI.ShowMessage(str(box.getMax()))
if "outlet" in part.name():
# This is the outlet
DSE.UI.ShowMessage(part.name())
DSE.UI.ShowMessage(str(part.id()))
for id in range(606,610😞
ent = scenario.entity('Surface', id)
DSE.UI.ShowMessage(str(ent))
DSE.UI.ShowMessage(str(id))
# 606 and 610 is part of the inlet but the part id is not that
DSE.UI.ShowMessage(str(ent.partID()))
DSE.UI.ShowMessage(str(ent.numProperties()))
# I also tried to select the surface but it didn't work
scenario.deselectAll()
scenario.selectionMode = "Surface"
scenario.selectionBasis = "By Material"
scenario.select(606)