Delete a lisp

Delete a lisp

asherjoh
Advocate Advocate
8,545 Views
26 Replies
Message 1 of 27

Delete a lisp

asherjoh
Advocate
Advocate

I tried a recommended lisp this morning and all my duct that I drew (from Fabrication CadMep, a Autodesk add on) disappeared and it won't come back, even with a restart. And the lisp is automatically starting when I restart. Does anyone know how to delete the lisp. Initially, II created the lisp through the command line. 

0 Likes
8,546 Views
26 Replies
Replies (26)
Message 2 of 27

roland.r71
Collaborator
Collaborator

@asherjoh wrote:

I tried a recommended lisp this morning and all my duct that I drew (from Fabrication CadMep, a Autodesk add on) disappeared and it won't come back, even with a restart. And the lisp is automatically starting when I restart. Does anyone know how to delete the lisp. Initially, II created the lisp through the command line. 


You just lost me there...

 

I'll just asume you have a file with the lisp (*.lsp) and used appload to make it load everytime, or you added it to your acaddoc.lsp, instead of typing a lisp routine at the commandline (as that will NEVER "automatically start when you restart")

 

Solution: Remove it

 

So, either comment out the line in acaddoc.lsp with a ; at the front of the line, or remove the (load "your_lispfile.lsp") line.

OR delete it from the startup suite using appload

 

 

Message 3 of 27

asherjoh
Advocate
Advocate

I cut and pasted this lisp at the command line:

 

(defun c:Test (/ data ss en sr)
(if (and (setq en (car (entsel "\nSelect object on reference layer: ")))
(setq sr (ssget "_X" (list (assoc 8 (entget en))))))
(foreach layer '("Water" "Gas" "Electric" "Text" "Dimensions")
(if (and (setq data (tblsearch "LAYER" layer)) ; layer exists
(zerop (logand 4 (cdr (assoc 70 data)))) ; layer unlocked
(setq ss (ssget "_X" (list (cons 8 layer)))) ; layer has objects
)
(command "_.draworder" ss "" "_u" sr ""))))
(princ)
)

 

I have made lisp files before and know where they are stored. I tried looking there through appload and it isn't there. I did a computer search for test.lsp and nothing shows up. And yet my duct does not show up even after a restart and when I type test at the command line, the command is recognized and runs. I use 2017. When I open up my 2016, it does not recognize a test command. I don't know where to go from here. Thank You.

0 Likes
Message 4 of 27

asherjoh
Advocate
Advocate

The duct program will draw new duct in 2017 and will also show the duct from other drawings. 2016 will show duct from the drawing that 2017 won't. Very strange.

0 Likes
Message 5 of 27

Shneuph
Collaborator
Collaborator

If you type in the command line

!C:test

 

Does it return something like :#<SUBR @00000240c8d32f48 C:TEST>

 

If so, what if you put (setq C:test nil)  Then it should undefine the command.

 

Regardless, it is strange behavior for a lisp pasted into the commandline to still be defined after the drawing is closed.  They typically need to be loaded every time a drawing is opened.

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 6 of 27

roland.r71
Collaborator
Collaborator

@asherjoh wrote:

I cut and pasted this lisp at the command line:

 

(defun c:Test (/ data ss en sr)
(if (and (setq en (car (entsel "\nSelect object on reference layer: ")))
(setq sr (ssget "_X" (list (assoc 8 (entget en))))))
(foreach layer '("Water" "Gas" "Electric" "Text" "Dimensions")
(if (and (setq data (tblsearch "LAYER" layer)) ; layer exists
(zerop (logand 4 (cdr (assoc 70 data)))) ; layer unlocked
(setq ss (ssget "_X" (list (cons 8 layer)))) ; layer has objects
)
(command "_.draworder" ss "" "_u" sr ""))))
(princ)
)

 

