Author Topic: What do they mean? How do I use them?  (Read 6380 times)

0 Members and 1 Guest are viewing this topic.

highflyingbird

  • Bull Frog
  • Posts: 415
  • Later equals never.
What do they mean? How do I use them?
« on: December 21, 2011, 07:49:32 AM »
Just want to know how to use these functions:

1.pragma

Code - Auto/Visual Lisp: [Select]
  1. (pragma   '((unprotect-assign   myFun)))
  2. (defun myFun () (alert "My defun!"))
  3. (pragma   '((protect-assign   myFun)))
  4.  

2.
acad-push-dbmod
acad-pop-dbmod


Code - Auto/Visual Lisp: [Select]
  1. (acad-push-dbmod)
  2. (setvar "cmdecho" 0)
  3. (setq layer (getvar "clayer"))
  4. (if (not (tblsearch "layer" "A-DIM"))  (command "_.layer" "_m" "A-DIM" "_c" "4" "" ""))
  5. (if layer  (setvar "clayer" layer))
  6. (setq layer nil)
  7. (setvar "cmdecho" 1)
  8. (acad-pop-dbmod)
  9.  

Can somebody explain these functions exactly?Thanks a lot.
« Last Edit: December 21, 2011, 07:55:01 AM by HighflyingBird »
I am a bilingualist,Chinese and Chinglish.

nivuahc

  • Guest
Re: What do they mean? How do I use them?
« Reply #1 on: December 21, 2011, 08:08:00 AM »
acad-push-dbmod

Essentially, this puts the DBMOD system variable on hold. The DBMOD system variable keeps track of changes to a drawing that would prompt you to save, when you close. In other words, anything that you do after issuing acad-push-dbmod will not be seen as having changed the drawing.

EDIT: In retrospect, I shouldn't say that it puts the variable on hold... what it does is store the value of the DBMOD variable. If you don't issue the acad-pop-dbmod command you'll still be prompted to save.

acad-pop-dbmod

This restores the DBMOD variable to it's state when you issued the acad-push-dbmod command.

Try it out. Open a blank drawing and type (acad-push-dbmod) and the command line, then press ENTER. It should return T. Now draw some things, zoom around, erase some things, etc. Now type (acad-pop-dbmod), press ENTER, and close AutoCAD.

No prompt for saving the drawing.

Very helpful when you're running a routine that you don't want to force the user to have to reply to a save query, such as in a script or at startup.
« Last Edit: December 21, 2011, 08:14:04 AM by nivuahc »

nivuahc

  • Guest
Re: What do they mean? How do I use them?
« Reply #2 on: December 21, 2011, 08:17:41 AM »
And I have no idea what pragma does as I've never used it. I did however find this explanation (which may or may not be accurate).

Quote from: Jesse Danes
(pragma) clauses are carried over from Vital LISP when it was distributed by Basis Software and subsequently purchased by Autodesk and labelled Visual LISP. They are no longer documented or supported but still function. Basically they are pre-compiler directives and can include a number of compile modes and options. As suggested, protected symbols as well as 'link and 'not-link options which can improve the speed and efficiency of large applications, 'drop and 'not-drop options to strip out function names from resulting FAS/VLX files for increased security. Pragma's are basically the coded version of the options available in the Project Make file available from the Make Application menu in teh VLIDE. Using these options can be tricky and must be done carefull, improper placement or use can cause programs to run incorrectly or certain elements not to function at all. For most purposes, the standard compile mode can be used without these options. Regards, Jesse Danes

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: What do they mean? How do I use them?
« Reply #3 on: December 21, 2011, 08:21:59 AM »
The undocumented pragma function can be used to protect/unprotect a symbol; a protected symbol will be highlighted in blue in the VLIDE and the user will receive a prompt if a call is made to redefine the symbol (the nature of the prompt will depend upon the user's VLIDE settings with regards to 'SETQ to protected symbols').

Some examples:
http://www.theswamp.org/index.php?topic=30714.0
http://www.theswamp.org/index.php?topic=37554

highflyingbird

  • Bull Frog
  • Posts: 415
  • Later equals never.
Re: What do they mean? How do I use them?
« Reply #4 on: December 21, 2011, 09:09:20 AM »
Thank you very much.:-)
You guys know everything.
I am a bilingualist,Chinese and Chinglish.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: What do they mean? How do I use them?
« Reply #5 on: December 21, 2011, 09:13:43 AM »
You guys know everything.
except why we spend so much time here. :P
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

highflyingbird

  • Bull Frog
  • Posts: 415
  • Later equals never.
Re: What do they mean? How do I use them?
« Reply #6 on: December 21, 2011, 09:23:36 AM »
Very helpful when you're running a routine that you don't want to force the user to have to reply to a save query, such as in a script or at startup.

This one is really useful.
I am a bilingualist,Chinese and Chinglish.

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: What do they mean? How do I use them?
« Reply #7 on: December 21, 2011, 10:16:17 AM »
I use the dbmod functions in my :sstartup routine when loading all my routines.  This way if you don't issue any commands or make any changes you can close the drawing without Autocad prompting for a save.

For some reason this bothered my at some point so I made this change.
James Buzbee
Windows 8

highflyingbird

  • Bull Frog
  • Posts: 415
  • Later equals never.
Re: What do they mean? How do I use them?
« Reply #8 on: December 25, 2011, 10:18:10 AM »
found other functions:

seturl
geturl

vl-bt
vl-bt-on
vl-bt-off

vl-infp
vl-nanp
bherrs
fnsplitl
xstrcase
« Last Edit: December 25, 2011, 10:21:29 AM by HighflyingBird »
I am a bilingualist,Chinese and Chinglish.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

fixo

  • Guest
Re: What do they mean? How do I use them?
« Reply #10 on: December 25, 2011, 10:37:18 AM »

highflyingbird

  • Bull Frog
  • Posts: 415
  • Later equals never.
I am a bilingualist,Chinese and Chinglish.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.