.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DrawJig problem with PaletteSet (Acad2007)

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
270 Views, 2 Replies

DrawJig problem with PaletteSet (Acad2007)

1. Background:

In order to get user input for a Window's two corner points, or get a
circles center point and its radius, I created two DrawJig as my generic CAD
methods used in multiple .NET projects.

The DrawJig was originally created in Acad2006 and they work as expected.

However, the Jig thing is one of the broken compatibility in Acad17.x
(2007,08 and coming 09). That is, in Acad2006, you use JigPromptOptions to
define how Jig prompts user's drag, in Acad2007 (and later),
JigPromptOptions becomes abstract class and you have to use one of the
derived class (JigPromptPointOptions, JigPromptDistanceOptions...). So, I
have to rewrite the code in order for my DrawJig to work in Acad2007. The
rewriting is easy and the code works, well, in all other cases (called from
command line or from a dialog box), but not very well when called from
PaletteSet. To be more accurate, for the purpose of acquiring user input, it
works, but the visual effect are so bad (when called from PaletteSet) that
you hardly see the dragged Window or Circle.

The problem is it only occurs when you use the DrawJig from PaletteSet!

2. Attached:

Attached are an entire VS2005 solution (in C#) of the testing project,
including

The main class: JigTestCommands
A DrawJig class: DrawJig07
A simple Win form to show as DialogBox
A simple Windows User Control to be added into PaletteSet


3. Test and reproduce the situation I described:

The project has been compiled. You can start Acad and NETLoad the
"DrawJig07.dll" directly from "...\bin\debug\" folder. Of you can start the
solution with VS2005, examine the code before you run it.

You can call 4 commands from command line for the test:

a. GetWindow - start GetWindowJig from command line. It works as expected;
b. GetCircle - start GetCircleJig from command line. Works OK;
c. JigForm - Shows a dialogbox with two buttons, which let you pick Window
or Circle in Acad. Works as expected. One additional explanation. I placed
this.Hide() and this.Show() around DrawJig calls. You do not have to do
this. AutoCAD hide the dialogbox automatically when your code need to
interact with Editor. However, the screen flickers with the dialogbox
splashes quickly. I found use this.Hide() and this.Show() prevent this
unpleasant effect.
d. JigPatellte - Shows a PaletteSet hosting a Windows User Control with two
buttons, which call my DrawJig. After the PaletteSet shows, make sure to
undock it (floating Window), because I toggle the PaletteSet.Visible
property during the DrawJig call. Now, click one of the buttons to call
GetWimdowJig or GetCircelJig. You almost could not see the dragged window or
circle. However, the DrawJig still works in the regard of getting user input
(for a window/circle). The other thing to watch is during the drag, Acad is
very busy, even you hold the mouse still. You can observe this by open
Windows' task manager (you may want to set it "Always on top", if you only
has one screen): Acad consuming a lot of CPU percentage during dragging,
even
the mouse is not moving. This heavy CPU usage does not appear when calling
the DrawJig with other three commands.

4. Questions:

Does anyone notice this?

Or can anyone reproduce this? I have tried this with three different
computers/OSs: Win VISTA+AcadMap2007, WinServer2003SP2+AcadMap2007 and Win
XP Pro SP2+Acad2007 (the Video cards are all different), so I am pretty sure
it is not causes by hardware/OS.

I do not have Acad2008 available, can someone test it on Acad2008?

5. The DrawJig code

Anyone, who is interested in the DrawJog07 code, is free to use/copy the
code in all sorts of Acad development, as long as it helps. Giving credit in
you code when use it is preferred, but not required
2 REPLIES 2
Message 2 of 3
caddie75
in reply to: Anonymous

Hi Norman,

I've tried it on AutoCAD 2008, WinXP Pro Sp2:
No problems, not with the commands or from the Palette.

I believe it was '07, I also had problems with Jig's.
I use it for a custom insert command. I've solved it for '07 by using the Jig-actions from a commandMethod. On the palette I just issue the command with SendStringToExecute. (depending on the actions taken)

So if you're going to use '08 no problem, with '07: try to call one of the CommandMethod's from the Palette and see if it solves the problem.

A. Caddie
AutoCAD 2008, WinXP Pro Sp2, VS2005

ps. The "flickering" of the screen still happens, hope they solve it on '09...(unless you have all other windows minimized). The flickering is the last window that becomes active and then the focus goes back to AutoCAD.
Message 3 of 3
Anonymous
in reply to: Anonymous

Thanks for your testing on Acad2008. Our production still uses AcadMap2006,
and has no plan to go to Acad2007 or 2008 or even 2009 right now. It is very
likely we would skip 2007. So, it is kind of relief for me, if it works in
2008 or later.


"caddie75" wrote in message news:5864922@discussion.autodesk.com...
Hi Norman,

I've tried it on AutoCAD 2008, WinXP Pro Sp2:
No problems, not with the commands or from the Palette.

I believe it was '07, I also had problems with Jig's.
I use it for a custom insert command. I've solved it for '07 by using the
Jig-actions from a commandMethod. On the palette I just issue the command
with SendStringToExecute. (depending on the actions taken)

So if you're going to use '08 no problem, with '07: try to call one of the
CommandMethod's from the Palette and see if it solves the problem.

A. Caddie
AutoCAD 2008, WinXP Pro Sp2, VS2005

ps. The "flickering" of the screen still happens, hope they solve it on
'09...(unless you have all other windows minimized). The flickering is the
last window that becomes active and then the focus goes back to AutoCAD.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost