I'm Confused: Startup LISP is running _HELP in command line on its own

I'm Confused: Startup LISP is running _HELP in command line on its own

eharrisonTZS2M
Enthusiast Enthusiast
614 Views
7 Replies
Message 1 of 8

I'm Confused: Startup LISP is running _HELP in command line on its own

eharrisonTZS2M
Enthusiast
Enthusiast

I have a custom LISP file listed below...Normally, I manually run this command, but there are times I want it to run on Startup and blast through hundreds of files one after the other...so, I put ";;" in front of my "defun c:G ()", and remove it from in front of "(defun-q S::STARTUP()". Then, using Windows Powershell, I run a command to open all the DWG files I need this LISP command to run in. The problem I am having is when the STARTUP runs my command, for some reason, it's tossing the _HELP command in between the commands in my LISP file. Now, my command will continue and process as it should, but every time a new file is ran, the Help menu opens and closes at the end of my custom LISP. I do NOT have this issue when I run the LISP manually. Can anyone give me a pointer to how to keep this from happening?

CUSTOM LISP

;;(defun-q S::STARTUP()
(defun c:G ()
;; Delete DEFPOINTS layer if it exists
(if (tblsearch "LAYER" "DEFPOINTS")
(command "_.LAYDEL" "N" "DEFPOINTS" "" "YES")
)

;; Select objects on layer "0"
(setq ss (ssget "_X" '((8 . "0"))))

;; Delete selected objects
(if ss
(command ".erase" ss "" "")
)
(command "purge" "A" "*" "N")
(command "UCS" "W")
(command "-VIEW" "SW")
(command "ZOOM" "_E")
(command "VSCURRENT" "R")
(command "VSEDGES" "0")
(command "VSCURRENT" "2")
(command "OSMODE" "0")
(command "-LAYER" "M" "" "")
(command "_point" "0,0,0")
;;(command "._QSAVE")
(vla-saveas (vla-get-activedocument (vlax-get-acad-object))
(strcat (getvar 'dwgprefix)
(if (getvar 'dwgtitled)
(getvar 'dwgname)
"Drawingname"))
ac2004_dwg)
;;(command "OSMODE" "11")
;;(princ "\nVERY GOOD!")
;;(princ)
(command ".CLOSE")

);END

 



AUTODESK COMMAND LOG

[ AutoCAD - Wed Jul 17 11:33:25 2024 ]----------------------------------------

 

Opening an AutoCAD 2004/LT 2004 format file.
Regenerating model.


AutoCAD menu utilities loaded.
Command:

Autodesk DWG. This file is a TrustedDWG last saved by an Autodesk application or Autodesk licensed application.

Command:

Command: .erase
Select objects: 1 found

Select objects:
Command: _HELP  <-----------------------------------------WHY?????

Command: purge
Nested items = Off Orphaned data = Off
Enter type of unused objects to purge [Blocks/DEtailviewstyles/Dimstyles/Groups/LAyers/LTypes/MAterials/MUltileaderstyles/Plotstyles/SHapes/textSTyles/Mlinestyles/SEctionviewstyles/Tablestyles/Visualstyles/Regapps/Zero-length geometry/Empty text objects/Orphaned data/All]: A Enter name(s) to purge <*>: * Verify each name to be purged? [Yes/No] <Y>: N
No unreferenced blocks found.

No unreferenced layers found.

No unreferenced linetypes found.

No unreferenced text styles found.

No unreferenced shape files found.

No unreferenced dimension styles found.

No unreferenced mlinestyles found.

No unreferenced plotstyles found.

No unreferenced table styles found.

No unreferenced materials found.

No unreferenced visual styles found.

No unreferenced multileader styles found.

No unreferenced groups found.

No unreferenced Detail view styles found.

No unreferenced Section view styles found.

Command: UCS
Current ucs name: *WORLD*
Specify origin of UCS or [Face/NAmed/OBject/Previous/View/World/X/Y/Z/ZAxis] <World>: W
Command: -VIEW Enter an option [?/Delete/Orthographic/Restore/Save/sEttings/Window]: SW Regenerating model.

Command: ZOOM
Specify corner of window, enter a scale factor (nX or nXP), or
[All/Center/Dynamic/Extents/Previous/Scale/Window/Object] <real time>: _E
Command: VSCURRENT
Enter an option [2dwireframe/Wireframe/Hidden/Realistic/Conceptual/Shaded/shaded with Edges/shades of Gray/SKetchy/X-ray/Other] <2dwireframe>: R
Command: VSEDGES
Enter new value for VSEDGES <1>: 0
Command: VSCURRENT
Enter an option [2dwireframe/Wireframe/Hidden/Realistic/Conceptual/Shaded/shaded with Edges/shades of Gray/SKetchy/X-ray/Other/cUrrent] <Current>: 2 Regenerating model.

Command: OSMODE
Enter new value for OSMODE <0>: 0
Command: -LAYER
Current layer: "0"
Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile/Xref]: M
Enter name for new layer (becomes the current layer) <0>: Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile/Xref]:
Command: _point
Current point modes: PDMODE=0 PDSIZE=0.000
Specify a point: 0,0,0
Command: .CLOSE
Command: ; error: Function cancelled

0 Likes
Accepted solutions (1)
615 Views
7 Replies
Replies (7)
Message 2 of 8

cadffm
Consultant
Consultant
Accepted solution

Hi 

 

Startup or not, there is one enter("") too much

(command ".erase" ss "" "")

 

 

 

Sebastian

0 Likes
Message 3 of 8

Moshe-A
Mentor
Mentor

@eharrisonTZS2M  hi,

 

found 2 problems:

 

first

(command ".erase" ss "" "")  ; you have extra "" and maybe this causes the invocation of HELP.

 

second

(getvar 'dwgtitled) return 0/1 you must check for 0 or 1 it doesn't return T/nil

 

Moshe

0 Likes
Message 4 of 8

Sea-Haven
Mentor
Mentor

Have you looked at Acoreconsole it can be used in a batch file carrying out a lisp edit on say 100 dwg's. You just need to call a script, but the script just has 1 line a "(load "mylisp") the lisp to carry out all your functions. The advantage is that the dwg database is edited without opening the dwg. 

 

https://through-the-interface.typepad.com/through_the_interface/2012/02/the-autocad-2013-core-consol...

 

@paullimapa has a great post about using accoreconsole, he will probably post link.

0 Likes
Message 5 of 8

paullimapa
Mentor
Mentor

@eharrisonTZS2M here's where you can read up more on accoreconsole:

Son of a Batch! AutoCAD Core Console Through Lisp | House of BIM


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 6 of 8

eharrisonTZS2M
Enthusiast
Enthusiast

my IT department won't allow the use of Batch files, thus my work around with Powershell to open the files and have the LISP run on startup.

0 Likes
Message 7 of 8

eharrisonTZS2M
Enthusiast
Enthusiast

@cadffm that fixed it! thanks!

0 Likes
Message 8 of 8

paullimapa
Mentor
Mentor

I’m surprised your IT department allows for Piwershell but not batch files. But perhaps they don’t know you’re running Powershell?  There are other methods to open multiple dwgs if you’re interested:

1) Lee Macs Script Writer lisp app

2) AutoScript which is an arx application meaning may require a separate app for different AutoCAD versions

I even have lisp routines that create batch files on the fly to run accoreconsole 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes