Author Topic: Tool palette, Object selection and Event  (Read 24876 times)

0 Members and 1 Guest are viewing this topic.

LE

  • Guest
Re: Tool palette, Object selection and Event
« Reply #45 on: June 07, 2007, 12:45:30 PM »
Did you tested the code of yours modified by me, with the static calls?

I remember seeing something about this in Kean blog... (forgot the name sorry)


And wait for Tony.

T.Willey

  • Needs a day job
  • Posts: 5243
Re: Tool palette, Object selection and Event
« Reply #46 on: June 07, 2007, 12:51:29 PM »
Did you tested the code of yours modified by me, with the static calls?

I remember seeing something about this in Kean blog... (forgot the name sorry)


And wait for Tony.
I didn't test the code you put, but I changed my code to add the static calls like you showed, and it wouldn't compile.  That is when I turned to the book for guidance, and found the quote shown plus an example.

edit:  I also found out how to make it so it's not docked when called.  I had to change the Dock property after the call to make it visible.  In the code I posted I still make it so it can't be docked, which I like, so to change that just comment out the part for 'DockEnabled'.
« Last Edit: June 07, 2007, 12:54:14 PM by T.Willey »
Tim

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

Please think about donating if this post helped you.

LE

  • Guest
Re: Tool palette, Object selection and Event
« Reply #47 on: June 07, 2007, 12:53:11 PM »
ok, I don;t have the solution here with me, and for me works/compile as I posted... :)

FengK

  • Guest
Re: Tool palette, Object selection and Event
« Reply #48 on: June 07, 2007, 12:54:53 PM »
Tim, excuse my newbie question. what do i need to do if i want to test it? i created a windows application project in #D and got an error saying the program "does not contain a static 'Main' method suitable for an entry point" when trying to compile it. Thanks.

T.Willey

  • Needs a day job
  • Posts: 5243
Re: Tool palette, Object selection and Event
« Reply #49 on: June 07, 2007, 01:14:21 PM »
Tim, excuse my newbie question. what do i need to do if i want to test it? i created a windows application project in #D and got an error saying the program "does not contain a static 'Main' method suitable for an entry point" when trying to compile it. Thanks.
I don't think you can use this as a windows application because it has to reference two acad dlls.  Attached is a pic that shows the Acad dll references you need.
Tim

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

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5243
Re: Tool palette, Object selection and Event
« Reply #50 on: June 07, 2007, 01:18:46 PM »
ok, I don;t have the solution here with me, and for me works/compile as I posted... :)
It compiled for me too.  I guess I didn't see all you changed.  Let me see if I can find out what was different from what I did, and and what you posted.  Thanks Luis.  Off to study.  :-)
Tim

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

Please think about donating if this post helped you.

LE

  • Guest
Re: Tool palette, Object selection and Event
« Reply #51 on: June 07, 2007, 01:19:50 PM »
for Kelie ( and any one out there  :-P )

1. You start a new project of a "Class Library"
2. Make two references to acdbmgd.dll and acmgd.dll (using the browse and go to your autocad support installation)
3. Copy the whole code and open the Class.cls and paste the new code in there (remove whatever was created there before)
4. Compile your project
« Last Edit: June 07, 2007, 01:21:12 PM by LE »

FengK

  • Guest
Re: Tool palette, Object selection and Event
« Reply #52 on: June 07, 2007, 01:42:54 PM »
Thanks Tim and LE. It is working now. Neat stuff. :-)

LE

  • Guest
Re: Tool palette, Object selection and Event
« Reply #53 on: June 07, 2007, 01:45:55 PM »
Thanks Tim and LE. It is working now. Neat stuff. :-)

Por nada(for nothing), it is all Tim fault  :-)

T.Willey

  • Needs a day job
  • Posts: 5243
Re: Tool palette, Object selection and Event
« Reply #54 on: June 07, 2007, 01:47:39 PM »
Thanks Tim and LE. It is working now. Neat stuff. :-)
Glad you got it to work.  Watch out with that type of language, you might get hooked also.

Thanks Tim and LE. It is working now. Neat stuff. :-)

Por nada(for nothing), it is all Tim fault  :-)
Na.  You gave better instructions.  :-D And got it to work properly first.
Tim

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

Please think about donating if this post helped you.

TonyT

  • Guest
Re: Tool palette, Object selection and Event
« Reply #55 on: June 07, 2007, 03:51:43 PM »
Hi Tim.

It's not really abou knowing C#, its more about AutoCAD
and MDI, which is something you generally don't have to
contend with when using LISP.

I think you might want to test how your code works when
you switch to a document that has a command already
running in it. E.g., start the LINE command or some other
AutoCAD command, then while it's waiting for input, switch
to another document, then switch back to the one that
has the running command.

Tony, thanks again for your input, I find it invaluable.

Some of what you say makes sense to me, but some has me scratching my head.  I knew I didn't know much about C#, but know I'm finding I know a whole lot less than I thought I did.  I will do some research and see if I can solve this problem, and maybe in doing so I will be able to see if there are any other problems.
« Last Edit: June 07, 2007, 03:59:16 PM by TonyT »

T.Willey

  • Needs a day job
  • Posts: 5243
Re: Tool palette, Object selection and Event
« Reply #56 on: June 07, 2007, 05:47:48 PM »
Tony,

I just did test it, and it worked fine.  I'm not sure why unless there is no current selection for the 'SelectImplied' method of the 'Editor' object.  I tested it with two drawings open, one issued the line command and the other i issued the erase command.  I switched back and forth between them around four times.  I see what you are saying with it though, and I have changed my code to make sure that when switching between existing drawings if a command is running it will return nothing (or exit).

Hi Tim.

It's not really abou knowing C#, its more about AutoCAD
and MDI, which is something you generally don't have to
contend with when using LISP.

I think you might want to test how your code works when
you switch to a document that has a command already
running in it. E.g., start the LINE command or some other
AutoCAD command, then while it's waiting for input, switch
to another document, then switch back to the one that
has the running command.

Tony, thanks again for your input, I find it invaluable.

Some of what you say makes sense to me, but some has me scratching my head.  I knew I didn't know much about C#, but know I'm finding I know a whole lot less than I thought I did.  I will do some research and see if I can solve this problem, and maybe in doing so I will be able to see if there are any other problems.
Tim

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

Please think about donating if this post helped you.

TonyT

  • Guest
Re: Tool palette, Object selection and Event
« Reply #57 on: June 07, 2007, 08:50:27 PM »
Hi Tim.

Have you tried while the STRECH command is running?

Tony,

I just did test it, and it worked fine.  I'm not sure why unless there is no current selection for the 'SelectImplied' method of the 'Editor' object.  I tested it with two drawings open, one issued the line command and the other i issued the erase command.  I switched back and forth between them around four times.  I see what you are saying with it though, and I have changed my code to make sure that when switching between existing drawings if a command is running it will return nothing (or exit).

Hi Tim.

It's not really abou knowing C#, its more about AutoCAD
and MDI, which is something you generally don't have to
contend with when using LISP.

I think you might want to test how your code works when
you switch to a document that has a command already
running in it. E.g., start the LINE command or some other
AutoCAD command, then while it's waiting for input, switch
to another document, then switch back to the one that
has the running command.

Tony, thanks again for your input, I find it invaluable.

Some of what you say makes sense to me, but some has me scratching my head.  I knew I didn't know much about C#, but know I'm finding I know a whole lot less than I thought I did.  I will do some research and see if I can solve this problem, and maybe in doing so I will be able to see if there are any other problems.

FengK

  • Guest
Re: Tool palette, Object selection and Event
« Reply #58 on: June 08, 2007, 03:19:19 AM »
i'm wondering should the editted block be de-selected once you hit "apply change" button? otherwise, i have to hit "ESC" to edit another block. i thought the purpose of of having modeless palette is so that user can continously edit multiple blocks. please enlighten me. thanks.

T.Willey

  • Needs a day job
  • Posts: 5243
Re: Tool palette, Object selection and Event
« Reply #59 on: June 08, 2007, 11:17:17 AM »
Hi Tim.

Have you tried while the STRECH command is running?
With the code now (added a check for commands when switching documents) it works fine with the stretch command invoked.  With the old code it seems to work also.  The only difference is this line.
Old
Code: [Select]
if (!ps.Visible) return;New
Code: [Select]
if (!ps.Visible || string.Compare(AcadApp.GetSystemVariable("CmdActive").ToString(), "0") != 0) return;Within this piece of code
Code: [Select]
public static void onDocBecameCurrent (object sender, DocumentCollectionEventArgs e) {
// if (!ps.Visible || string.Compare(AcadApp.GetSystemVariable("CmdActive").ToString(), "0") != 0) return;
if (!ps.Visible) return;
PromptSelectionResult psr = e.Document.Editor.SelectImplied() as PromptSelectionResult;
if (psr == null) return;
SelectionSet ss = psr.Value as SelectionSet;
if (ss != null && ss.Count > 0) UserControl1.FillInControl(ss.GetObjectIds());
else if (ps.Count > 0) ps.Remove(0);
}

i'm wondering should the editted block be de-selected once you hit "apply change" button? otherwise, i have to hit "ESC" to edit another block. i thought the purpose of of having modeless palette is so that user can continously edit multiple blocks. please enlighten me. thanks.
I think this could be a good idea, but I'm questioning it because the code would have to deselect all objects in the selection set, but that might not be a bad idea.  Let me look into this Kelie.
Tim

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

Please think about donating if this post helped you.