Author Topic: Need a CrashACAD program/technique  (Read 6682 times)

0 Members and 1 Guest are viewing this topic.

laidbacklarry

  • Guest
Need a CrashACAD program/technique
« on: September 19, 2012, 11:08:11 AM »
Well, I guess I could just unplug the system, but that would lead to lengthy restarts. I'd like to be able to crash ACAD to explore the various files left after a crash. Need to write a tech bulletin on recovering from a combined power outage and bad UPS battery. Any ideas?

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Need a CrashACAD program/technique
« Reply #1 on: September 19, 2012, 11:14:49 AM »
Use it in a production environment on a high priority project with immediate delivery deadline -- the "mission critical detector" should cause it to crash promptly.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Drafter X

  • Swamp Rat
  • Posts: 578
Re: Need a CrashACAD program/technique
« Reply #2 on: September 19, 2012, 11:19:32 AM »
well... yank the plug out of the wall with no UPS, should simulate it pretty well I would think.  :lol:
CadJockey Militia Commander

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Need a CrashACAD program/technique
« Reply #3 on: September 19, 2012, 11:25:58 AM »
Terminate the acad process in the task manager?

Drafter X

  • Swamp Rat
  • Posts: 578
Re: Need a CrashACAD program/technique
« Reply #4 on: September 19, 2012, 11:45:23 AM »
Terminate the acad process in the task manager?

And yeah, then there is the boring way.
CadJockey Militia Commander

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Need a CrashACAD program/technique
« Reply #5 on: September 19, 2012, 11:45:53 AM »
Terminate the acad process in the task manager?

And yeah, then there is the boring way.

 :lol:

Chris

  • Swamp Rat
  • Posts: 548
Re: Need a CrashACAD program/technique
« Reply #6 on: September 19, 2012, 01:11:33 PM »
Personally, I prefer MP's method
Christopher T. Cowgill, P.E.
AEC Collection 2020 (C3D)
Win 10

Drafter X

  • Swamp Rat
  • Posts: 578
Re: Need a CrashACAD program/technique
« Reply #7 on: September 19, 2012, 01:20:33 PM »
I cant tell you how many times I have been tempted to combine MP's method and my own, its that little evil thing in my head that says
'you could just reach out and yank that power cord'
So far I have resisted..

... so far
CadJockey Militia Commander

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Need a CrashACAD program/technique
« Reply #8 on: September 19, 2012, 01:33:26 PM »
Lulz aside you can use the Process.Kill function available in the .NET runtime (TerminateProcess in Win32 if memory serves) or if you don't want to roll yer own I think there's a KillProcess type function in DOSLIB.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Need a CrashACAD program/technique
« Reply #9 on: September 19, 2012, 03:52:46 PM »
VBScript to kill a process.

Why vbscript? Because it's dead simple to convert vbscript code to lisp. Look around the swamp (search the swamp for "WbemScripting.SWbemLocator") and you should find lots of examples. Here's a quick, read UNTESTED, attempt to translate to lisp.

Code: [Select]
(defun _KillProcess ( name / wmiLocater wmiService queryResult result )

    ;;================================================================
    ;;
    ;;  2012/09/19 | Quick & Dirty | Michael Puckett
    ;;
    ;;  UNTESTED: USE AT YOUR OWN FCKUING RISK
    ;;
    ;;  e.g. (_KillProcess "notepad.exe")
    ;;----------------------------------------------------------------
   
    (vl-load-com)

    (vl-catch-all-apply
       '(lambda ( )
            (vlax-for item
                (setq queryResult
                    (vlax-invoke
                        (setq
                            wmiLocater (vlax-create-object "WbemScripting.SWbemLocator")
                            wmiService (vlax-invoke wmiLocater 'ConnectServer "." "root\\cimv2")
                        )
                       'ExecQuery
                        (strcat
                            "SELECT * FROM Win32_Process WHERE Name = '"
                            name
                            "'"
                        )
                    )
                )   
                (vlax-invoke item 'Terminate)
                (setq result T)
            )
        )
    )
   
    (if queryResult (vlax-release-object queryResult))
    (if wmiService (vlax-release-object wmiService))
    (if wmiLocater (vlax-release-object wmiLocater))

    result

)

e.g. (KillProcess "notepad.exe")

Cheers.

Edit: Fixed a couple trivial typos.
« Last Edit: September 19, 2012, 04:49:56 PM by MP »
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Need a CrashACAD program/technique
« Reply #10 on: September 19, 2012, 04:28:34 PM »
Quote
;;  UNTESTED: USE AT YOUR OWN FCKUING RISK
  :lmao:

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Need a CrashACAD program/technique
« Reply #11 on: September 20, 2012, 11:23:39 AM »
Keep in mind the simplistic function I posted is indiscriminant -- it will attempt to kill all instances matching the argument name.

In the case of a desired suicide, i.e. (_KillProcess "acad.exe"), it would be better to dermine the ProcessID (PID) of the current instance (probably via the HWND), and then kill the process by said PID, i.e. ... (strcat "SELECT * FROM Win32_Process WHERE ProcessID = " process_id) ... etc.

As penned, (_KillProcess "acad.exe") would merely try to kill all instances of "acad.exe", and if there is more than one running instance there's high probability an "innocent" instance would be terminated before the current desired instance. While a fun challenge I've other fish to fry at present; enjoy.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

laidbacklarry

  • Guest
Re: Need a CrashACAD program/technique
« Reply #12 on: September 20, 2012, 12:37:56 PM »
MP - Thanks, I'll test it on an old, really old, laptop later. Will let you know results... hey, I knew this would provide a little fun, but it really may be useful...

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Need a CrashACAD program/technique
« Reply #13 on: September 20, 2012, 01:00:33 PM »
Your welcome, thanks, and have fun. :)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Need a CrashACAD program/technique
« Reply #14 on: September 20, 2012, 01:28:37 PM »
If you want a proper crash, rather than just terminating the program, how about an exponential copy routine?  Draw a circle (or create a complex 3D solid); copy it, for two; copy those two, for four; copy those four, for eight; repeat until AutoCAD screams for mercy.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}