TheSwamp

Code Red => .NET => Topic started by: slappy on February 22, 2011, 12:17:09 PM

Title: Running AutoCAD command "script" from vb.net
Post by: slappy on February 22, 2011, 12:17:09 PM
Anyone have any success with this?

I use the SendCommand on a open acad file.  Now it works fine on some script commands (purge works), however, if I put in AUDIT of SAVEAS it ignores it.  Or more to the point, it will enter the command but will not register that the command was entered.  In the cause of Audit the command line reads:

Command: Audit
Command:

the obvious next option should be
Fix errors Y/N:

On the other side, running the script manually from the command line works fine.

Thanks in advance.
Title: Re: Running AutoCAD command "script" from vb.net
Post by: Keith™ on February 22, 2011, 02:07:01 PM
I know this isn't an answer to your problem, but it will resolve the situation with Audit .... you can remove the message box part and simply run the audit and fix the errors if desired.

Code: [Select]
Public Sub Test()
    If MsgBox("Fix errors?", vbYesNo, "Audit") = vbYes Then
        ThisDrawing.AuditInfo True
    Else
        ThisDrawing.AuditInfo False
    End If
End Sub
Title: Re: Running AutoCAD command "script" from vb.net
Post by: slappy on February 22, 2011, 02:51:58 PM
Hmm, didn't realize Audit would initialize a dialog.  However, in our case audit runs solely from the command line.

I forgot to mention as a part of my class, I also set me filedia to 0 prior to the script run, just to eliminate dialogs.  Of course it's set back after the script.  :ugly:
Title: Re: Running AutoCAD command "script" from vb.net
Post by: Keith™ on February 22, 2011, 04:29:01 PM
Then simply take out the message box part

Code: [Select]
Public Sub Test()
        ThisDrawing.AuditInfo True
End Sub
Title: Re: Running AutoCAD command "script" from vb.net
Post by: slappy on February 22, 2011, 04:58:33 PM
Keith, I understand what you trying to do.  But using a script file allows for me to create dynamic processes that can't be predicted by code.

A little background: I have a batch file processor the does a number of things.  And one of those is to run a script.  It provides a list of script files for users to choose and apply to multiple files.  Anyway long story short, scripts run from my code doesn't act the same as running it manually from the command line.  It probably has more to do with how I access my document object.(interop)  Just have yet to find the key.

Thanks for your suggestions though.
Title: Re: Running AutoCAD command "script" from vb.net
Post by: fixo on February 22, 2011, 05:53:20 PM
See here
https://sites.google.com/site/bushmansnetlaboratory/lab/pof
Title: Re: Running AutoCAD command "script" from vb.net
Post by: vegbruiser on February 23, 2011, 05:55:37 AM
See here
https://sites.google.com/site/bushmansnetlaboratory/lab/pof
That looks like an interesting site fixo - shame it's in russian tho' (Google Translate does a reasonable job with the conversion in Chrome mind you)

/*savedtoreadlater*/
 :-)
Title: Re: Running AutoCAD command "script" from vb.net
Post by: fixo on February 23, 2011, 01:11:11 PM
See here
https://sites.google.com/site/bushmansnetlaboratory/lab/pof
That looks like an interesting site fixo - shame it's in russian tho' (Google Translate does a reasonable job with the conversion in Chrome mind you)

/*savedtoreadlater*/
 :-)


Hi Alex,
Agreed, but just imagine, please, how it
is diificult for me, for example, to understand  English using machine translator say Bing,
or another one, because of I have never learned English at all, just looking at the forum threads,
my bad, of course, but too late to teach an old dog the new tricks , mate..
See algoritms, it's good, trust me