PowerBoots and NodeXL

Developer
Aug 24, 2009 at 3:15 PM

Joel, I have got the NodeXL control added to Boots.

It mostly works. I can create graphs.

I need to use the New-MultiScaleLayout.Graph that is generated from Add-BootsFunction.

Two things.

For the 2 Param statements it generated and extra comma ',' for the arguements. I deleted those and hit the next issue.

Not sure if I did the Add-BootsFunction wrong, looks like I have all the DLLs.

Any ideas?

Object : Cannot find type [MultiScaleLayout.Graph]: make sure the assembly containing this type is loaded.
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\powerboots\Functions\New-MultiScaleLayout.Graph.ps1:39 char:25
+    $DObject = New-Object <<<<  MultiScaleLayout.Graph
    + CategoryInfo          : InvalidType: (:) [New-Object], PSArgumentException
    + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
 
New-Object : Cannot find type [MultiScaleLayout.Graph]: make sure the assembly containing this type is loaded.
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\powerboots\Functions\New-MultiScaleLayout.Graph.ps1:48 char:28
+       $DObject = New-Object <<<<  MultiScaleLayout.Graph
    + CategoryInfo          : InvalidType: (:) [New-Object], PSArgumentException
    + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

Coordinator
Aug 24, 2009 at 4:35 PM

I'm not seeing that class ... I grabbed the Aug 18 drop of the NodeXL Class Libraries but I might be looking in the wrong place?  I mean, there's a bunch of DLLs in here. I looked in the help and in these ...

Microsoft.NodeXL.Control.Wpf.dll
Microsoft.NodeXL.Core.dll
Microsoft.NodeXL.Layouts.dll
Microsoft.NodeXL.Visualization.Wpf.dll

But although I found a HarelKorenFastMultiscaleLayout class, I didn't find a MultiScaleLayout class.  From the name of that function, however (especially compared to the ones I'm seeing) I'm going to guess that something went wrong...

  1. What download did you use?
  2. What assembly did you pass to Add-BootsFunction?
Developer
Aug 24, 2009 at 5:33 PM
I have the Aug 18 download and processed these DLLs.
Could be an issue in the NodeXL assemblies. I am able to draw on the graph initially.
When I set the graph property the a new instance is when I hit the error.
[Reflection.Assembly]::LoadFrom( "C:\Program Files\Microsoft Research\Microsoft NodeXL Excel Template\Microsoft.NodeXL.Adapters.dll" ).GetTypes() | Add-BootsFunction
[Reflection.Assembly]::LoadFrom( "C:\Program Files\Microsoft Research\Microsoft NodeXL Excel Template\Microsoft.NodeXL.Algorithms.dll" ).GetTypes() | Add-BootsFunction
[Reflection.Assembly]::LoadFrom( "C:\Program Files\Microsoft Research\Microsoft NodeXL Excel Template\Microsoft.NodeXL.ApplicationUtil.dll" ).GetTypes() | Add-BootsFunction
[Reflection.Assembly]::LoadFrom( "C:\Program Files\Microsoft Research\Microsoft NodeXL Excel Template\Microsoft.NodeXL.Control.Wpf.dll" ).GetTypes() | Add-BootsFunction
[Reflection.Assembly]::LoadFrom( "C:\Program Files\Microsoft Research\Microsoft NodeXL Excel Template\Microsoft.NodeXL.Core.dll" ).GetTypes() | Add-BootsFunction
[Reflection.Assembly]::LoadFrom( "C:\Program Files\Microsoft Research\Microsoft NodeXL Excel Template\Microsoft.NodeXL.Layouts.dll" ).GetTypes() | Add-BootsFunction
[Reflection.Assembly]::LoadFrom( "C:\Program Files\Microsoft Research\Microsoft NodeXL Excel Template\Microsoft.NodeXL.Util.dll" ).GetTypes() | Add-BootsFunction
[Reflection.Assembly]::LoadFrom( "C:\Program Files\Microsoft Research\Microsoft NodeXL Excel Template\Microsoft.NodeXL.Visualization.Wpf.dll" ).GetTypes() | Add-BootsFunction
Developer
Aug 24, 2009 at 6:45 PM

Did some digging and found Microsoft.NodeXL.Core.Graph.

Using this New-Object Microsoft.NodeXL.Core.Graph works.

I posted a question on NodeXL asking about the location of MultiScaleLayout.Graph.

The code gen was a bit problematic though.

Developer
Aug 24, 2009 at 7:16 PM

The developers of NodeXL confirmed there is no MultiScaleLayout.Graph class.

New-Object Microsoft.NodeXL.Core.Graph works. Not sure if something went wrong when I generated the code.

Coordinator
Aug 25, 2009 at 12:46 AM

OK, the problem is how you called Add-BootsFunction -- you added a ton of stuff you didn't want, including private types, enumerables, abstract classes, etc. You probably only want to add boots functions for things that are actually WPF controls, but at the very least you only want to add them for things that are new-able with "default" (no argument) constructors. What you should do is something like this:

ls C:\Users\Joel\Documents\WindowsPowershell\Libraries\NodeXL\*.dll | Add-BootsFunction

That way, the Add-BootsFunction gets called on the assembly, not on every single type. If you call Add-BootsFunction on an Assembly, we do something like this:

$assembly=  [Reflection.Assembly]::LoadFrom( (Convert-Path ...) )
$types += $assembly.GetTypes() | ?{
$_.IsPublic -and
!$_.IsEnum -and
!$_.IsAbstract -and
!$_.IsInterface -and
$_.GetConstructor( "Instance,Public", $Null, $Empty, @() )
}

So, you see, this way we only get public, instantiateable, types that have usable constructors ... at one point I was actually limiting it to UIElements, but I found it was nice to be able to create stuff like brushes and other things like the chart-objects from Visifire, etc. ;-)

Now ... the real question is how to get rid of all those cached function files other than to just wipe the whole PowerBoots\Functions folder and start over from scratch :-)

Developer
Aug 25, 2009 at 1:00 AM

Got it, makes sense. Two approaches for the Functions directory. Selectively delete or wipe and copy over the tree.

Thanks Joel

 

Developer
Aug 25, 2009 at 3:45 PM

I selectively deleted the scripts generated by Add-BootsFunction. I passed the DLL names instead.

I did this from ISE. You need to change directories to where the DLLs are in order for it to work.

This resulted in correctly generating the scripts for the NodeXL WPF control.