TheSwamp

Code Red => .NET => Topic started by: Rusel on June 01, 2014, 09:21:30 PM

Title: How do i get selectionset with a specific name?
Post by: Rusel on June 01, 2014, 09:21:30 PM
Hello,
I am new to .net and used vba for years.
In vba I was creating a selectionset with a name in a sub and able to get it somewhere else with its name and use it like:

Dim Sset As SelectionSet = doc.SelectionSets.Item("myselectionset")

How can I do this in .net?
Thanks,
Title: Re: How do i get selectionset with a specific name?
Post by: Gasty on June 01, 2014, 11:30:08 PM
Hi,

Why do you need a name?, the managed API selection set class hasn't a name property for an instance of a selection set. You have a variable which contains the selection set, that's it.

Gaston Nunez
Title: Re: How do i get selectionset with a specific name?
Post by: WILL HATCH on June 02, 2014, 01:27:09 AM
You'd need to create an object to hold all the selection sets, if you don't need this defined outside of the current document scope then just add a dictionary to your command class. If you need it shared across documents then declare it static.
Code - C#: [Select]
  1. public Commands
  2. {
  3.    Dictionary<string, SelectionSet> SelectionSets = new Dictionary<string, SelectionSet>();
  4.  
  5.    public void DoStuff()
  6.    {
  7.       ~~~
  8.       SelectionSet ss = ed.GetSelection();
  9.       SelectionSets.add("DoStuffSet",ss);
  10.       ~~~      
  11.    }
  12.    public void DoThings()
  13.    {
  14.       ~~~
  15.       SelectionSet ss = SelectionSets["DoStuffSet"];
  16.       ~~~  
  17.    }
  18. }
Title: Re: How do i get selectionset with a specific name?
Post by: Rusel on June 02, 2014, 10:03:54 PM
Thanks,