.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "examples\07-Circuit\Create_Netlist.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_examples_07-Circuit_Create_Netlist.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_examples_07-Circuit_Create_Netlist.py:


Circuit: netlist to schematic import
------------------------------------
This example shows how you can import netlist data into a circuit design.
HSPICE files are fully supported. Mentor files are partially supported.

.. GENERATED FROM PYTHON SOURCE LINES 9-12

Perform required imports
~~~~~~~~~~~~~~~~~~~~~~~~
Perform required imports and set paths.

.. GENERATED FROM PYTHON SOURCE LINES 12-22

.. code-block:: Python


    import os

    import pyaedt

    netlist = pyaedt.downloads.download_netlist()

    project_name = pyaedt.generate_unique_project_name()
    print(project_name)





.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    D:\Temp\pyaedt_prj_0V3\Project_9S2.aedt




.. GENERATED FROM PYTHON SOURCE LINES 23-26

Set AEDT version
~~~~~~~~~~~~~~~~
Set AEDT version.

.. GENERATED FROM PYTHON SOURCE LINES 26-29

.. code-block:: Python


    aedt_version = "2024.1"








.. GENERATED FROM PYTHON SOURCE LINES 30-36

Set non-graphical mode
~~~~~~~~~~~~~~~~~~~~~~
Set non-graphical mode. 
You can set ``non_graphical`` either to ``True`` or ``False``.
The Boolean parameter ``NewThread`` defines whether to create a new instance
of AEDT or try to connect to an existing instance of it.

.. GENERATED FROM PYTHON SOURCE LINES 36-40

.. code-block:: Python


    non_graphical = False
    NewThread = True








.. GENERATED FROM PYTHON SOURCE LINES 41-45

Launch AEDT with Circuit
~~~~~~~~~~~~~~~~~~~~~~~~
Launch AEDT with Circuit. The :class:`pyaedt.Desktop` class initializes AEDT
and starts it on the specified version in the specified graphical mode.

.. GENERATED FROM PYTHON SOURCE LINES 45-49

.. code-block:: Python


    desktop = pyaedt.launch_desktop(aedt_version, non_graphical, NewThread)
    aedtapp = pyaedt.Circuit(projectname=project_name)





