TheSwamp

Code Red => .NET => Topic started by: Draftek on November 30, 2006, 07:07:52 PM

Title: Highlight a nested block
Post by: Draftek on November 30, 2006, 07:07:52 PM
I can get a nested entity by using the GetNestedEntity() method of the EditorInput object. Which will get me the block that contains it. If I try to highlight the nested block, and not the entire parent block nothing happens.

Anybody how to do this?
Title: Re: Highlight a nested block
Post by: Jeff_M on November 30, 2006, 07:17:23 PM
Quote
Anybody how to do this?
Well, using the old ActiveX API the only way I found to do it was to duplicate the block by adding a temporary insert of the desired block in the appropriate Space and highlight THAT object.
Title: Re: Highlight a nested block
Post by: Draftek on November 30, 2006, 07:22:25 PM
It's werid.

I know I'm getting the correct ObjectId. I've seen the arx sample and I'm thinking maybe it has something to do with the insert not being transformed in the correct space.

Thanks for the reply Jeff.
Title: Re: Highlight a nested block
Post by: Glenn R on November 30, 2006, 07:25:01 PM
Hang on, let me belt something up to look into it.....
Title: Re: Highlight a nested block
Post by: Draftek on November 30, 2006, 07:28:00 PM
thanks. If I don't respond, I am traveling back home with no internet connection until Saturday...
Title: Re: Highlight a nested block
Post by: Glenn R on November 30, 2006, 08:01:14 PM
In my quick look at it, I can't get it to highlight a nested object either...
Title: Re: Highlight a nested block
Post by: Draftek on November 30, 2006, 08:07:48 PM
I can highlight a face on a solid using a similar technique, just not a nested block for some reason...

Thanks for trying.
Title: Re: Highlight a nested block
Post by: Kerry on November 30, 2006, 09:17:59 PM
is the Hilit.CPP code in the SDK relevant and translatable ?
Title: Re: Highlight a nested block
Post by: LE on December 01, 2006, 12:17:30 PM
is the Hilit.CPP code in the SDK relevant and translatable ?

I went, and did a new solution using just the hilitInsert(), and it does not highlight a nested insert - it highlights the main one, and from that, it will go into each of the items from the nested insert.

I did also a new command in C# and was able to highlight normal objects but not items inside of a insert, but was able to get the info from them
Title: Re: Highlight a nested block
Post by: Draftek on December 02, 2006, 08:37:58 AM
Yes, I found hilitInsert in the polysamp project.

Louis - It did work for me as far as highlighting the insert.

I think I will try and wrap it so I can pass an ObjectId from .net.

Thanks guys.

Title: Re: Highlight a nested block
Post by: LE on December 02, 2006, 12:55:00 PM
Luis - It did work for me as far as highlighting the insert.

I taught that you want it to highlight a nested insert - it does the highlight (but as I see it) just the main one... and then it loops trough each item.
Title: Re: Highlight a nested block
Post by: LE on December 02, 2006, 01:09:17 PM
Here is what I wrote in C# - it highlight the top block but not the nested one, but return the ent (nested) - HTH

Code: [Select]
[CommandMethod("TESTSELNEST")]
public void testselnest()
{
    Document doc = acadApp.DocumentManager.MdiActiveDocument;
    Editor ed = doc.Editor;
    Database db = doc.Database;
    PromptEntityResult res = ed.GetEntity("\nSelect a nest object: ");
    if (res.Status != PromptStatus.OK) return;
    using (Transaction tr = db.TransactionManager.StartTransaction())
    {
        ObjectId objId = res.ObjectId;
        AcEd.PromptNestedEntityOptions neOpts = new AcEd.PromptNestedEntityOptions("");
        neOpts.UseNonInteractivePickPoint = true;
        neOpts.NonInteractivePickPoint = res.PickedPoint;
        AcEd.PromptNestedEntityResult neRes = ed.GetNestedEntity(neOpts);
        if (neRes.Status == AcEd.PromptStatus.OK) objId = neRes.ObjectId;
        AcDb.Entity ent = (AcDb.Entity)tr.GetObject(objId, AcDb.OpenMode.ForWrite);
        ObjectId[] objs = neRes.GetContainers();
        foreach (ObjectId id in objs)
        {
            DBObject obj = tr.GetObject(id, OpenMode.ForWrite);
            Entity tmpEnt = (Entity)tr.GetObject(id, OpenMode.ForRead);
            ObjectId[] ids = new ObjectId[1];
            ids[0] = id;
            SubentityId index = new SubentityId(SubentityType.Null, 0);
            FullSubentityPath path = new FullSubentityPath(ids, index);
            tmpEnt.Highlight(path, true);
        }
        tr.Commit();
    }
}

BTW, I do not know why not posting any CODE at all...
Title: Re: Highlight a nested block
Post by: Draftek on December 02, 2006, 10:47:09 PM
Luis - Yes, I want to highlight a nested insert and yes it does highlight the nested insert. - the hilitinsert.cpp arx from the sdk polysamp example.

I can't post code I didn't write.

I will post the solution when I get it working.

I have to work on something else this weekend but I will work on it next week sometime.

Thanks.
Title: Re: Highlight a nested block
Post by: Kerry on December 14, 2006, 02:51:18 AM

Good news :

Kean Walmsley from Autodesk has published one of the responses I received from the ADN in answer to this.


http://through-the-interface.typepad.com/through_the_interface/2006/12/highlighting_an.html

Good to see ! 

... and a mention of theSwamp to boot. !

... ps he thinks I'm a lady, but I've had worse said  ....

/// kwb

Title: Re: Highlight a nested block
Post by: Kerry on December 14, 2006, 03:06:28 AM

The original question of highlighting a nested Block was resolved in another discussion. If Kean does not publish the code I will ask for permission to post it here.

/// kwb

Title: Re: Highlight a nested block
Post by: Draftek on December 14, 2006, 08:08:44 AM
uh, sorry I didn't post that I got the solution from them (ADN).

My bad.

Too busy these days..
Title: Re: Highlight a nested block
Post by: LE on December 14, 2006, 10:42:49 AM
... ps he thinks I'm a lady, but I've had worse said  ....

It got fix now... Kerry

:)
Title: Re: Highlight a nested block
Post by: Kean on December 14, 2006, 11:59:37 AM
I'll go ahead and post the second response, as well, once I've tidied it up a little (tomorrow, I expect).

My apologies, Kerry: as I was growing up, my neighbour had a daughter called Kerry, so that must be why my fingers automatically assumed you were female. Although I've certainly had male friends with the same first name... :roll:

Anyways - as LE says the post has been fixed...

Kean
Title: Re: Highlight a nested block
Post by: Chuck Gabriel on December 14, 2006, 12:23:23 PM
Welcome aboard Kean.
Title: Re: Highlight a nested block
Post by: Kerry on December 14, 2006, 04:01:40 PM
Welcome to theSwamp Kean.

Thanks for posting both solutions. They are both interesting code and solve a real issue.

don't be fussed about the he, she, it thing :-)

Title: Re: Highlight a nested block
Post by: Kerry on December 14, 2006, 04:03:30 PM
uh, sorry I didn't post that I got the solution from them (ADN).

My bad.

Too busy these days..

Just for interest, it may be good to compare solutions ....
Title: Re: Highlight a nested block
Post by: Kean on December 15, 2006, 07:21:15 AM
I've just posted the block highlighting code to my blog:

http://through-the-interface.typepad.com/through_the_interface/2006/12/highlighting_a_.html

Regards,

Kean
Title: Re: Highlight a nested block
Post by: Draftek on December 15, 2006, 08:12:39 AM
Thanks.