Author Topic: help with instances  (Read 2084 times)

0 Members and 1 Guest are viewing this topic.

lightname

  • Guest
help with instances
« on: August 05, 2008, 07:22:33 AM »
I'd like to have a list with all the instanses of an object.

For example (column is my custom class)

Dim SteelMembers as new collection()
Dim Rightcolumn as new Column
Dim LeftColumn as new Column
SteelMembers.add(RightColumn)
SteelMembers.add(LeftColumn)

Dim mycolumn as new column

for each mycolumn in steelMembers
''Add "RightColumn", "LeftColumn" to the list<-- How Do I get to the name of the instance?
next

Thanks in advance

MickD

  • King Gator
  • Posts: 3640
  • (x-in)->[process]->(y-out) ... simples!
Re: help with instances
« Reply #1 on: August 05, 2008, 07:27:45 AM »
Have a look into ObjectId's, you can only get these once they're added to the drawing database.

So, in your case you need to create or get the steelmembers first by either creating them and adding them or asking the user to select them say, grab there object id's and add them to an objectid collection which comes with the api for acad.

When you want query or modify them you need to OpenForRead/Write then do your mojo.
hth
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

MickD

  • King Gator
  • Posts: 3640
  • (x-in)->[process]->(y-out) ... simples!
Re: help with instances
« Reply #2 on: August 05, 2008, 07:31:33 AM »
For example (column is my custom class)

Looking at this, if they are not acad objects (columns), I'd still look into adding an id property to each object rather than storing them as columns.
You may also wnat to look into ArrayList's or the List<T> type of containers (if available in vb.net).
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien