Jump to content

please help - function returns Nil


muthu123

Recommended Posts

i have copied the following result from console window. If you look at it the pt1 is part of the purlin_ins_pt_list_left. But when i use the function member it returns nil. Please suggest the correct way.

_$ pt1
(8955.33 6895.53 0.0)
_$ purlin_ins_pt_list_left
((1492.56 6149.26 0.0) (2985.11 6298.51 0.0) (4477.67 6447.77 0.0) (5970.22 6597.02 0.0) (7462.78 6746.28 0.0) (8955.33 6895.53 0.0) (10447.9 7044.79 0.0) (11940.4 7194.04 0.0) (13433.0 7343.3 0.0) (14925.6 7492.56 0.0))
_$ (member pt1 purlin_ins_pt_list_left)
nil
_$ 

Link to comment
Share on other sites

It could be the precision of either pt1 or purlin_ins_pt_list_left

 

 

The concept is correct though

 

(setq pt1 '(8955.33 6895.53 0.0))

(setq purlin_ins_pt_list_left '((1492.56 6149.26 0.0) (2985.11 6298.51 0.0) (4477.67 6447.77 0.0) (5970.22 6597.02 0.0) (7462.78 6746.28 0.0) (8955.33 6895.53 0.0) (10447.9 7044.79 0.0) (11940.4 7194.04 0.0) (13433.0 7343.3 0.0) (14925.6 7492.56 0.0)))

(member pt1 purlin_ins_pt_list_left)

Link to comment
Share on other sites

( member ) looks for exact matches so Jammie is probably correct with the precession query

 

I'd try something like this:

(setq found nil)
(foreach p  purlin_ins_pt_list_left
  (and (equal p pt1 1e-4)
       (setq found T)))
found

 

-David

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