@@ -1898,7 +1898,7 @@ function Base.show(io::IO, mime::MIME"text/plain", sys::AbstractSystem; hint = t
18981898 nsubs = length (subs)
18991899 nrows = min (nsubs, limit ? rows : nsubs)
19001900 nrows > 0 && printstyled (io, " \n Subsystems ($(nsubs) ):" ; bold)
1901- nrows > 0 && hint && print (io, " see ModelingToolkit.get_systems (sys)" )
1901+ nrows > 0 && hint && print (io, " see hierarchy (sys)" )
19021902 for i in 1 : nrows
19031903 sub = subs[i]
19041904 name = String (nameof (sub))
@@ -2902,12 +2902,22 @@ function Base.showerror(io::IO, e::HybridSystemNotSupportedException)
29022902 print (io, " HybridSystemNotSupportedException: " , e. msg)
29032903end
29042904
2905- function AbstractTrees. children (sys:: ModelingToolkit. AbstractSystem )
2905+ function AbstractTrees. children (sys:: AbstractSystem )
29062906 ModelingToolkit. get_systems (sys)
29072907end
2908- function AbstractTrees. printnode (io:: IO , sys:: ModelingToolkit.AbstractSystem )
2909- print (io, nameof (sys))
2908+ function AbstractTrees. printnode (io:: IO , sys:: AbstractSystem ; describe = false , bold = false )
2909+ printstyled (io, nameof (sys); bold)
2910+ describe && ! isempty (get_description (sys)) && print (io, " : " , get_description (sys))
29102911end
2912+ """
2913+ hierarchy(sys::AbstractSystem; describe = false, bold = describe, kwargs...)
2914+
2915+ Print a tree of a system's hierarchy of subsystems.
2916+ """
2917+ function hierarchy (sys:: AbstractSystem ; describe = false , bold = describe, kwargs... )
2918+ print_tree (sys; printnode_kw = (describe = describe, bold = bold), kwargs... )
2919+ end
2920+
29112921function Base. IteratorEltype (:: Type{<:TreeIterator{ModelingToolkit.AbstractSystem}} )
29122922 Base. HasEltype ()
29132923end
0 commit comments