gpd Posted February 16, 2014 Share Posted February 16, 2014 Dear Members Consider the attached drawing. It contains one block and a line touching its base point. Distance between the start point of line and the base point of block is 0.0, still below lisp code returns nil. Please guide what is the reason. (setq ss(ssget "X" (list (cons 0 "INSERT")(cons 10 spt)))) spt is the start point of the line. Thanks. ssget.dwg Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 16, 2014 Share Posted February 16, 2014 That 's due to the Z coordinates of the block Quote Link to comment Share on other sites More sharing options...
pBe Posted February 16, 2014 Share Posted February 16, 2014 (edited) To "see" what "Z" coordinates tharwat mentioned above Select the block then select the line (setq BockInsertionPoint (cdr (Assoc 10 (entget (Car (entsel)))))) (setq LineStartpoint (Vlax-curve-getstartpoint (car (entsel)))) Edited February 16, 2014 by pBe Quote Link to comment Share on other sites More sharing options...
GP_ Posted February 16, 2014 Share Posted February 16, 2014 (setq spt (getpoint)) ;[b]BLOCK -> insert point[/b] (619827.0 2.61951e+006 [color=red]1.11028e-011[/color]) _$ (setq ss(ssget "X" (list (cons 0 "INSERT")(cons 10 spt)))) [color=royalblue][b]<Selection set: 3da>[/b][/color] _$ (setq spt (getpoint)) ;[b]POLYLINE -> end point[/b] (619827.0 2.61951e+006 [color=red]0.0[/color]) _$ (setq ss(ssget "X" (list (cons 0 "INSERT")(cons 10 spt)))) [color=royalblue][b]nil[/b] [/color] _$ Oops... @Tharwat & pBe Sorry, I wrote without seeing your answers Quote Link to comment Share on other sites More sharing options...
pBe Posted February 16, 2014 Share Posted February 16, 2014 (setq ss (ssget "_X" (list '(0 . "INSERT") '(-4 . "=,=,*") (cons 10 spt)) ) ) Quote Link to comment Share on other sites More sharing options...
GP_ Posted February 16, 2014 Share Posted February 16, 2014 (list '(0 . "INSERT") [b]'(-4 . "=,=,*")[/b] (cons 10 spt)) Good stuff Quote Link to comment Share on other sites More sharing options...
pBe Posted February 16, 2014 Share Posted February 16, 2014 Good stuff Thanks _GP Cheers Quote Link to comment Share on other sites More sharing options...
Stefan BMR Posted February 16, 2014 Share Posted February 16, 2014 You can use a fuzz factor: (setq f '(0.02 0.02 0.02) l (mapcar '- spt f) r (mapcar '+ spt f) ss (ssget "X" (list '(0 . "INSERT") '(-4 . ">,>,>") (cons 10 l) '(-4 . "<,<,<") (cons 10 r) ) ) ) The fuzz factor can be set to be equal to cursor size (setq f (/ (* (getvar 'cursorsize) (getvar 'viewsize) 0.5) (cadr (getvar 'screensize)) ) ) Quote Link to comment Share on other sites More sharing options...
gpd Posted February 16, 2014 Author Share Posted February 16, 2014 Thanks everyone for the response. Block properties indicate that its elevation is 0. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 16, 2014 Share Posted February 16, 2014 Block properties indicate that its elevation is 0. The values in the properties palette are rounded to the precision given by the LUPREC system variable; to see the true coordinate values to their stored precision, use the following: (defun c:blkins ( / s ) (if (setq s (ssget "_+.:E:S" '((0 . "INSERT")))) (princ (apply 'strcat (mapcar 'strcat '("\n" " " " ") (mapcar '(lambda ( x ) (rtos x 2 15)) (cdr (assoc 10 (entget (ssname s 0)))) ) ) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
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.