I have made lisp files before and know where they are stored. I tried looking there through appload and it isn't there. I did a computer search for test.lsp and nothing shows up. And yet my duct does not show up even after a restart and when I type test at the command line, the command is recognized and runs. I use 2017. When I open up my 2016, it does not recognize a test command. I don't know where to go from here. Thank You.


That's extremely weird behaviour.

Any lisp code pasted at the commandline, will only be active for the drawing opened at that time. Close the drawing and the routine is gone.

Open another drawing and the routine will NOT work there. (until you paste the code, again)

 

so... somehow the code did end up in a file or something and gets loaded. Which should not happen with a mere copy/paste.

Message 7 of 27

roland.r71
Collaborator
Collaborator

The problem is definately not with the function code. (which i could already tell looking at the code, but to be sure i gave it a testrun)

 

Just pasted it into acad2014, executed "TEST". Asking for object.

Closed the drawing, opened another, executed "TEST", which gets me nothing but BTESTBLOCK.

 

Just like it should.

 

I can't test with 2017, so there's still some "unknown" possibility there, as i don't know if it has some kind of option to autosave any custom (lisp) commands you define.

0 Likes
Message 8 of 27

asherjoh
Advocate
Advocate

C:TEST> says Unknown command yet when I type it, it is recognized. (setq c:test nil) didn't delete it. Fortunately, I only lost an hour of drawing work. And it does allow me to draw new ductwork. But strange that 2016 shows the duct. It just hints that the lisp is directly for the duct not showing in 2017. Thanks 

0 Likes
Message 9 of 27

asherjoh
Advocate
Advocate

I also tried to redefine the test command by doing this lisp at the command line:

 

(defun C:test (/ dist); = Distance in Feet/inches and in [just] Inches
(command "_.dist" pause pause); User get distance points
 (setq dist (getvar 'distance))
(prompt (strcat "\nDistance = " (rtos dist 4) " or " (rtos dist 5) "\"."))
(princ)
); defun

It didn't work. 

0 Likes
Message 10 of 27

roland.r71
Collaborator
Collaborator

it's getting stranger by the post... Smiley Tongue

 

Command: TEST

Select object on reference layer:

Command:

Command: !c:test
#<SUBR @00000000340cd688 C:TEST>

Command: (setq c:test nil)
nil

Command: !c:test
nil

Command: TEST

Unknown command name.

If you don't get the above result... you probably should contact customer support or something, or wait for a real expert to have a look at it.

0 Likes
Message 11 of 27

asherjoh
Advocate
Advocate
It does say Select object on reference layer. I will have to try the rest on Monday. Thanks.
0 Likes
Message 12 of 27

scot-65
Advisor
Advisor
Our IT team here had figured out how to
load files using the registry as the path holder
- similar to the window's startup section.

Perhaps finding the key/data and removing that?
HKLM Software(?)

You did not specify if you are reopening the file
or restarting AutoCAD with a "blank" file (or one
that never had the program run)?

If same file, search for "PDI" in this forum and try it.
Purge Dictionary Items.

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

Message 13 of 27

asherjoh
Advocate
Advocate
Yes, I have restarted cad with restarting the computer with a fresh drawing. I had done the "test" lisp routine with 2017 and 2018. They both have the same issue with the duct disappearing. I did not do it with 2016 and it shows the duct. Your suggested solution is a little over  my head currently. I with have read up on it. Thanks
0 Likes
Message 14 of 27

devitg
Advisor
Advisor

I always wonder, image, ask the oracle, scratch my head, take a walk, what ever I can  do. Asking, question, or why to use a so ambiguous, absurd, nonsense name for a LISP  command as TEST, FOO, and so on . 

 

Maybe the TEST , invoke other lisp, or   this line  hide all ss under sr  

 

(command "_.draworder" ss "" "_u" sr ""))))

Just thinking,  

 

Message 15 of 27

roland.r71
Collaborator
Collaborator

@devitg wrote:

I always wonder, image, ask the oracle, scratch my head, take a walk, what ever I can  do. Asking, question, or why to use a so ambiguous, absurd, nonsense name for a LISP  command as TEST, FOO, and so on . 

 