.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    C:\actions-runner\_work\_tool\Python\3.10.9\x64\lib\subprocess.py:1072: ResourceWarning: subprocess 4772 is still running
      _warn("subprocess %s is still running" % self.pid,
    C:\actions-runner\_work\pyaedt\pyaedt\.venv\lib\site-packages\pyaedt\generic\settings.py:383: ResourceWarning: unclosed file <_io.TextIOWrapper name='D:\\Temp\\pyaedt_ansys.log' mode='a' encoding='cp1252'>
      self._logger = val




.. GENERATED FROM PYTHON SOURCE LINES 50-53

Define variable
~~~~~~~~~~~~~~~
Define a design variable by using a ``$`` prefix.

.. GENERATED FROM PYTHON SOURCE LINES 53-56

.. code-block:: Python


    aedtapp["Voltage"] = "5"








.. GENERATED FROM PYTHON SOURCE LINES 57-62

Create schematic from netlist file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Create a schematic from a netlist file. The ``create_schematic_from_netlist``
method reads the netlist file and parses it. All components are parsed
but only these categories are mapped: R, L, C, Q, U, J, V, and I.

.. GENERATED FROM PYTHON SOURCE LINES 62-65

.. code-block:: Python


    aedtapp.create_schematic_from_netlist(netlist)





.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    ['NAME:Models_Netlist', 'Info:=', ['Type:=', 0, 'NumTerminals:=', 0, 'DataSource:=', '', 'ModifiedOn:=', '', 'Manufacturer:=', '', 'Symbol:=', 'Models_Netlist', 'ModelNames:=', '', 'Footprint:=', '', 'Description:=', '', 'InfoTopic:=', '', 'InfoHelpFile:=', '', 'IconFile:=', '', 'Library:=', '', 'OriginalLocation:=', 'Project', 'IEEE:=', '', 'Author:=', '', 'OriginalAuthor:=', '', 'CreationDate:=', '', 'ExampleFile:=', '', 'HiddenComponent:=', 0, 'CircuitEnv:=', 0, 'GroupID:=', 0], 'CircuitEnv:=', 0, 'Refbase:=', 'x', 'NumParts:=', 1, 'ModSinceLib:=', True, 'CompExtID:=', 1, ['NAME:Parameters', 'ButtonProp:=', ['CosimDefinition', 'D', '', 'Edit', 'Edit', 40501, 'ButtonPropClientData:=', []], 'MenuProp:=', ['CoSimulator', 'D', '', 'DefaultNetlist', 0]], ['NAME:CosimDefinitions', ['NAME:CosimDefinition', 'CosimulatorType:=', 4, 'CosimDefName:=', 'DefaultNetlist', 'IsDefinition:=', True, 'Connect:=', True, 'Data:=', ['Nexxim Circuit:=', 'x@ID '], 'GRef:=', ['Nexxim Circuit:=', '']], 'DefaultCosim:=', 'DefaultNetlist']]
    ['NAME:STS6NF20V', 'Info:=', ['Type:=', 0, 'NumTerminals:=', 8, 'DataSource:=', '', 'ModifiedOn:=', 1591858313, 'Manufacturer:=', '', 'Symbol:=', 'STS6NF20V', 'ModelNames:=', '', 'Footprint:=', '', 'Description:=', '', 'InfoTopic:=', '', 'InfoHelpFile:=', '', 'IconFile:=', '', 'Library:=', '', 'OriginalLocation:=', 'Project', 'IEEE:=', '', 'Author:=', '', 'OriginalAuthor:=', '', 'CreationDate:=', 1591858313, 'ExampleFile:=', '', 'HiddenComponent:=', 0, 'CircuitEnv:=', 0, 'GroupID:=', 0], 'CircuitEnv:=', 0, 'Refbase:=', 'Q', 'NumParts:=', 1, 'ModSinceLib:=', True, 'Terminal:=', ['Pin1', 'Pin1', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin2', 'Pin2', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin3', 'Pin3', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin4', 'Pin4', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin5', 'Pin5', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin6', 'Pin6', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin7', 'Pin7', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin8', 'Pin8', 'A', False, 0, 1, '', 'Electrical', '0'], 'CompExtID:=', 1, ['NAME:Parameters', 'TextValueProp:=', ['MOD', 'D', '', 'STS6NF20V'], 'ButtonProp:=', ['CosimDefinition', 'D', '', 'Edit', 'Edit', 40501, 'ButtonPropClientData:=', []], 'MenuProp:=', ['CoSimulator', 'D', '', 'DefaultNetlist', 0]], ['NAME:CosimDefinitions', ['NAME:CosimDefinition', 'CosimulatorType:=', 4, 'CosimDefName:=', 'DefaultNetlist', 'IsDefinition:=', True, 'Connect:=', True, 'Data:=', ['Nexxim Circuit:=', 'Q@ID %0 STS6NF20V %1 STS6NF20V %2 STS6NF20V %3 STS6NF20V %4 STS6NF20V %5 STS6NF20V %6 STS6NF20V %7 STS6NF20V @MOD '], 'GRef:=', ['Nexxim Circuit:=', '']], 'DefaultCosim:=', 'DefaultNetlist']]
    ['NAME:CON4', 'Info:=', ['Type:=', 0, 'NumTerminals:=', 5, 'DataSource:=', '', 'ModifiedOn:=', 1591858313, 'Manufacturer:=', '', 'Symbol:=', 'CON4', 'ModelNames:=', '', 'Footprint:=', '', 'Description:=', '', 'InfoTopic:=', '', 'InfoHelpFile:=', '', 'IconFile:=', '', 'Library:=', '', 'OriginalLocation:=', 'Project', 'IEEE:=', '', 'Author:=', '', 'OriginalAuthor:=', '', 'CreationDate:=', 1591858313, 'ExampleFile:=', '', 'HiddenComponent:=', 0, 'CircuitEnv:=', 0, 'GroupID:=', 0], 'CircuitEnv:=', 0, 'Refbase:=', 'J', 'NumParts:=', 1, 'ModSinceLib:=', True, 'Terminal:=', ['Pin1', 'Pin1', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin2', 'Pin2', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin3', 'Pin3', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin4', 'Pin4', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin5', 'Pin5', 'A', False, 0, 1, '', 'Electrical', '0'], 'CompExtID:=', 1, ['NAME:Parameters', 'TextValueProp:=', ['MOD', 'D', '', 'CON4'], 'ButtonProp:=', ['CosimDefinition', 'D', '', 'Edit', 'Edit', 40501, 'ButtonPropClientData:=', []], 'MenuProp:=', ['CoSimulator', 'D', '', 'DefaultNetlist', 0]], ['NAME:CosimDefinitions', ['NAME:CosimDefinition', 'CosimulatorType:=', 4, 'CosimDefName:=', 'DefaultNetlist', 'IsDefinition:=', True, 'Connect:=', True, 'Data:=', ['Nexxim Circuit:=', 'J@ID %0 CON4 %1 CON4 %2 CON4 %3 CON4 %4 CON4 @MOD '], 'GRef:=', ['Nexxim Circuit:=', '']], 'DefaultCosim:=', 'DefaultNetlist']]
    ['NAME:DCH010505SN7', 'Info:=', ['Type:=', 0, 'NumTerminals:=', 4, 'DataSource:=', '', 'ModifiedOn:=', 1591858313, 'Manufacturer:=', '', 'Symbol:=', 'DCH010505SN7', 'ModelNames:=', '', 'Footprint:=', '', 'Description:=', '', 'InfoTopic:=', '', 'InfoHelpFile:=', '', 'IconFile:=', '', 'Library:=', '', 'OriginalLocation:=', 'Project', 'IEEE:=', '', 'Author:=', '', 'OriginalAuthor:=', '', 'CreationDate:=', 1591858313, 'ExampleFile:=', '', 'HiddenComponent:=', 0, 'CircuitEnv:=', 0, 'GroupID:=', 0], 'CircuitEnv:=', 0, 'Refbase:=', 'U', 'NumParts:=', 1, 'ModSinceLib:=', True, 'Terminal:=', ['Pin1', 'Pin1', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin2', 'Pin2', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin3', 'Pin3', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin4', 'Pin4', 'A', False, 0, 1, '', 'Electrical', '0'], 'CompExtID:=', 1, ['NAME:Parameters', 'TextValueProp:=', ['MOD', 'D', '', 'DCH010505SN7'], 'ButtonProp:=', ['CosimDefinition', 'D', '', 'Edit', 'Edit', 40501, 'ButtonPropClientData:=', []], 'MenuProp:=', ['CoSimulator', 'D', '', 'DefaultNetlist', 0]], ['NAME:CosimDefinitions', ['NAME:CosimDefinition', 'CosimulatorType:=', 4, 'CosimDefName:=', 'DefaultNetlist', 'IsDefinition:=', True, 'Connect:=', True, 'Data:=', ['Nexxim Circuit:=', 'U@ID %0 DCH010505SN7 %1 DCH010505SN7 %2 DCH010505SN7 %3 DCH010505SN7 @MOD '], 'GRef:=', ['Nexxim Circuit:=', '']], 'DefaultCosim:=', 'DefaultNetlist']]

    True



.. GENERATED FROM PYTHON SOURCE LINES 66-70

Close project and release AEDT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
After adding any other desired functionalities, close the project and release
AEDT.

.. GENERATED FROM PYTHON SOURCE LINES 70-72

.. code-block:: Python


    desktop.release_desktop()




.. rst-class:: sphx-glr-script-out

 .. code-block:: none


    True




.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 33.826 seconds)


.. _sphx_glr_download_examples_07-Circuit_Create_Netlist.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: Create_Netlist.ipynb <Create_Netlist.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: Create_Netlist.py <Create_Netlist.py>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_