JONTHEPOPE Posted April 19, 2009 Posted April 19, 2009 Hi everyone, I'm intersted in runing a lisp on a file that is closed, is this possible . can i also run a lisp on 2 drawings at a time ? seems scrpit file is best used in this situation Quote
JONTHEPOPE Posted April 19, 2009 Author Posted April 19, 2009 my next question is about how i should delete a line of certain lentgth say 1' Quote
JONTHEPOPE Posted April 19, 2009 Author Posted April 19, 2009 (defun dlfoot () (setvar "cmdecho" 0) (setq pt1 (getvar "limmin")) (setq pt2 (getvar "limmax")) (setq ss1 (ssget "w" pt1 pt2)) (ssget "X" (list (cons 0 "line"))) ??? (comannd "erase" ss1"") (command redraw") (setvar "cmdecho" 1) (princ) ) Quote
Lee Mac Posted April 19, 2009 Posted April 19, 2009 Perhaps: (defun c:dlfoot (/ Tol ss eLst pt1 pt2) (vl-load-com) (setq Tol 0.001) (if (setq ss (ssget "X" (list (cons 0 "LINE") (if (getvar "CTAB") (cons 410 (getvar "CTAB")) (cons 67 (- 1 (getvar "TILEMODE"))))))) (progn (foreach x (mapcar 'cadr (ssnamex ss)) (setq eLst (entget x) pt1 (cdr (assoc 10 eLst)) pt2 (cdr (assoc 11 eLst))) (if (not (equal (distance pt1 pt2) 1.0 Tol)) (ssdel x ss))) (if (not (zerop (sslength ss))) (command "_erase" ss ""))) (princ "\n<!> No Lines Found <!>")) (princ)) Quote
JONTHEPOPE Posted April 19, 2009 Author Posted April 19, 2009 your coding has gotten so advanced so fast .well mine has fallen behind quite a bit. mostly cause my cad manager doen'st belive in "wasting time" i wish he could meet u Quote
Lee Mac Posted April 20, 2009 Posted April 20, 2009 your coding has gotten so advanced so fast .well mine has fallen behind quite a bit. mostly cause my cad manager doen'st belive in "wasting time" i wish he could meet u Haha - my old manager didn't like me writing code during work either - but it does save you time Bear in mind with the code above, I have included a Tolerance in the code, at the top (currently set to 0.001), but you may wish to set this is something lower (or higher) or 0, if you wish. Lee Quote
JONTHEPOPE Posted April 20, 2009 Author Posted April 20, 2009 because your a math major could you please explian to me what a factorial of a interger is? and when it's best used? ; This is a programming example of a recursive function ; which calculates the factorial of an integer. (defun factor (y) (cond ((= 0 y) 1) (t (* y (factor (1- y)))) ) ) (defun C:FACT (/ x) (initget 7) ;x must not be null, negative or zero (setq x (getint "Enter an integer: ")) (factor (float x)) ) Quote
Lee Mac Posted April 20, 2009 Posted April 20, 2009 A Factorial is said integer multiplied by all of the integers beneath it (until 1): i.e. 5! (5 factorial) = 5 x 4 x 3 x 2 x 1 = 120 4! (4 factorial) = 4 x 3 x 2 x 1 = 24 etc. This is useful in many different applications - for example counting the number of ways you can order a set of n different objects is n! Or in a binomial expansion of say, (1 + x)^n, factorials are used in the expressions for the coefficients: 1 + nx + (n(n-1)/2!)x^2 + (n(n-1)(n-2)/3!)*x^3 etc etc For more on factorials, see here: http://en.wikipedia.org/wiki/Factorial For more on Binomial Expansions, see here: http://en.wikipedia.org/wiki/Binomial_expansion Hope this helps Lee Quote
Recommended Posts
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.