TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: vincent.r on June 26, 2020, 05:23:41 AM
-
Hi,
I trying to select a line based on given coordinates. Took help from Lee's website and modified code as -
(ssget '((0 . "LINE") (-4 . "=,=,=") (11 13.0767 17.0213 0.0)))
but not able get to select line. Don't know where am I mistaking. Drawing attached.
Tried this also -
(setq pt1 (list 13.0767 17.0213 0.0))
(SETQ A (ssget pt1 '((0 . "LINE") )))
Any help will be highly appreciable.
Thanks
-
Coordinates of each point in ACAD are stored as real numbers with precision up to 15 decimal places... So to get LINE, you must specify exact coordinates with all decimals and I suggest that you use this variant :
(ssget "_C" pt pt '((0 . "LINE")))
Note you can get pt with exact coordinates by : (setq pt (cdr (assoc 11 (entget (car (entsel "\nPick LINE..."))))))
Now to check precision : (prompt "\nPOINT : ") (princ (rtos (car pt) 2 20)) (prompt ",") (princ (rtos (cadr pt) 2 20)) (prompt ",") (princ (rtos (caddr pt) 2 20))
If you have(get) those data with precision up to 15 decimal places, you can try :
(ssget (list '(0 . "LINE") '(-4 . "=,=,=") '(11 Xcoord Ycoord Zcoord)))
-
Coordinates of each point in ACAD are stored as real numbers with precision up to 15 decimal places... So to get LINE, you must specify exact coordinates with all decimals and I suggest that you use this variant :
(ssget "_C" pt pt '((0 . "LINE")))
Note you can get pt with exact coordinates by : (setq pt (cdr (assoc 11 (entget (car (entsel "\nPick LINE..."))))))
Now to check precision : (prompt "\nPOINT : ") (princ (rtos (car pt) 2 20)) (prompt ",") (princ (rtos (cadr pt) 2 20)) (prompt ",") (princ (rtos (caddr pt) 2 20))
If you have(get) those data with precision up to 15 decimal places, you can try :
(ssget (list '(0 . "LINE") '(-4 . "=,=,=") '(11 Xcoord Ycoord Zcoord)))
It works ribarm! I was not aware of precision system.
Thank you very much. You made my day.
Cheers.
-
An easier way to perform the selection, without needing to specify the coordinate values to the exact limit of double-floating-point precision is to use some tolerance around the values, e.g.:
(setq p '
(13.0767 17.0213 0.0) ;; Approximate point f 1e-4 ;; Tolerance
)
'(0 . "LINE")
'(-4 . ">=,>=,>=")
'(-4 . "<=,<=,<=")
)
)
-
Thanks Lee !