Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Who is the Pro on this Site???? 2

Status
Not open for further replies.

cadiehl

Industrial
May 12, 2001
29
0
0
Can anyone figure out why this code will not work in ACAD2000i? I had it working fine in R14... I need this stamp to be on the elec drawings, that is why I do not want to use the plot stamp tool in R2000...
Thanks in advance for all of your help...
CD

OPEN YOUR ACAD.MNL OR ACADFULL.MNL FILE IN NOTEPAD.
COPY AND PASTE THE BELOW TEXT AT THE VERY END OF YOUR ACAD.MNL OR ACADFULL.MNL FILE, MAKE SURE YOU PLACE THE NAMEDATE.DWG FILE IN YOUR ACADR14 "SUPPORT" SUB-DIRECTORY.

(DEFUN INSDAT ()
(SETQ INSPT (GETPOINT "\nSELECT INSERTION POINT FOR STAMP: "))
(COMMAND "LAYER" "M" "NDATE" "" "INSERT" "NAMEDATE" INSPT (ISCC) (ISCC) 0 ))
(VMON)
(setvar "cmdecho" 1)
;************************MODIFIED END ROUTINE************************

(DEFUN ISCC ()
(* (GETVAR "TEXTSIZE") 58)
);END DEFUN
(DEFUN C:END ()
(setvar "cmdecho" 0)
(M_STIR)
(SETQ BLK1 "NAMEDATE")
(SETQ BENT (SSGET "X" (LIST (CONS 2 BLK1))))
(IF BENT
(PROGN
(PROMPT "\nUpdating Time/Date Stamp...")(PRINC)
(UPD)(princ)
)
(progn
(princ "NAME/DATE STAMP NOT FOUND")


(INSDAT)
(UPD)
)
)
(SETVAR "EXPERT" 2)
(M_STIR)
; (C:CSAVE)
(COMMAND ".SAVE" (STRCAT drive ":" DWG))
(SETVAR "EXPERT" 1)

(COMMAND ".END")
)
;****************************MODIFIED SAVE ROUTINE***************************
(DEFUN C:SAVE ()
(setvar "cmdecho" 0)
(M_STIR)
(SETQ BLK1 "NAMEDATE")
(SETQ BENT (SSGET "X" (LIST (CONS 2 BLK1))))
(IF BENT
(PROGN
(PROMPT "\nUpdating Time/Date Stamp...")(PRINC)
(SETQ C (SSNAME BENT 0))
(SETQ B2 (ENTNEXT C))
(SETQ B3 (ENTNEXT B2))
(UPD)(princ)
)
(progn
(princ "NAME/DATE STAMP NOT FOUND")
(setq mastsf (ISCC))
(SETVAR "ATTREQ" 0)
(INSDAT)
(SETVAR "ATTREQ" 1)
(SETQ BENT (SSGET "X" (LIST (CONS 2 BLK1))))
(UPD)
)
)
;(C:CSAVE)
(SETVAR "EXPERT" 2)
(COMMAND ".SAVE" "")(princ)
(SETVAR "EXPERT" 1)


)


;(DEFUN C:CSAVE ()
; (SETQ DIREC (GETVAR "DWGPREFIX" ))
; (SETQ PATH (STRCAT DIREC "\R12DWGS" "\\"))
; (SETQ SAVPATH (STRCAT PATH DWG))
; (COMMAND ".SAVEASR12" SAVPATH "Y")
; )


(DEFUN C:QSAVE ()
; (C:CSAVE)
(C:SAVE)

)



;***************SUBROUTINE CALLED BY END & SAVE ROUTINES*********************
(DEFUN UPD ()
(SETQ C (SSNAME BENT 0))
(SETQ B2 (ENTNEXT C))
(SETQ B3 (ENTNEXT B2))
(FT)
(SETQ B2 (entget B2))
(SETQ D (CDR (SETQ H (ASSOC 1 B2))))
(SETQ SF11 (GETVAR "DIMSCALE"))
(SETQ SF11 (RTOS SF11 2 1))
(SETQ D1 (CONS (CAR H) CD))
(SETQ B1 (SUBST D1 H B2))
(ENTMOD B1)
(SETQ G CD)
(M_STIR)
(SETQ CD (STRCASE DWG))
(SETQ B2 B3)
(SETQ B2 (entget B2))
(SETQ D (CDR (SETQ H (ASSOC 1 B2))))
(SETQ G CD)
(SETQ G (STRCAT G " " SF11))
(SETQ D1 (CONS (CAR H) G))
(SETQ B1 (SUBST D1 H B2))
(ENTMOD B1)
(ENTUPD C)(PRINC)
)
;****************SUBROUTINE CALLED BY SAVE & END ROUTINES****************
(defun FT (/ CD1 CD2 LN1 SF2 PT1 PT3 WIDTH2 HEIGHT2 PT2 SS1)
(setvar "cmdecho" 0)
(SETQ CD1 (RTOS (GETVAR "CDATE") 2 0))
(SETQ CD2 (RTOS (GETVAR "CDATE") 2 6))
(SETQ LN1 (STRCAT
(SUBSTR CD2 10 2) ":"
(SUBSTR CD2 12 2)
))
(SETQ CD (STRCAT
LN1 " "
(SUBSTR CD1 5 2)
"/"
(SUBSTR CD1 7 2)
"/"
(SUBSTR CD1 3 2)
)
)
)
;********************STRIPS PATH FROM DRAWING NAME******************
(DEFUN M_STIR (/ A B1 N K)
(SETQ A (GETVAR "DWGNAME"))
(SETQ DWG "" B1 "" N "YES" K (STRLEN A))
(WHILE (= N "YES")
(SETQ B1 (SUBSTR A K 1))
(IF (= B1 (CHR 92))
(PROGN (SETQ N "NO"))
(PROGN
(SETQ K (- K 1))
(SETQ DWG (STRCAT B1 DWG))))
(IF (= K 0)(SETQ N "NO")))
)

;**************************AUTO LOADING LISP FUNTIONS***********************
(defun s::startup ()
(setvar "cmdecho" 0)
(command "undefine" "end")
(command "undefine" "save")
(command "undefine" "qsave")
)
;*********************************************************************
;*********************************************************************
;*********************************************************************
;MISC ROUTINES

(LOAD"AI_UTILS")
;;;
(DEFUN CUR_LAY ()
(SETQ CUR_LAY (GETVAR "CLAYER"))
);END DEFUN

;;;;
(DEFUN SET_LAY ()
(SETVAR "CLAYER" CUR_LAY)
);END DEFUN

;;;


;;;;;;
(DEFUN ISC ()
(/ (GETVAR "LTSCALE") 36)
);END DEFUN
;;;;;;

(DEFUN EX_CHL()
(SETQ SS1 (SSGET "L"))
(SETQ INDEX 0)
(SETQ ENT1(ENTGET(SSNAME SS1 INDEX)))
(SETQ NLAY (ASSOC 8 ENT1))
(SETQ NL (CDR NLAY))
(COMMAND "EXPLODE" "L")
(COMMAND "CHANGE" "P" "" "P" "LA" NL "")
);CLOSE DEFUN
 
Replies continue below

Recommended for you

Well Cadiehl, first of all I dunno why you paste it in your mnl file? I think you just should paste it in a text file and make it a lisp routine. But I like to know why this lisp is written, to insert a head of a drawing that has immediatly the date of the day you inserted it in your drawing? And I don't think anybody will be able to help if you haven't got this stamp for the guys. I like to help.... and will look for you, but I think you should make that stamp available :)
Good Luck.
 
Hey Reaver!
I put it in my MNL file because that is what the person who gave this to me told me to do... that is all I can say about that... I just do not know enough about this stuff to understand the real difference... as far as the stamp goes, it is just a stamp in the lower left corner of all of my borders (or wherever I insert it) that shows the time, date, dwg file name, and dimscale of the drawing. It updates itself with every quick save. It is a drawing called "namedate.dwg" that gets inserted into a new drawing when I do the first quick save, or as I said above, will update itself if it is already there. I do not know if I can attach a file on this site, but I would glady email you the drawing if you like... My email address is cadiehl@genesismarine.com, if you send me your email address I will forward it to you pronto... I sure do appreciate your time Reaver... thanks for the response...

PS- the stamp is important to me for control reasons... I send many drawings out to many clients, and it is a very good way for me to make sure they are looking at a valid revision... the stamp does not lie... know wut I mean??
Thanks,
Claude
 
The code seems to be OK. It redefines the commands Save, Qsave and End.
The question is, how to make it work on opening a drawing.
One way is, as mentioned, to put it in the acad.mnl file.
It redefines the Startup function - instead of adding to the existing startup.

SO, to debug, here is what I would do:

1-Put the code into staamp.lsp and file under support directory. Put the timedate.dwg there too.
2-Type
(load "stamp.lsp)
into a new text file and save as acad.lsp
if acad.lsp exists, add to it.
This is less complicated than modifying the acad.mnl and has the same effect.
3. In options, check - load acad.lsp with every drawing.

Then try it.
If it does not work, then please send me the timedate.dwg for testing.

tigrek@hotpop.com
 
OK. Villain is the line:

(COMMAND ".SAVE" (STRCAT drive ":" DWG))

drive is not defined. (Error message stringp nil)

Either refrain from using END, since SAVE is working,
or replace this line with:
(COMMAND "_.SAVE" "")
to save to the default name.
---
If the error message says, on trying SAVE,

SAVE - command unknown
then, there may be a translation conflict too, which is remedied with changing
(COMMAND ".SAVE" "")
into
(COMMAND "_.SAVE" "")
etc
---
It is not necessary to put the code int acad.mnl
Important is, to ensure that it loads with each drawing
and there are several ways for this.
For neatness' sake, the code should be on its own
like in file stamp.lsp
(load "stamp.lsp")
may be put into acad.lsp or mnl.lsp or acad2000.lsp
----
If this does not work, I am not giving up.




 
Tigrek... did not work... the one thing is that this routine must work with the "quick save" (qsave) command, and not the "save" command. The save command brings up the dialog box for "saving as"... I want this to do a stamp update, and quick save, all in one step... this is how it worked in Release 14... the weird thing about this is that 2000 does not even act like anything is happening whether I load it as a lisp... or add it to my MNL.... no errors come up, nothing... it just seems to ignore it... again... this is way over my head... I am just looking for help from someone who may be able and willing to help... thanks Tigrek...

Claude
 
Well, type the command SAVE from the command line
It worked by me.
If it does not again, it is not loading. To test this, put after
(DEFUN C:SAVE ()
(print "this is the modified SAVE")
and type SAVE on comand line
If you do not see this line,
it is not loading.
Type on the command line
(load "stamp.lsp")
If it does not load again,
go into options and check the directories under files.
The code being OK, we have to find out why it is not working or not loading - so, watch out for any error message.

QSAVE is linked to SAVE. They are made one and the same command in the code. If one works, so does the other.
There has to be some error message feedback.
It was not working here. I did the steps aboce, it worked - but I type SAVE from the command line.
 
Tigrek... Do me a favor... if you have edited my routine and have it working, will you email it to me so I can plug in what you have done?... I have messed with mine so much that I do not know if I have implemented your requested changes properly... I will then test it to see if it is even loading on my end...

Thank You...
Claude
cadiehl@genesismarine.com
 
IT WORKS!! IT WORKS!!
Thanks a ton Tigrek... 5 stars for you buddy.... I do not know what I did, but post an email address and I will send you the final lisp routine if you like...

I truly appreciate your help..
Thank You so much...
Claude
 
Status
Not open for further replies.
Back
Top