TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: d2010 on April 28, 2021, 03:57:42 PM
-
I need the new-function "if_ispoint" with small-size?>.
I wrote this source, because many times, i want fix the point.error/s automatically, and always "if_ispoint" repair internal-bugs-inside.Var.
(setq ag (if_ispoint a170 (getvar "VIEWCTR")))
:whistling:
(defun if_ispoint(f163 elseways / $rp zfs lcd led lev noz noy nox)
(setq;|a27304|;
lcd (quote LIST)
led (quote REAL)
lev (quote INT)
zfs RTREJ) (if (and (= (type f163) lcd) (/= f163 nil)) (setq;|a27424|;
zfs (length f163))) (setq;|a27448|;
retl elseways) (setq;|a27468|;
noy nil
noz (if (> zfs 2) (type (caddr f163)) nil)) (if (and (> zfs 2) (or (= noz lev) (= noz led))) (setq;|a27588|;
noy (type (cadr f163))
noy (or (= noy lev) (= noy led)))) (if (= zfs 2) (setq;|a27682|;
noy (type (cadr f163))
noy (or (= noy lev) (= noy led)))) (setq;|a27756|;
nox nil) (if noy (setq;|a27784|;
nox (type (car f163))
nox (or (= nox lev) (= nox led)))) (setq;|a27858|;
$rp elseways) (if nox (setq;|a27882|;
$rp (cond ( (> zfs 2) (list (car f163) (cadr f163) (caddr f163)))( (list (car f163) (cadr f163) 0.0)))))
$rp)
How to check the variabile is Point?
-
My Autolisp is very rusty but it seems to me that all you are really doing in the above code is verifying that you are dealing with a list and the z-value is 0. So wouldn't something like the following be "easier"? I agree, mine isn't very "safe"--in that you can supply only one point list and get a funky point list return--but the point is, this is small and an extremely fast "flattener" function that seems to do almost the same.
-
Assuming that you're trying to verify whether or not a supplied value represents a 2D/3D point, I would suggest the following:
-
Thank you,Lee Mac , Now I can fix-automatically point-problems.
In My programe.lsp, Now I can autofix-point-var-automatically.
I replace allfailed with (getvar "VIEWCTR").
_$ (vl-load-com)
_$ (setq a1 (if_ispoint (getpoint) nil))
(27.54 25.6945 0.0)
_$ (setq a1 (if_ispoint (getpoint) nil))
; error: Function cancelled
_$ (setq a1 (if_ispoint "(getpoint)" (getvar "VIEWCTR")))
(50.0 50.0 0 0.0)
:tickedoff:
(defun if_ispoint
(f163 allfailed
/ $rr cnt nop
) $rr allfailed
$rr f163)))
$rr)