Results 1 to 5 of 5

Thread: Selection set manipulation

  1. #1
    100 Club amaser's Avatar
    Join Date
    2006-05
    Location
    Joliet, IL
    Posts
    105
    Login to Give a bone
    0

    Default Selection set manipulation

    i am trying to modify properties of multiple mtext objects. i have a selection set filter, so only mtext objects are selected by the user. however, when i try and use a For-Each structure,
    the objects in the selection set are all of type OBJECT, when the properties I need to access
    are used when objects are of type MTEXT. how do i specify MTEXT properties on objects of type OBJECT, or how do i modify the selection set so the items selected are MTEXT objects, or how else do i accomplish this?

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,420
    Login to Give a bone
    0

    Default Re: Selection set manipulation

    Its a good idea to show your code when asking for help with it.
    C:> ED WORKING....


    LinkedIn

  3. #3
    I could stop if I wanted to
    Join Date
    2007-08
    Posts
    202
    Login to Give a bone
    0

    Default Re: Selection set manipulation

    Hi

    You can get an ObjectId array from your selection set, then you have to get the Mtext object using a transaction

    Code:
    using (Transaction tr = db.TransactionManager.StartTransaction())
     {
        foreach (ObjectId id in selSet.GetObjectId())
        {
            Mtext mt = tr.GetObject(id, OpenMode.ForWrite) as Mtext
            if (mt != null)
            {
                // do your stuff here
            }
        }
        tr.Commit();
    }

  4. #4
    100 Club amaser's Avatar
    Join Date
    2006-05
    Location
    Joliet, IL
    Posts
    105
    Login to Give a bone
    0

    Default Re: Selection set manipulation

    Quote Originally Posted by 'gile' View Post
    Hi

    You can get an ObjectId array from your selection set, then you have to get the Mtext object using a transaction

    Code:
    using (Transaction tr = db.TransactionManager.StartTransaction())
     {
        foreach (ObjectId id in selSet.GetObjectId())
        {
            Mtext mt = tr.GetObject(id, OpenMode.ForWrite) as Mtext
            if (mt != null)
            {
                // do your stuff here
            }
        }
        tr.Commit();
    }

    that did the trick, though it took me a minute to convert to VB.NET, but that's my fault. Thanks for the help

  5. #5
    All AUGI, all the time
    Join Date
    2003-10
    Posts
    706
    Login to Give a bone
    0

    Default Re: Selection set manipulation

    Just to be clear (for myself and hopefully others), and PLEASE correct me if I'm wrong, but was the original problem the fact the selection set was still just a collection of objects? Even though the filter only allowed for MTEXT objects to be gathered into the set, they're still just objects in a selection set. You still have to go through each object in the set and ask if it's an MTEXT object. If it is, you can then start manipulating the object as an MTEXT object.

Similar Threads

  1. bi-ped manipulation
    By and36rw969741 in forum 3ds Max - General
    Replies: 0
    Last Post: 2011-05-18, 12:39 AM
  2. Data Manipulation?
    By TroyGates in forum NavisWorks - General
    Replies: 3
    Last Post: 2008-06-11, 11:08 PM
  3. Better Void Manipulation
    By narlee in forum Revit Architecture - Wish List
    Replies: 7
    Last Post: 2005-04-04, 02:36 PM
  4. String Manipulation
    By Mike.Perry in forum AutoLISP
    Replies: 2
    Last Post: 2004-10-13, 12:38 PM
  5. SCHEDULE MANIPULATION?
    By WATTSAIA in forum Revit Architecture - General
    Replies: 7
    Last Post: 2004-08-08, 06:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •