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

How can run a user defined command in the middle of autocad line command ?

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
ButterFlyShame
815 Views, 9 Replies

How can run a user defined command in the middle of autocad line command ?

Hello there.

We running a third party application on top of Autocad( Don't have source code of program)
 which have a special line command and line object
(Bunch of Steel info and database attached to this speical line.)
This command is buggy, which  is when user set the snaps and pick the first point of  line for second point the snaps
would loose thier settings all of suddens snaps
goes away and user would loose his settings.
 I  created a command to bring back  saved  snap setting back.
But the problem is by the time user is in the middle of line command how could I execute and run my snap restore command
without intterupting existing command? I just want something like this.
user pick first point, then press a hot key ( like Alt F9) and his setting will be back. and he can pick the second point.

 Any help from experts would be very helpful and already appreciated.

Thaks for looking.

 

9 REPLIES 9
Message 2 of 10
docsaintly
in reply to: ButterFlyShame

I'm sure if someone knows otherwise, they can correct me - but I don't think this is possible.

 

AutoCAD does not allow multiple commands to be executed at the same time.

 

There is a chance you could create a command that would transparently modify the system variable with .Net, but I don't know if this is possible.

Message 3 of 10

All I can say for sure is that the concept is definitely possible, but you may not be able to get it to work with the 3rd party App.  You would use the Transparent command flag on your command, but I think the 3rd party command would also have to have the Interruptable command flag set, and I would bet they don't.

 

I am also sure there are some things you would not be able to do transparently (regen for instance), but that is the mechanism.  I would suggest working up a really simple command (like just writing a message to the command line) with the Transparent flag, and try it during your third party command.  If it works, then spend the rest of the time making the command do what you need it to.

 

Edited:

Oh, and yes, if that works, you could certainly assign a Hot Key to call it transparently.

Dave O.                                                                  Sig-Logos32.png
Message 4 of 10

Thank you both chiefbraincloud  and docsaintly for your time.

 

I didn't know about tranparent thanks for teaching me something new. as  "chiefbraincloud"  suggested I created a custom command to send a message to command line. But it doesn't even work even with regular autocad line command.

  <CommandMethod("hhhh", CommandFlags.Transparent)> _
    Public Sub version1()
        Dim dWG As Document = DocumentManager.MdiActiveDocument
        dWG.Editor.WriteMessage("test")
    End Sub

 In autocad I execute line command , It prompts for first point, Pick  the first point. then I  type "hhhh" to run above code,

and it will exit line command. Am I misssing something or that is the way it should be?

 

 

Message 5 of 10

The Transparent Command flag tells AutoCAD that the command CAN be called transparently, but it can also still be called normally.  To call a command Transparently you put a single quote ('hhhh) in front of the command. 

 

Good idea to try it with the Line command first, so you know if you've got the concept right before trying it with your third party app.

Dave O.                                                                  Sig-Logos32.png
Message 6 of 10

Chief, I didn't know about single quote either. It works. thanks a lot. I really don't know how to make it up to you. This is the second time you saved my job. My family are really thankfull too. Then only thing I could say is God Bless You.

 

 

Message 7 of 10

Thanks, I could probably use the blessing.  I am helpful by nature, and while thanks are appreciated, they are all that would ever be necessary.  I hope you are at least partly joking about your job.

 

For my own curiosity, do you mean it works with the AutoCAD Line command, or that it works with your 3rd party app?

Dave O.                                                                  Sig-Logos32.png
Message 8 of 10

Chief, I am not joking regarding my job. I was laid off 6 months ago. And this company hired me to convert their old vba program to dot net. Because those vba routines in 64 bit machines do not work properly and Autodesk recommended to update those to dot net. I was so desperate to get a job and had to exaggerate regarding my experience regarding Dot net in Autocad and I didn't even know there is not enough documentation in this regard and I got into trouble and found this Forum. That is why even right now at home a 12:45 AM Eastern time I am struggling and trying.

 

Regard with the other question . It worked with that  third party application. And now I am able to bring back snaps.

 

Thanks Again.

 

Message 9 of 10

I was wondering about the Time Zone, I am Mountain Time, almost 11:40P now, was 10:45P when you posted.  It's colder than a well diggers **** in the klondike right now (-20 F).

 

I started as an AutoCAD expert, with LSP and VBA experience, and Engineering education, doing 3D Plumbing design work.  After 2005, I have been programming, first with VBA, but since 2007 I have been working purely with Managed .NET.  There was a learning curve to be sure, but it certainly can be done.

 

I am generally a night owl, and have definitely put in my share of 14-16 hour days while trying to learn new things and meet a deadline.  I feel your pain.

 

If you haven't already found it, (as many of my previous posts have mentioned it) Kean Walmsley's Blog, 'Through the Interface' is a great resource for .NET programming with AutoCAD.  Many of my own issues have been answered by searching the RSS feed for his site.  The first artical was in June 2006, and he has moved up through the current versions of AutoCAD as they were released.

 

This is a link to the first post:

 

http://through-the-interface.typepad.com/through_the_interface/2006/06/welcome.html

 

Somewhere at the upper right of the page is a link to sign up for the RSS feed, and I don't know if it is still available, but when he first created the RSS feed, he had a link to get all of the previous posts hooked in to the RSS feed, so I have a history of every single post in my Outlook, which is searchable.

 

In direct reference to your comment about the documentation, I have mentioned before but will say again that when I find the .NET documentation to be lacking, I have often found the answers I need by looking at the .ARX documentation for the comparable .ARX function that is wrapped by the .NET function.  If you have not already downloaded the ObjectARX SDK then I would suggest you do so.

 

 

 

 

 

Dave O.                                                                  Sig-Logos32.png
Message 10 of 10

Thanks for sharing Chief.

It is a great pleasure to know you. Have a good one.

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