Maybe the TEST , invoke other lisp, or   this line  hide all ss under sr  

 

(command "_.draworder" ss "" "_u" sr ""))))

Just thinking,  

 



I think you just nailed it. (as far as the 'dissapeared duct' goes anyway)

 

I'm having a hard time believing this copy/pasted TEST function to be still active.

...but it's "effect" still is.

Message 16 of 27

devitg
Advisor
Advisor

We in Spanish have a say 

 

Las brujas no existen , pero que las hay, las hay.

 

The: crone, hag, sorceress, witch, shrew, vixen, termagant, battle-axe, battleax, battleaxe, bag, baggage, trout, old hag, moth,bitch

do not exist , but it  are , yes it  are. 

 

Message 17 of 27

asherjoh
Advocate
Advocate
I guess one could pull a word our of a hat, and name the lisp that.🤔
0 Likes
Message 18 of 27

asherjoh
Advocate
Advocate
Just to be clear, this lisp was supposed to allow me to put one layer over another with a couple clicks of the mouse. If anyone can read it, does it look like that's what it does? Plus I don't know why it says water, gas and electric. Guess I learned my lesson that lisps can cause problems if you don't know what your doing.
0 Likes
Message 19 of 27

roland.r71
Collaborator
Collaborator

@asherjoh wrote:
Just to be clear, this lisp was supposed to allow me to put one layer over another with a couple clicks of the mouse. If anyone can read it, does it look like that's what it does? Plus I don't know why it says water, gas and electric. Guess I learned my lesson that lisps can cause problems if you don't know what your doing.

it does.

The function should put the entities on the layers Water, Gas, Electric, Text and/or Dimensions under any entities on the same layer as the selected entity.

...so it's a bit strange that you don't know why it uses those specific layer names. Since only those will be affected. (& i wonder what happens if the selected entity is on one of those layers ... )

 

I'll try to explain the function's inner workings...

 

(if (and (setq en (car (entsel "\nSelect object on reference layer: ")))

- here it askes to select an object/entity (& the function will only continue if there is an object selected)


(setq sr (ssget "_X" (list (assoc 8 (entget en))))))

- here it retrieves the entities on the same layer as the selected one (DXF code 8 = layername)


(foreach layer '("Water" "Gas" "Electric" "Text" "Dimensions")

- here it repeats the following code for each layername given. So: Water Gas Electric Text & Dimensions are the only layers affected


(if (and (setq data (tblsearch "LAYER" layer)) ; layer exists

- as the comment states, here it checks if the layer (water, gas, etc.) realy exists


(zerop (logand 4 (cdr (assoc 70 data)))) ; layer unlocked

- As the comment states, here it checks if the layer is unlocked


(setq ss (ssget "_X" (list (cons 8 layer)))) ; layer has objects

- here it retrieves any entities on that layer

 

)

- end of conditions (if)

- so the next line only executes when the layer (Water, Gas, etc.) exists, is unlocked & has entities


(command "_.draworder" ss "" "_u" sr ""))))

- here it will change the draworder for all entities from selection set "ss" (the entities on layer Water/Gas/etc.)

- UNDER the entities from selection set "sr" (the entities on the same layer as the selected entity

 

(princ)

- supresses nil
)

- end of the repeating code for each layer (Water/Gas/etc.)

 

Message 20 of 27

asherjoh
Advocate
Advocate
I was referred to this lisp and didnt realized there were custome layer instuctions in the lisp. I dont use anay water, gas or electric layers in my drawings. I was just looking to just looking for a lisp to put one layer above another, but not have the layer change in relation to all the other layers as draworder/send to back does. I had read some tutorials and seen Lynn Allen's (Cadalyst) tutorials on lisp. I know that cad commands are instructed yo do something when conditions are this or that. But I still don't understand enough to wright anything. I basically use slow time at work research it. Thank you for your explanation.
0 Likes