Author Topic: Running AutoCAD command "script" from vb.net  (Read 4106 times)

0 Members and 1 Guest are viewing this topic.

slappy

  • Guest
Running AutoCAD command "script" from vb.net
« 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.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Running AutoCAD command "script" from vb.net
« Reply #1 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
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

slappy

  • Guest
Re: Running AutoCAD command "script" from vb.net
« Reply #2 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:

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Running AutoCAD command "script" from vb.net
« Reply #3 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
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

slappy

  • Guest
Re: Running AutoCAD command "script" from vb.net
« Reply #4 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.

fixo

  • Guest

vegbruiser

  • Guest
Re: Running AutoCAD command "script" from vb.net
« Reply #6 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*/
 :-)

fixo

  • Guest
Re: Running AutoCAD command "script" from vb.net
« Reply #7 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