Author Topic: Link DCL with lisp  (Read 5812 times)

0 Members and 1 Guest are viewing this topic.

pedroantonio

  • Guest
Re: Link DCL with lisp
« Reply #15 on: October 25, 2019, 08:11:19 AM »
Hi Bigal thanks for the help but this code is not working all the times properly. Some times i have uncheck images and change the images or uncheck the viewports but change the viewports any way. I don;t know why

BIGAL

  • Swamp Rat
  • Posts: 1414
  • 40 + years of using Autocad
Re: Link DCL with lisp
« Reply #16 on: October 26, 2019, 08:48:03 PM »
Just copy this line to command line
(if (not AH:Toggs)(load "Multiple toggles.lsp"))

Then copy this line to command line and look at result (0 1 0 1 0) etc it should match what you tick on.off
(setq ans (ah:toggs   '("Tick off/on " "Blocks" "Dimension" "Hatch" "Images" "Viewports")))

Paste  it again a few times and look at the ( 1 1 1 1 1) etc make sure it matches on is a 1, off is a 0

Let me know if its not changing.
A man who never made a mistake never made anything

PM

  • Guest
Re: Link DCL with lisp
« Reply #17 on: October 30, 2019, 10:40:17 AM »
Hi nice job with this code. I try to do some tests and i see when i paste

Quote
(if (not AH:Toggs)(load "Multiple toggles.lsp"))


Gives me nil
and when i paste
Quote
(setq ans (ah:toggs   '("Tick off/on " "Blocks" "Dimension" "Hatch" "Images" "Viewports")))

gives me  (1 1 1 1 1)("1" "1" "1" "1" "1")


The problem is that i add this lines like you under all lisp

Code: [Select]

(defun c:chlayers ()

(if (not AH:Toggs)(load "Multiple toggles.lsp"))
(setq ans (ah:toggs   '("Tick off/on " "Blocks" "Dimension" "Hatch" "Images" "Viewports")))

(if (= (nth 0 ans) "1") (c:LinkLayerBlock )) ;  Blocks
(if (= (nth 1 ans) "1") (c:DLDL)) ;dimension
(if (= (nth 2 ans) "1") (c:DLHATCH)) ;hatch
(if (= (nth 3 ans) "1") (c:LinkLayerImage)) ;Images
(if (= (nth 4 ans) "1") (c:LV)) ;Viewports
)


and i put the Multiple toggles.lsp in the same folder with the other lisp files i use but when i load  chlayers command the window with te tick not load and i can not understand way

BIGAL

  • Swamp Rat
  • Posts: 1414
  • 40 + years of using Autocad
Re: Link DCL with lisp
« Reply #18 on: October 31, 2019, 01:50:49 AM »
Ok as I wrote this from other routines that look at the actual value not a 1 or 0 worked out what was wrong. The list is backwards explained why not working. Replace this line.

(setq ans (reverse (ah:toggs   '("Tick off/on " "Blocks" "Dimension" "Hatch" "Images" "Viewports"))))
A man who never made a mistake never made anything

PM

  • Guest
Re: Link DCL with lisp
« Reply #19 on: October 31, 2019, 01:07:54 PM »
Hi BIGAL .I check many times the code and all the times viewport layer not change with the first. I need to run the code two times to change viewports. Why?

BIGAL

  • Swamp Rat
  • Posts: 1414
  • 40 + years of using Autocad
Re: Link DCL with lisp
« Reply #20 on: October 31, 2019, 07:41:00 PM »
The last item in the ans list should be "1" ("1" "0" "1" "1" "1") did you change the code including the reverse. if you just click ok with all ticked on should work.

If you copy paste just your LV defun without doing anything else then LV does it work 1st go ?

Really need a dwg to test properly.
A man who never made a mistake never made anything

PM

  • Guest
Re: Link DCL with lisp
« Reply #21 on: November 01, 2019, 04:52:13 AM »
Hi BIGAL. Here is the lisp files i use and a test.dwg. As i said before i select all layers and put them to layer 0. Then i purge the drawing to be clean without unnecessary layers. Then i run the code and i see that the viewport is in the layer 0 and  not in layer viewports. I run the code second time and then the viewport goes to layer viewports. Does this problem come from  LV lisp ?

Thanks

BIGAL

  • Swamp Rat
  • Posts: 1414
  • 40 + years of using Autocad
Re: Link DCL with lisp
« Reply #22 on: November 04, 2019, 12:32:06 AM »
I really do not know all I can say is I have not tested any of your code. I changed the test.lsp to have a Alert at end of each defun so you can see it has been executed. "Alert Dimensions done" etc I also changed (/ on the defuns to ( / in case that was causing a problem.




A man who never made a mistake never made anything