Author Topic: How do i get selectionset with a specific name?  (Read 2265 times)

0 Members and 1 Guest are viewing this topic.

Rusel

  • Guest
How do i get selectionset with a specific name?
« 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,

Gasty

  • Newt
  • Posts: 90
Re: How do i get selectionset with a specific name?
« Reply #1 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

WILL HATCH

  • Bull Frog
  • Posts: 450
Re: How do i get selectionset with a specific name?
« Reply #2 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. }

Rusel

  • Guest
Re: How do i get selectionset with a specific name?
« Reply #3 on: June 02, 2014, 10:03:54 PM »
Thanks,