Hi all!
Help! I would like to know if there is a lisp that would run everytime I run the hatch comand? I have autosave on, but I never remember to do a good clean save before I run hatch. I remember as autocad locks up and crashes! I would like a list that would prompt me to save when I hit hatch with option of yes, save or cancel. is this a tall order?
i always save before i hatch. already a habit. like doing anything extreme i will save first. after crashing a few times without saving then you develop that instinct.
good luck finding someone willing to program one just for you.
set the HPQUICKPREVIEW variable to OFF.
This way you can avoid the delay/crash while entering Hatch command.
You create a custom command to do that using .NET
Here is the solution!
object dwg_obj = cad_app.GetSystemVariable("DBMOD"); // Check the value of DBMOD, if 0 then the drawing has no unsaved changes if (System.Convert.ToInt16(dwg_obj) != 0) { MessageBoxResult result = MessageBox.Show("Do you want to Save your drawing!", "Save Drawing", MessageBoxButton.YesNoCancel, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { Global.variables.db.SaveAs(Global.variables.doc.Name, true, DwgVersion.Current, Global.variables.db.SecurityParameters); //once the save operation is complete you can run the Hatch command SendStringToExecute("HATCH ", true, false, true); } else if (result == MessageBoxResult.Cancel) { return; } }
Let me know if that helps.
No worries, we all started from scratch.
Could you let me know what version of Civil3D or AutoCAD you using.
the following plugin works for 2013 and 2014 ver.
just download the rar file, extract the folder to the following location
more info on install/ uninstall plugins : AutoDesk
then start your AutoCAD and run the command "SAVH"
Let me know how it works.!
Ok, Did you extract the contents of the .zip file.
Do not please the zip file,
extract the contents of the zip to the "Applications plugins" folder.
Then run the command SAVH it should work.
Load the below code and try the Hatch command.
This is just a modification of Lisp reactor from this webpage
(vl-load-com) (vlr-command-reactor nil '((:vlr-commandWillStart . startCommand))) (defun startCommand (calling-reactor startcommandInfo / thecommandstart) (setq acadDocument (vla-get-activedocument (vlax-get-acad-object))) (setq thecommandstart (nth 0 startcommandInfo)) (cond ((= thecommandstart "HATCH") (vla-save acadDocument)(vlax-release-object acadDocument)) ((= thecommandstart "BHATCH") (vla-save acadDocument)(vlax-release-object acadDocument)) );cond (princ) );defun (princ)