Jump to content

Recommended Posts

Posted

so i have a custom .lsp file that was set up for me, and it has been normally working fine for me. i have noticed over the last few months (updated to AutoCAD 2019) the polar tracking will turn off from time to time, and normally when i run the command for this custom lisp to get it to turn back on, and now it no longer is turning that back on. is there anyone that can take a look at this for me and let me know if there is something wrong with the set up of the lisp or is there something else that is wrong? 

 

it seems that i have to open up appload and reload it each time in order for the polar tracking to turn on. or just simply hit F10. 

 


(defun c:K ()
  (setvar "POLARMODE" 0)
  (setvar "osmode" 551)
  (setvar "POLARANG" (angtof "15"))
)
;;when you type K, it resets your osnaps to your custom setting

;;Custom Routines

	(defun c:C0 () (command "_copybase" "0,0") )
	(defun c:V0 () (command "_pasteclip" "0,0") )
	(defun c:V0B () (command "_pasteblock" "0,0") )
	(defun c:ZZ () (command "layfrz") )

(load "_RC-CLOUDS")
(defun c:KL () (load "_KL") (C:KL))
;;DRAW BACKWARDS 3-POINT LEADER
(defun c:T2MT () (load "T2MT-MT2T") (C:T2MT))
;;TEXT TO MTEXT
(defun c:VB () (load "_VB") (C:VB))
;;VIEWPORT BOX IN MODELSPACE
(defun c:XRR () (load "XRR") (C:XRR))
;;XREF RELOAD
(defun c:XRV () (load "XRV") (C:XRV))
;;XREF RELOAD WITH VISRETAIN
(defun c:XRU () (load "XRU") (C:XRU))
;;XREF DETACH
(defun c:explodable () (load "explodable") (C:explodable))
;;explodable
(defun c:cleanbase () (load "cleanbase") (C:cleanbase))
;;Clean base drawing
(defun c:cleantitle () (load "cleantitle") (C:cleantitle))
;;Clean title drawing

	(Defun c:ERD () (load "_ERD") (c:ERD))
	(Defun c:ERH () (load "_ERD") (c:ERH))
	(Defun c:ERT () (load "_ERD") (c:ERT))

(Defun C:QS () (command ".qsave") (princ))
(defun c:read ()
  (defun c:qs () (alert "NO! NO! NO! NO! NO! NO!"))
)


(defun c:Dave()
(load "_0Dave.lsp")
  (alert
    "Dave - list of commands \nK - Your ACAD Defaults \nQS - Quick Save \nERH Erase Hatch \nMA Match Properties
        \nREAD - removes Quick Save command \nKL - Draw backwards three point leader \nCleantitle - Clean title drawing \nCleanBase - Clean base drawing
        \nRCC - Rev Cloud Sketch \nRCB - Rev Cloud Block")
)

(print "Dave Lisp Loaded Successfully!")
(princ)

(defun c:MA () (COMMAND "MATCHPROP") )
;;XREF DETACH

 

being that the command is "K" one would think that it would turn back on the polar tracking. it turns everything else that i need back on just not the polar tracking. i have tried changing the (setvar "POLARMODE" 0) to a 1 or a 2 and that doesnt seem to want to work. i have also tried to change (setvar "POLARMODE" 0) to either of these (setvar "autosnap" (boole 7 (getvar "autosnap") 8));polar on  (setvar "autosnap" (boole 2 (getvar "autosnap") 8));ploar off  and that doesnt seem to want to get it to work either. 

 

 

so the command that i really use this for is the osnaps getting set back to the ones that i like to use. it has been helpful to have the polar tracking to be turned on also but i just cant seem to get it to turn back on. 

 

any help? all thoughts are welcomed and thanked.

 

Posted

The System Variable POLARMODE controls the settings for polar and object snap tracking. It does not turn it on.

 

Have you checked to see whether Ortho is on? I have found that when enabling Ortho, polar tracking is switched off.

Posted
13 minutes ago, eldon said:

The System Variable POLARMODE controls the settings for polar and object snap tracking. It does not turn it on.

 

Have you checked to see whether Ortho is on? I have found that when enabling Ortho, polar tracking is switched off.

 

after playing around with it, that is what i figured out that polarmode does. and yes i did check to see if ortho was on or not. and it isnt. this just randomly turns off for no reason. that is why i am just at a loss as to why it is doing this. 

Posted (edited)

But if in your working, Ortho is turned on (manually or programmatically), this automatically turns off Polar. If Ortho is then turned off, then Polar is not automatically turned on again. It has to be specifically turned on.

 

 

Edited by eldon
Posted
16 minutes ago, eldon said:

But if in your working, Ortho is turned on (manually or programmatically), this automatically turns off Polar. If Ortho is then turned off, then Polar is not automatically turned on again. It has to be specifically turned on.

 

 

that is correct. but when you load this lisp into your drawing, it turns on polar tracking (F10) and then it will randomly turn it off. it wont turn on ortho and i will not turn it on. both will be off. so i have to hit F10 to turn it back on or reload the lisp routine. 

Posted (edited)
8 minutes ago, dnovember99 said:

that is correct. but when you load this lisp into your drawing, it turns on polar tracking (F10) and then it will randomly turn it off. it wont turn on ortho and i will not turn it on. both will be off. so i have to hit F10 to turn it back on or reload the lisp routine. 

I would guess that this variable is being changed in one of the other lisp routines that are loaded. Do a search within your lisp files for 'autosnap' and see if you can track down the culprit.

Edited by ronjonp
Posted
2 hours ago, ronjonp said:

I would guess that this variable is being changed in one of the other lisp routines that are loaded. Do a search within your lisp files for 'autosnap' and see if you can track down the culprit.

for the life of me i cannot find it! now the lisp routines that i use are the ones that i checked. 

 

the company that i work for has about 375 lisp files that are randomly used though-out the company. that is going to be crazy to find that. 

Posted (edited)

Index your lisp files to have a plain text filter like so. Then you can search easy peasy :)

 

2019-01-03_11-40-50.png

 

You could also enable the sysvar monitor depending on the version of AutoCAD you're using:

 

2019-01-03_14-29-05.png

Edited by ronjonp
Posted
9 minutes ago, ronjonp said:

Index your lisp files to have a plain text filter like so. Then you can search easy peasy :)

 

2019-01-03_11-40-50.png

UGH!!!! my company has locked that down! they want to see me suffer! lol

Posted

I usually use Total Commander to search for a string.

But just for fun quickly pasted something together if you don't mind the messy coding

 


(defun c:tst ( / txt fol lst done data result-list)
  (if (and (setq search-string (getstring "\nString to search : "))
    (not (eq search-string ""))
    (setq fol (getfolder "Lisp folder")))
    (progn
      (princ "\nCollecting data files , this can take a few moments / minutes ...")
      (if (setq lst (_GetAllFiles fol t "*.lsp"))
 (princ (strcat "\nStart processing files (" (itoa (length lst)) ") ...")))
      (foreach file lst
 (setq done nil)
 (if (setq fp (open file "r"))
   (progn
     (while (and (not done) (setq data (read-line fp)))
       (if (wcmatch (strcase data) (strcase (strcat "*" search-string "*")))
  (setq result-list (cons file result-list) done t)))
     (close fp)
   )
 )
      )
    )
    (princ "\nBad string or folder.")
  )
  (if result-list
    (prl result-list)
    (if (and search-string (not (eq search-string "")))
      (princ (strcat "\nSearch string " search-string " not found"))
    )
  )
  (terpri)
  (princ)
)

; from master Lee
(defun _GetAllFiles ( Dir Subs Filetype / _GetSubFolders )
  (defun _GetSubFolders ( folder ) (apply 'append (mapcar (function (lambda ( f ) (cons (setq f (strcat folder "\\" f)) (_GetSubFolders f))))
      (vl-remove "." (vl-remove ".." (vl-directory-files folder nil -1))))))
  (apply 'append (mapcar (function (lambda ( Filepath ) (mapcar (function (lambda ( Filename ) (strcat Filepath "\\" Filename)))
          (vl-directory-files Filepath Filetype 1)))) (cons Dir (if subs (_GetSubFolders Dir))))))
(defun getfolder ( msg / fl sh )
  (if (and (setq sh (vlax-create-object "Shell.Application")) (setq fl (vlax-invoke sh 'browseforfolder 0 msg 0 "")))
    (setq fl (vlax-get-property (vlax-get-property fl 'self) 'path))(setq fl nil))(release_me (list sh)) fl)

(defun release_me (lst)
  (mapcar '(lambda (x) (if (and (= 'vla-object (type x))(not (vlax-object-released-p x)))(vlax-release-object x))(set (quote x) nil)) lst))

(defun prl (lst)(terpri)(mapcar '(lambda(x)(princ "\n")(princ x)) lst)(terpri)(princ))

(vl-load-com)

(princ)

gr. Rlx

Posted
4 hours ago, rlx said:

I usually use Total Commander to search for a string.

But just for fun quickly pasted something together if you don't mind the messy coding

 

 


(defun c:tst ( / txt fol lst done data result-list)
  (if (and (setq search-string (getstring "\nString to search : "))
    (not (eq search-string ""))
    (setq fol (getfolder "Lisp folder")))
    (progn
      (princ "\nCollecting data files , this can take a few moments / minutes ...")
      (if (setq lst (_GetAllFiles fol t "*.lsp"))
 (princ (strcat "\nStart processing files (" (itoa (length lst)) ") ...")))
      (foreach file lst
 (setq done nil)
 (if (setq fp (open file "r"))
   (progn
     (while (and (not done) (setq data (read-line fp)))
       (if (wcmatch (strcase data) (strcase (strcat "*" search-string "*")))
  (setq result-list (cons file result-list) done t)))
     (close fp)
   )
 )
      )
    )
    (princ "\nBad string or folder.")
  )
  (if result-list
    (prl result-list)
    (if (and search-string (not (eq search-string "")))
      (princ (strcat "\nSearch string " search-string " not found"))
    )
  )
  (terpri)
  (princ)
)

; from master Lee
(defun _GetAllFiles ( Dir Subs Filetype / _GetSubFolders )
  (defun _GetSubFolders ( folder ) (apply 'append (mapcar (function (lambda ( f ) (cons (setq f (strcat folder "\\" f)) (_GetSubFolders f))))
      (vl-remove "." (vl-remove ".." (vl-directory-files folder nil -1))))))
  (apply 'append (mapcar (function (lambda ( Filepath ) (mapcar (function (lambda ( Filename ) (strcat Filepath "\\" Filename)))
          (vl-directory-files Filepath Filetype 1)))) (cons Dir (if subs (_GetSubFolders Dir))))))
(defun getfolder ( msg / fl sh )
  (if (and (setq sh (vlax-create-object "Shell.Application")) (setq fl (vlax-invoke sh 'browseforfolder 0 msg 0 "")))
    (setq fl (vlax-get-property (vlax-get-property fl 'self) 'path))(setq fl nil))(release_me (list sh)) fl)

(defun release_me (lst)
  (mapcar '(lambda (x) (if (and (= 'vla-object (type x))(not (vlax-object-released-p x)))(vlax-release-object x))(set (quote x) nil)) lst))

(defun prl (lst)(terpri)(mapcar '(lambda(x)(princ "\n")(princ x)) lst)(terpri)(princ))

(vl-load-com)

(princ)


 

gr. Rlx

 

 

well i have to say that this is a pretty cool lisp routine! sadly i did a search for 'autosnap' and it didnt come up with anything. is there anything else that i could search for?

Posted

Only thing I know about autosnap is to turn of the irritating thing 😄

 

Meself have a little lisp file (rlinit_var.lsp) which is loaded in the startup of my acad.lsp so I start each drawing with the settings I want. I did read something about autosnap and the solution was not to use a floating command line. Not sure this is the case here. Else I'm thinkin' about gremlins, oh excuse me, a reactor somewhere that's sabotaging your setting? And of course this can also just be a bug in AutoCAD. This sometimes happens and is usually solved by installing the latest update or service pack for your autocad version.

 

gr. Rlx

Posted
2 minutes ago, rlx said:

Only thing I know about autosnap is to turn of the irritating thing 😄

 

Meself have a little lisp file (rlinit_var.lsp) which is loaded in the startup of my acad.lsp so I start each drawing with the settings I want. I did read something about autosnap and the solution was not to use a floating command line. Not sure this is the case here. Else I'm thinkin' about gremlins, oh excuse me, a reactor somewhere that's sabotaging your setting? And of course this can also just be a bug in AutoCAD. This sometimes happens and is usually solved by installing the latest update or service pack for your autocad version.

 

gr. Rlx

i am sure that it is a setting that the company i work for has set up in order to keep their thumb down on what we are doing. they have stated to me on several occasions that they frown apon the use of lisp routines. 

 

and in a way that is what the above lisp is doing. i have it loading into the start up suit and i should be able to just type the command and it will reset all of my setting back to the way that i want. but it is only working on some. 

Posted

 

If you google 'autocad autosnap problem' at least you're not the only one having problems...

Posted (edited)
3 minutes ago, rlx said:

 

If you google 'autocad autosnap problem' at least you're not the only one having problems...

 

 

that is what i found. i also looked up autosnap system variables. and found that you can add a string to override it and have it turn back on. 

 

i added - (setvar "AUTOSNAP" 8 )      <--- there is no space between the 8 and the ) if i left it there in this response i would get this 8) 

 

so my lisp and loaded it into AutoCAD and turned off polar tracking. and then ran the normal command that i do to reset my OSNAP's and bingo, it turned back on. 

Edited by dnovember99
Posted
1 hour ago, dnovember99 said:

they have stated to me on several occasions that they frown apon the use of lisp routines.

That's unfortunate. Guess they don't want too much efficiency? 😜

  • Funny 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...