Skip to content

Python API

Scripting interface for Sim4Life

126 Topics 371 Posts
  • Model To Python Script

    1
    0 Votes
    1 Posts
    244 Views
    No one has replied
  • S4L v6.0 python pip install tkinter

    9
    0 Votes
    9 Posts
    1k Views
    B

    @jasper-goethals hei im new here, for sim4life Light v7.. still cant use Tkinter so use another module PyQt5 its not best solution but its work for me

  • Extract power balance

    3
    0 Votes
    3 Posts
    274 Views
    M

    This works indeed! Thanks a lot!

  • This topic is deleted!

    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • VSCode extension

    5
    1 Votes
    5 Posts
    820 Views
    L

    I am not sure to be honest why that was an issue for me with that specific version only, I installed the new version and it was there so problem solved!

  • Importing and exporting coordinates for an array of points

    15
    0 Votes
    15 Posts
    2k Views
    brynB

    @mkn how about you post your code. maybe somebody will show you where the bug is

  • Optimization to python

    3
    0 Votes
    3 Posts
    255 Views
    A

    @Sylvain OK, thank you for the answer.

  • Export SAR to matlab for analysis

    6
    0 Votes
    6 Posts
    1k Views
    S

    @sayimgokyar
    Note to myself:
    Press right-click on fields on output window and "refresh" button after setting up everything.

  • How to put model entities into a group using Python API?

    5
    0 Votes
    5 Posts
    451 Views
    M

    Thanks @montanaro!

  • Exporting Simulation Results for Specific Tissues

    2
    0 Votes
    2 Posts
    217 Views
    No one has replied
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • how to implement 'thicken-wire' in Modify menu of a spline?

    2
    0 Votes
    2 Posts
    295 Views
    S

    Hello Aiping,

    Bellow is a small example which might help you.

    import s4l_v1 as s4l import XCoreModeling import random radius = 0.1 points = list() for ii in range(20): points.append(s4l.Vec3(random.randrange(0,20), random.randrange(0,20), random.randrange(0,20))) spline = XCoreModeling.CreateSpline(points) wire = XCoreModeling.ThickenWire(spline, radius)

    Regards,

    Spuky

  • Change EMLF boundary condition with Python

    2
    0 Votes
    2 Posts
    182 Views
    M

    Easiest way is to right click on your simulation and click on 'To Python..'

    Run this to make sure it works. It should create a new simulation with the exact same parameters. You can then change whichever parameter you like and run it again

    Note: If I remember correctly, if you use 'To Python', a lot of the default settings won't show up in the code. if they don't show up (like the boundary condition),change them to some non-default value in your simulation before using 'To Python'.

  • How to suppress Voxelling info in console

    1
    0 Votes
    1 Posts
    137 Views
    No one has replied
  • FlexNet License Finder pop-up when trying to use Python API in Jupyter

    Unsolved
    3
    0 Votes
    3 Posts
    573 Views
    L

    @sylvain Thank you for the advice Sylvain! I have tried doing as you suggested and using the StartNotebook.bat does start a Jupyter Server. Unfortunately, if I start a new Notebook and try to import a Sim4Life module, I again get a pop-up called FlexNet License Finder wanting the location of either the license or the license server.
    a490c780-3a1d-41ad-a116-8b2c43ada34b-image.png
    Just to be sure I have tried doing so on different computers to try and rule out a faulty installation, however the issue persists.
    I can confirm that there are no problems with using Sim4Life’s GUI or using the integrated scripter/console. I did take a closer look at the Sim4Life console though and noticed that upon start up the following message is displayed:
    8493be54-bcd1-4c7e-ad7d-5abb95b186e3-image.png
    So perhaps this is a license issue after all?

  • Bend a spline along a body part or organ in phantom model

    1
    0 Votes
    1 Posts
    174 Views
    No one has replied
  • Sweep a spline along a body part or organ in phantom model

    1
    1 Votes
    1 Posts
    187 Views
    No one has replied
  • Importing file as a Label Field

    10
    0 Votes
    10 Posts
    839 Views
    A

    this is extremely useful! thanks a lot.

  • Blend faces function

    1
    0 Votes
    1 Posts
    133 Views
    No one has replied
  • Obtain material properties from material database

    3
    0 Votes
    3 Posts
    573 Views
    R

    Hi Haza,

    yes, i managed to get the corresponding material with :
    tissue_X_entity.MaterialName
    Each entity of the anatomical model has this attribute which is visible also through the GUI.
    thanks