TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: DanB on February 29, 2016, 10:39:41 AM
-
I've had this LISP routine for quite some time. First use in 2016 is causing program to fatal error. I've tested a couple of times each crashes out. Any thoughts? (Snippet of error attached too.)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 7/25/06 ;;
;; 3d Polyline with User defined Elevations ;;
;; ;;
;; PROGRAM PROVIDED "AS IS" AND WITH ALL FAULTS, ;;
;; AND DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM ;;
;; WILL BE UNINTERRUPTED OR ERROR FREE. ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:3pe (/ oldecho oldos pnt1 elevz elev1txt elev1 pnt1e pntx elev2txt elevx) ;3pe
(setq oldecho (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq pnt1 (getpoint "\nSpecify start point of polyline: "))
(setq elevz (last pnt1))
(if (/= elevz 0)
(setq pe:elev1 elevz)
)
(if pe:elev1
(progn
(setq elev1txt (rtos pe:elev1 2 2))
(setq elev1 (getreal (strcat "\nStart elevation: <" elev1txt "> ")))
(if (= elev1 nil)
(setq pe:elev1 pe:elev1)
(setq pe:elev1 elev1)
)
) ;end progn
(setq pe:elev1 (getreal "\nStart elevation: "))
) ;end if
(setq pnt1e (subst pe:elev1 (last pnt1) pnt1))
(command ".3dpoly")
(while
(if (= pntx nil)
(progn
(setq oldos (getvar "osmode"))
(setvar "osmode" 0)
(command pnt1e)
(setvar "osmode" oldos)
(setq pntx (getpoint pnt1e "\nPick point: "))
) ;end progn
(setq pntx (getpoint pntx "\nPick Point: "))
) ;end if
(command pntx)
(setq elev2z (last pntx))
(if (/= elev2z 0)
(setq pe:elev1 elev2z)
)
(setq elev2txt (rtos pe:elev1 2 2))
(setq elevx (getreal (strcat "\nElevation: <" elev2txt "> ")))
(if (= elevx nil)
(setq elevx pe:elev1)
(setq elevx elevx)
)
(setq pe:elev1 elevx)
(setq pntx (subst elevx (last pntx) pntx))
(command "undo")
(setq oldos (getvar "osmode"))
(setvar "osmode" 0)
(command pntx)
(setvar "osmode" oldos)
) ;end while
(command "")
(setvar "cmdecho" oldecho)
(princ)
)
-
I don't get any error in C3D 2014...
-
It crashed my C3D2016 to the desktop. No error message, no CER, just "AutoCAD has stopped working" and gone. Now I've got a client coming in so no more time to troubleshoot.
-
Here's a quick rewrite - maybe this will resolve it:
(defun c:3pe
( / cmd pt1 pt2
) )
)
)
)
(defun getelevation
( def
/ tmp
) )
)
3pe:elv
)
-
That did function for me without crashing, Lee. If I were to use this I would need to add a way to Close or eXit, but I don't think either of those were in the original anyway.
-
That did function for me without crashing, Lee.
Excellent, thank you for testing it Jeff. :-)
If I were to use this I would need to add a way to Close or eXit, but I don't think either of those were in the original anyway.
Implementing your suggestions:
(defun c:3pe
( / cmd lst pt1 pt2
) )
(if (cdr lst
) "Undo " "") "eXit"
)
)
"\nSpecify next point ["
(if (cdr lst
) "Undo/" "") "eXit] <eXit>: "
)
)
)
)
)
(null pt2
) (= "eXit" pt2
) )
)
( (= "Close" pt2)
)
( (= "Undo" pt2)
)
)
)
)
)
)
)
)
)
(defun getelevation
( def
/ tmp
) )
)
3pe:elv
)
-
Sorry for the delay in responding back. Thank you for getting this to work, quick test in 2016 and there's no crashing out.
-
Excellent to hear, hope the new code proves useful :-)
-
Lee Mac
You Rock! Thank you for your numerous contributions to the lisp community! I hope you win the lottery!
-
Lee Mac
You Rock! Thank you for your numerous contributions to the lisp community! I hope you win the lottery!
Thank you! - Now that would be something! :lol:
-
Nice job!