Author Topic: select all objects in a ViewTableRecord  (Read 2145 times)

0 Members and 1 Guest are viewing this topic.

rzandvliet

  • Guest
select all objects in a ViewTableRecord
« on: February 01, 2010, 09:14:13 AM »
Hello,

I have a model that contains multiple named views. I can reach these named views via the ViewTable objects. I can access every view via the ViewTableRecord object. Now I'm trying to select all the Objects (like circle, text, etc) of this named view with C# code. When I have all the objects I want to copy them to another model. I'm able to do this.

Can anybody tell me, how I can select this Objects without user interaction?

Code: [Select]
           
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
         
            // Start a transaction
            using (Transaction acTrans = db.TransactionManager.StartTransaction())
            {
                ViewTable acViewTbl = acTrans.GetObject(db.ViewTableId, OpenMode.ForRead) as ViewTable;

                foreach (ObjectId item in acViewTbl)
                {
                    ViewTableRecord record = acTrans.GetObject(item, OpenMode.ForRead) as ViewTableRecord;
                   
                    // Here I need to select the Objects
                }
            }

MickD

  • King Gator
  • Posts: 3649
  • (x-in)->[process]->(y-out) ... simples!
Re: select all objects in a ViewTableRecord
« Reply #1 on: February 01, 2010, 03:51:40 PM »
I'm a little interested in this myself but I haven't ventured there yet, I was going to take a look at the 'PromptSelectionOptions.SelectEverythingInAperture' flag and see if that works, particularly for clipped views on 3d models.

Are you using 3d model views or just views of 2d areas with the view window size set?
If it's the latter I think the above flag will work for you, let me know how it goes if you give it a try.
"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

T.Willey

  • Needs a day job
  • Posts: 5251
Re: select all objects in a ViewTableRecord
« Reply #2 on: February 01, 2010, 04:55:24 PM »
ViewTableRecord's have a few properties that you would want to use along with a selection set.  You can find all the points you would need, as the VTR has ' center point ', ' width ' and ' height ' which will get you a rectangle, that you can use with a selection set, and you don't have to have user interaction.  Just watch out for different coordinate systems.  Not sure if that will matter, but it might, and that will be the difference between getting what you want, and not.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.