Skip to content
  • Importing STL as Solid body

    Python API
    6
    1 Votes
    6 Posts
    976 Views
    brynB
    I tried to reproduce this doing the following. I create three entities a cylinder copy it and convert the copy to a triangle mesh generate an unstructured tetrahedral mesh Then I drag these entities to the Analysis (ModelToGridFilter in Python API). I tried to use the surface viewer, but since they have no fields, nothing is displayed (this changed since 7.0 or before - it used to display a white surface). To generate a field I used the Calculator, and added expressions like coordsY*jHat, i.e. (0, coordsY, 0) where coordsY is the y-coordinate from the points in the geometry. Create a vector viewer for each (from the left: Solid Body, TriangleMesh, UnstructuredMesh). The third one samples vector values using Line/Plane/Box sources. [image: 1749109986009-d5bc2f0e-af54-4fca-8265-1431e94207ca-image.png] To get the vectors on the surface of the UnstructuredMesh, I had to first extract the surface, via Field Data Tools -> Surface Filter [image: 1749110185730-938040d9-2fcf-4cad-a42e-7c2f0d4592ec-image.png] The generated Python ("To Python' in context menu) script for item 5 was: # This script was auto-generated by Sim4Life version 8.2.0.16890 import numpy import s4l_v1.analysis as analysis import s4l_v1.document as document import s4l_v1.model as model import s4l_v1.units as units from s4l_v1 import ReleaseVersion from s4l_v1 import Unit try: # Define the version to use for default values ReleaseVersion.set_active(ReleaseVersion.version8_2) # Creating the analysis pipeline # Adding a new ModelToGridFilter inputs = [] model_to_grid_filter = analysis.core.ModelToGridFilter(inputs=inputs) model_to_grid_filter.Name = "Cylinder 3" model_to_grid_filter.Entity = model.AllEntities()["Cylinder 3"] model_to_grid_filter.UpdateAttributes() document.AllAlgorithms.Add(model_to_grid_filter) # Adding a new FieldCalculator inputs = [model_to_grid_filter.Outputs["Unstructured Grid"]] field_calculator = analysis.field.FieldCalculator(inputs=inputs) field_calculator.Expression = u"coordsZ*kHat" field_calculator.UpdateAttributes() document.AllAlgorithms.Add(field_calculator) # Adding a new FieldSurfaceFilter inputs = [field_calculator.Outputs["Result(x,y,z)"]] field_surface_filter = analysis.field.FieldSurfaceFilter(inputs=inputs) field_surface_filter.UpdateAttributes() document.AllAlgorithms.Add(field_surface_filter) # Adding a new VectorFieldViewer inputs = [field_surface_filter.Outputs["Result(x,y,z)"]] vector_field_viewer = analysis.viewers.VectorFieldViewer(inputs=inputs) vector_field_viewer.Data.Phase = u"0°" vector_field_viewer.Vector.Plane.PlaneCenter = numpy.array([0.05300000309944153, -0.03099999949336052, 0.012000000104308128]) vector_field_viewer.UpdateAttributes() document.AllAlgorithms.Add(vector_field_viewer) except Exception as exc: import traceback traceback.print_exc() # Reset active version to default ReleaseVersion.reset() raise(exc)
  • 0 Votes
    2 Posts
    310 Views
    brynB
    The voxeler (re-)uses cached information about the geometry (solids, wires, etc.). It looks up the information for each model entity and emits this message if the cached geometry was not found. Questions: are you running this in the GUI or a script/notebook? did you potentially delete (or modify) some of the entities assigned to the simulation (I guess in voxeler settings)? If you deleted the entity or modified it in the modeler (some operations preserve the instance, while others may create a new instance and delete the old one), this would explain the error. We could improve the error message by providing more helpful instructions.
  • Python scripting padding settings

    Python API
    5
    0 Votes
    5 Posts
    751 Views
    T
    This is in an older version of sim4life 8.0, maybe the problem has already been fixed. Otherwise I think this was a multiport simulation but I forget now... Maybe that could be a strange bug where it works for multi but not single or vise versa.
  • 0 Votes
    5 Posts
    903 Views
    M
    So my problem was solved for the simple phantom a sphere. It can be voxeled. I am having a discussion with chatgpt about how to load Duke into the simulation section because currently it wont be voxeled. Is there a simple few lines of code that loads Duke and all the default tissue electrical properties or is it necessary to assign each tissue type in a loop or via thousands lines of code (as I have seen elsewhere)....
  • Jobs suddenly remain queued indefinitely

    Unsolved Simulations & Solvers
    13
    0 Votes
    13 Posts
    2k Views
    P
    After a call with S4L support, here is the solution for future reference: My machine had two GPUs connected, one of them old and deactivated. However, the script ExtractCudaInfo.py detected both of these in the line 'num_gpus = int(xml_root.find("attached_gpus").text)' and then got stuck trying to find information on the deactivated GPU. A quick fix for the issue is therefore to manually set the correct number, in my case 'num_gpus=1', in the script.
  • 0 Votes
    9 Posts
    1k Views
    L
    @Sylvain I exported the electric field results from an AC simulation and found that the last six columns of the data are imaginary numbers. Are these the electric field values in three different directions? Why aren't they time-varying? Did I only export the peak values?
  • High Field Values at Extremities

    Simulations & Solvers
    6
    0 Votes
    6 Posts
    964 Views
    V
    Hi @bryn, I think you’re right. The issue appears to be related to the boundary conditions on the outer bounding box. I changed the boundary to a flux(0) condition, and that resolved the problem with the localized high field values at the extremities. Thank you!
  • ViP Shells for Sim4Life Users

    Anatomical Models
    4
    0 Votes
    4 Posts
    1k Views
    V
    That's helpful. Thank you for the detailed steps @bryn.
  • Determine distance between bones and Antenna

    Anatomical Models
    2
    0 Votes
    2 Posts
    636 Views
    brynB
    To measure the shortest distance between two entities, you can use the Python API: import XCoreModeling as xcm shell = xcm.GetActiveModel().SelectedEntities[0] coil = xcm.GetActiveModel().SelectedEntities[1] res = xcm.GetEntityEntityDistance(shell, coil) print(f"Shortest distance shell-coil: {res[0].Distance}") p1 = xcm.CreatePoint(res[0].ClosestPosition) p1.Name = "Point on Shell" p2 = xcm.CreatePoint(res[1].ClosestPosition) p2.Name = "Point on Coil" # This line is just to visualize where the measured distance was taken line = xcm.CreatePolyLine([res[0].ClosestPosition, res[1].ClosestPosition]) This would create something like this: [image: 1747752108672-c17b7bff-2d64-408c-88a7-fd83a4dadfdb-image.png] Some other snippets are shared here: https://forum.zmt.swiss/topic/565/geometry-modeling-snapping-to-endpoints-in-python-api/3?_=1747746585465
  • Surface projection tool

    CAD Modeling
    3
    1 Votes
    3 Posts
    533 Views
    V
    @brown Thank you for the suggestion. I can surface project object now.
  • Platform crashes

    Analysis & Postprocessing
    5
    0 Votes
    5 Posts
    832 Views
    A
    Hi, Sorry to bother You. IN ATTACHED VIDEO SHOWS WHAT HAPPENS AFTER CLICKING THE OPTION "CREATE PLOT" AND THE SYSTEM CRASHES. The workstation and memory have been tested, all without errors. Can one of the service engineers help? Kind regards, Thank you, Andrei Andrei Churakov MD,PhD, Associate Professor of the Department of Electronic Engineering and Technology BSUIR E-mail: anchurakov@bsuir.by
  • 0 Votes
    2 Posts
    378 Views
    brynB
    This question is quite old. Maybe you found a solution? Otherwise I guess you could use one of these options: you can crop the field, e.g. via the bounding box (or the extent if you have an E-field on a rectilinear grid) you could use the interpolation filter: define your little box grids, and interpolate from the field sensor field to your box grids you could define small field sensors in the simulation setup (not sure it is scalable to hundreds of sensors)
  • "wire radius"

    Simulations & Solvers
    2
    0 Votes
    2 Posts
    423 Views
    brynB
    Please give more context. E.g., "in the modeler when I use tool X", or in a "Y simulation" there is an option. or in this other thread (link) I asked about Z Then it will be easier to answer your question.
  • impossible drag and drop from non-CAD models

    CAD Modeling
    4
    0 Votes
    4 Posts
    1k Views
    brynB
    For the unstructured version of the EM LF Electro you would first need to generate a tetrahedral mesh. The mesh can be dragged onto such a simulation.
  • 0 Votes
    3 Posts
    553 Views
    brynB
    I would add that in the first approach you might change the tissue property of the original bladder to something else, e.g. fat, to get the desired effect of shrinking or stretching the bladder without creating air holes. Btw, you can measure the volume of a tissue surface in the modeler using the measure tool.
  • 0 Votes
    2 Posts
    482 Views
    C
    Are you able to run other NEURON tutorials (the pre-build versions)? If not then this issue could be related to the NEURON installation or version. It is possible that using an older version of the NEURON solver is causing the error you mentioned. Please make sure you have the correct version of NEURON installed in your Sim4Life folder. For instance, as you are using Sim4Life version 8.2.0.16876, you should download NEURON using NEURON_setup_8.2.0.16876.exe.
  • License Setup for iSolve on Linux

    Installation & Licensing
    2
    0 Votes
    2 Posts
    482 Views
    G
    Did you do one of the following: • Define the FlexNet environment variable FLEXID_LIBRARY_PATH to point to the location of the dongle shared object, libhasp_linux_x86_64.so. • Define the system environment variable LD_LIBRARY_PATH to point to the location of the dongle shared object libhasp_linux_x86_64.so. ? Could you try to send us the output of lmhostid -flexid? that command should return the dongle id. You can also access the dongle firmware - if it is correctly installed - via the loopback address. On a browser, go to http://localhost:1947/ you should see the characteristics of the dongle. Let us know if it works.
  • MATCH returns switched values

    Analysis & Postprocessing
    3
    0 Votes
    3 Posts
    571 Views
    ofliO
    Hi @parsley, Thank you for your feedback and for reporting the issue you experienced. The MATCH tool has already been successfully used/validated by many users and offers several useful features. For example, it allows users to add loading or matching circuits the S-matrix of a simulation and obtain updated scattering parameters without re‑running the full simulation. Have you experienced any problems with this particular workflow? From the information you provided, the issue appears to be related to only the Initial Matching function—the option that generates a matching circuit for a given S-matrix of a simulation at a chosen target frequency. In your case, you reported that it worked with the dipole antenna example but not with your specific antenna model. We would be happy to discuss the details so we can reproduce the problem and resolve it quickly. We will contact you to find out a convenient time to follow up. Thank you again for bringing this to our attention.
  • AttributeError: 'NoneType' object has no attribute 'Results'

    Python API
    2
    0 Votes
    2 Posts
    454 Views
    SylvainS
    Hi, You would get that error if there was no simulation named "0_17_35_29" in the currently opened document. Maybe you should check what simulations you have in your project and if you do have a simulation with that name? One way to list all simulation names via python is to run something like: for s in document.AllSimulations: print(s.Name)
  • Start the Linux licensing daemon failed

    Installation & Licensing
    7
    0 Votes
    7 Posts
    1k Views
    G
    This looks like the drivers for the dongle are missing or have not been installed. Did you check the manual on how to install drivers for Linux? Also, it would help if you send us the full log. You can do that by emailing us at: s4l-support-group@zmt.swiss Regards, Guillermo