Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lisp Help

10 REPLIES 10
Reply
Message 1 of 11
molokaiboy
276 Views, 10 Replies

Lisp Help

I am using Mechanical Desktop 5 and trying to use the amdatumid command in my lisp. I want to control the leader to a set length. I want to have the user pick the first point, and if the second point is between 0 and 90 degrees, create the leader @.5<0, or if the second point is between 90 and 180 degrees, go @.5<180 and so on. Can anyone help?

TIA

Collin
10 REPLIES 10
Message 2 of 11
BillZ
in reply to: molokaiboy

What kind of "lisp" are we talking about?
Message 3 of 11
molokaiboy
in reply to: molokaiboy

i want to use the amdatumid in my lisp. vlisp??
Message 4 of 11
BillZ
in reply to: molokaiboy

You may have to collect your first two points prior to the leader command. Then: (cond ((< (angle p1 p2)(dtr 90))
(setq p2 (polar p1 0 0.5)).............and so on. Then execute the command using the new points. I'm not sure if this will work because I'm not familiar with Mechtop. but I hope it helps.
BillZ
Message 5 of 11
Anonymous
in reply to: molokaiboy

I need the command line version of page setup so that i can put it at front
of a lisp i am writing to make sure that each pagesetup is the same before
the lisp tries to plot .
TIA
Message 6 of 11
Anonymous
in reply to: molokaiboy

Ladies/Gents-I need some help on routine. The purpose is to log the drawings
everyone opens to a file with the date & time.
That part works fine. My problem is how do I get the routine NOT to run when
you first start Autocad. I don't care when
"Drawing1" is opened, I only care about the drawings they are actually
working on. I have tried everything I can think of to
accomplish that to no avail so I am asking for help.
Helllllllllllllp.......

Enclosed is the routine in question

(defun logu ()

(if (/= "DRAWING1" (strcase (getvar "dwgname")))
(progn
(setq user (getvar "Loginname"))
(setq dpath (getvar "dwgprefix"))
(setq utimer (getvar "TDUSRTIMER"))
(setq utmer (rtos utimer 2 2))

(setq dwgname (getvar "dwgname")
d (rtos (getvar "cdate") 2 6)
yr (substr d 3 2)
mo (substr d 5 2)
day (substr d 7 2)
hr (substr d 10 2)
mn (substr d 12 2)
date (strcat mo "/" day "/" yr)
time (strcat hr ":" mn ))

(setq dgname (strcat dpath dwgname))

(setq stamp (strcat dgname " | " user " | " date " | " time))

(setq fp (open "f:\\Dwg.txt" "a"))
(write-line stamp fp)
(close fp)
(setq dgname nil
d nil
yr nil
mo nil
day nil
hr nil
mn nil
date nil
time nil
stamp nil
fp nil
);end setq dwgname
);END PROGN
);END IF
);END DEFUN
(PRINC)
(logu)


Thanks A bunch

Tim W.
Message 7 of 11
Anonymous
in reply to: molokaiboy

When I use (getvar "dwgname") it returns the filename+extension, but your
conditional expression only checks against filename (no extension). Could
this be the problem?

"Tim" wrote in message
news:9F94D1DDB1F3365BDFBCC5954373A22C@in.WebX.maYIadrTaRb...
> Ladies/Gents-I need some help on routine. The purpose is to log the
drawings
> everyone opens to a file with the date & time.
> That part works fine. My problem is how do I get the routine NOT to run
when
> you first start Autocad. I don't care when
> "Drawing1" is opened, I only care about the drawings they are actually
> working on. I have tried everything I can think of to
> accomplish that to no avail so I am asking for help.
> Helllllllllllllp.......
>
> Enclosed is the routine in question
>
> (defun logu ()
>
> (if (/= "DRAWING1" (strcase (getvar "dwgname")))
> (progn
> (setq user (getvar "Loginname"))
> (setq dpath (getvar "dwgprefix"))
> (setq utimer (getvar "TDUSRTIMER"))
> (setq utmer (rtos utimer 2 2))
>
> (setq dwgname (getvar "dwgname")
> d (rtos (getvar "cdate") 2 6)
> yr (substr d 3 2)
> mo (substr d 5 2)
> day (substr d 7 2)
> hr (substr d 10 2)
> mn (substr d 12 2)
> date (strcat mo "/" day "/" yr)
> time (strcat hr ":" mn ))
>
> (setq dgname (strcat dpath dwgname))
>
> (setq stamp (strcat dgname " | " user " | " date " | " time))
>
> (setq fp (open "f:\\Dwg.txt" "a"))
> (write-line stamp fp)
> (close fp)
> (setq dgname nil
> d nil
> yr nil
> mo nil
> day nil
> hr nil
> mn nil
> date nil
> time nil
> stamp nil
> fp nil
> );end setq dwgname
> );END PROGN
> );END IF
> );END DEFUN
> (PRINC)
> (logu)
>
>
> Thanks A bunch
>
> Tim W.
>
>
Message 8 of 11
Anonymous
in reply to: molokaiboy

(if (= (getvar "dwgtitled") 1) ...)

--
John Uhden, Cadlantic/formerly CADvantage
[ mailto:juhden@cadlantic.com ]
[ http://www.cadlantic.com ]
2 Village Road
Sea Girt, NJ 08750
Tel. 732-974-1711


"Tim" wrote in message news:9F94D1DDB1F3365BDFBCC5954373A22C@in.WebX.maYIadrTaRb...
> Ladies/Gents-I need some help on routine. The purpose is to log the drawings
> everyone opens to a file with the date & time.
> That part works fine. My problem is how do I get the routine NOT to run when
> you first start Autocad. I don't care when
> "Drawing1" is opened, I only care about the drawings they are actually
> working on. I have tried everything I can think of to
> accomplish that to no avail so I am asking for help.
> Helllllllllllllp.......
>
> Enclosed is the routine in question
>
> (defun logu ()
>
> (if (/= "DRAWING1" (strcase (getvar "dwgname")))
> (progn
> (setq user (getvar "Loginname"))
> (setq dpath (getvar "dwgprefix"))
> (setq utimer (getvar "TDUSRTIMER"))
> (setq utmer (rtos utimer 2 2))
>
> (setq dwgname (getvar "dwgname")
> d (rtos (getvar "cdate") 2 6)
> yr (substr d 3 2)
> mo (substr d 5 2)
> day (substr d 7 2)
> hr (substr d 10 2)
> mn (substr d 12 2)
> date (strcat mo "/" day "/" yr)
> time (strcat hr ":" mn ))
>
> (setq dgname (strcat dpath dwgname))
>
> (setq stamp (strcat dgname " | " user " | " date " | " time))
>
> (setq fp (open "f:\\Dwg.txt" "a"))
> (write-line stamp fp)
> (close fp)
> (setq dgname nil
> d nil
> yr nil
> mo nil
> day nil
> hr nil
> mn nil
> date nil
> time nil
> stamp nil
> fp nil
> );end setq dwgname
> );END PROGN
> );END IF
> );END DEFUN
> (PRINC)
> (logu)
>
>
> Thanks A bunch
>
> Tim W.
>
>
Message 9 of 11
Anonymous
in reply to: molokaiboy

That Worked Thank You

Tim
"John Uhden" wrote in message
news:2F2075DD1F81E0269F7D7005E53968D0@in.WebX.maYIadrTaRb...
> (if (= (getvar "dwgtitled") 1) ...)
>
> --
> John Uhden, Cadlantic/formerly CADvantage
> [ mailto:juhden@cadlantic.com ]
> [ http://www.cadlantic.com ]
> 2 Village Road
> Sea Girt, NJ 08750
> Tel. 732-974-1711
>
>
> "Tim" wrote in message
news:9F94D1DDB1F3365BDFBCC5954373A22C@in.WebX.maYIadrTaRb...
> > Ladies/Gents-I need some help on routine. The purpose is to log the
drawings
> > everyone opens to a file with the date & time.
> > That part works fine. My problem is how do I get the routine NOT to run
when
> > you first start Autocad. I don't care when
> > "Drawing1" is opened, I only care about the drawings they are actually
> > working on. I have tried everything I can think of to
> > accomplish that to no avail so I am asking for help.
> > Helllllllllllllp.......
> >
> > Enclosed is the routine in question
> >
> > (defun logu ()
> >
> > (if (/= "DRAWING1" (strcase (getvar "dwgname")))
> > (progn
> > (setq user (getvar "Loginname"))
> > (setq dpath (getvar "dwgprefix"))
> > (setq utimer (getvar "TDUSRTIMER"))
> > (setq utmer (rtos utimer 2 2))
> >
> > (setq dwgname (getvar "dwgname")
> > d (rtos (getvar "cdate") 2 6)
> > yr (substr d 3 2)
> > mo (substr d 5 2)
> > day (substr d 7 2)
> > hr (substr d 10 2)
> > mn (substr d 12 2)
> > date (strcat mo "/" day "/" yr)
> > time (strcat hr ":" mn ))
> >
> > (setq dgname (strcat dpath dwgname))
> >
> > (setq stamp (strcat dgname " | " user " | " date " | " time))
> >
> > (setq fp (open "f:\\Dwg.txt" "a"))
> > (write-line stamp fp)
> > (close fp)
> > (setq dgname nil
> > d nil
> > yr nil
> > mo nil
> > day nil
> > hr nil
> > mn nil
> > date nil
> > time nil
> > stamp nil
> > fp nil
> > );end setq dwgname
> > );END PROGN
> > );END IF
> > );END DEFUN
> > (PRINC)
> > (logu)
> >
> >
> > Thanks A bunch
> >
> > Tim W.
> >
> >
Message 10 of 11
Anonymous
in reply to: molokaiboy

What is the "SAVE" command structure that Autocad uses when you save a
drawing
through the "Do You Want To Save Changes" Dialogue box. I am trying to
redefine all save calls
and that's the only one I cant seem to get.

Any help would be highly appreciated.

Tim W
Message 11 of 11
Anonymous
in reply to: molokaiboy

> Does anybody know what in what format the save command is for the following
> dialogue box. I am trying to redefine the save commands and cant seem to capture
> that one. I am using LDD2i so there is no worry of multiple drawings being open.
>
> Any help would be greatly appreciated.

I'm not sure exactly what you are asking. Here's what I've used in the
past...

;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;SAVE Command Redefinition;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
(command "undefine" "save") ;Undefine SAVE
(defun c:save () ;Redefine SAVE

{put pre-case actions here}

(if (= (getvar "filedia") 1)
(command ".save" "~") ;SAVE dialog
(command ".save") ;SAVE command line
);ENDif
(princ)
);ENDsave

Redefining SAVE isn't a problem. It's QUIT, OPEN, NEW, that force the
"Save changes" prompt that are more work. In these cases, you have to
look yourself to see if the drawing is changed or not and issue your own
actions based on these conditions. When I've done this, I created my own
DCL dialog prompt for the "save changes?" prompt to give it as close a
feel to the native AutoCAD command as possible.

--
Sincerely,
Darren J. Young

Minnesota CADWorks, Inc.
P.O. Box 7293
Saint Cloud, Minnesota 56302-7293
Phone: (320) 654-9053
WWW: http://www.mcwi.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost