Jump to content

ssget returns nil


gpd

Recommended Posts

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

Link to comment
Share on other sites

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 by pBe
Link to comment
Share on other sites

(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

Link to comment
Share on other sites

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))
       )
)

Link to comment
Share on other sites

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)
)

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...