handasa Posted May 21, 2017 Share Posted May 21, 2017 Greetings everyone i have a set of points say: p1 = (x1 , y1 , z1) p2 = (x2 , y2 , z2) p3 = (x3 , y3 , z3) when i use (setq lst (cons p1 lst) ) (setq lst (cons p2 lst) ) (setq lst (cons p3 lst) ) the final list will looks like ((x1 y1 z1) (x2 y2 z2) x3 y3 z3) with the list length is 5 not 3 ... ie the third point is included between parenthesis i usde append instead of "cons" with no hope... any suggestions ? thanks in advance Quote Link to comment Share on other sites More sharing options...
Grrr Posted May 21, 2017 Share Posted May 21, 2017 _$ (setq lst (cons '(x1 y1 z1) lst)) ((X1 Y1 Z1)) _$ (setq lst (cons '(x2 y2 z2) lst)) ((X2 Y2 Z2) (X1 Y1 Z1)) _$ (setq lst (cons '(x3 y3 z3) lst)) ((X3 Y3 Z3) (X2 Y2 Z2) (X1 Y1 Z1)) Or just wrap them with the list function: _$ (list '(x1 y1 z1) '(x2 y2 z2) '(x3 y3 z3) ) ((X1 Y1 Z1) (X2 Y2 Z2) (X3 Y3 Z3)) Quote Link to comment Share on other sites More sharing options...
handasa Posted May 21, 2017 Author Share Posted May 21, 2017 _$ (setq lst (cons '(x1 y1 z1) lst)) ((X1 Y1 Z1)) _$ (setq lst (cons '(x2 y2 z2) lst)) ((X2 Y2 Z2) (X1 Y1 Z1)) _$ (setq lst (cons '(x3 y3 z3) lst)) ((X3 Y3 Z3) (X2 Y2 Z2) (X1 Y1 Z1)) Or just wrap them with the list function: _$ (list '(x1 y1 z1) '(x2 y2 z2) '(x3 y3 z3) ) ((X1 Y1 Z1) (X2 Y2 Z2) (X3 Y3 Z3)) it works well ... thanks.. excuse me i have another question and it doesn't worth to open a new thread for it ... ... i have a selection set "ss1" i want to select among it's entites the ones which intersect with points p1 and p2 i tried (setq ssj (ssget "F" (list p1 p4) ) ss1) but it comes with error message :bad point argument when i use (setq ssj (ssget "F" (list p1 p4) ) ) .. it works well ... but i need only entites from ss1 not all objects... thanks Quote Link to comment Share on other sites More sharing options...
Grrr Posted May 21, 2017 Share Posted May 21, 2017 i have a selection set "ss1" i want to select among it's entites the ones which intersect with points p1 and p2 i tried (setq ssj (ssget "F" (list p1 p4) ) ss1) but it comes with error message :bad point argument Reason that you get the error message is that you cannot provide SS as an argument to the ssget function, Check Lee Mac's tutorial/reference about ssget (the fence example). Quoting from there: (ssget "_F" '((0 0) (1 1)) '((0 . "LINE"))) means.. (ssget "_F" pL ssfL) Where pL - means point list (list of points) ssfL - means ssget filter list - assoc list of dotted pairs [optional] So I'd iterate over the "ssj" and exclude using ssmemb the entities that are not in "ss1", grouping them in "newSS": (if (and (setq ssj (ssget "_F" (list p1 p2 p3 p4))) ; I guess you want the fence through the points, not just the endpoints (setq newSS (ssadd)) ; create new empty selection set ) (progn ; iterate over the "ssj" and grip the "newSS" (repeat (setq index (sslength ssj)) (setq ent (ssname ssj (setq index (1- index)))) ; nth entity of the selection set (if (ssmemb ent ss1) (ssadd ent newSS)) ; if that entity is inside the "ss1", then collect it in "newSS" ); repeat (sssetfirst nil newSS) ; grip "newSS" ); progn ); if But perfectly only one iteration is enough, if we knew what are the filter criterias for "ss1". Quote Link to comment Share on other sites More sharing options...
handasa Posted May 21, 2017 Author Share Posted May 21, 2017 Reason that you get the error message is that you cannot provide SS as an argument to the ssget function,Check Lee Mac's tutorial/reference about ssget (the fence example). Quoting from there: means.. (ssget "_F" pL ssfL) Where pL - means point list (list of points) ssfL - means ssget filter list - assoc list of dotted pairs [optional] So I'd iterate over the "ssj" and exclude using ssmemb the entities that are not in "ss1", grouping them in "newSS": (if (and (setq ssj (ssget "_F" (list p1 p2 p3 p4))) ; I guess you want the fence through the points, not just the endpoints (setq newSS (ssadd)) ; create new empty selection set ) (progn ; iterate over the "ssj" and grip the "newSS" (repeat (setq index (sslength ssj)) (setq ent (ssname ssj (setq index (1- index)))) ; nth entity of the selection set (if (ssmemb ent ss1) (ssadd ent newSS)) ; if that entity is inside the "ss1", then collect it in "newSS" ); repeat (sssetfirst nil newSS) ; grip "newSS" ); progn ); if But perfectly only one iteration is enough, if we knew what are the filter criterias for "ss1". .. thanks a lot for your time and good explanation ....the ss1 are only of the type "line" if this make a different Quote Link to comment Share on other sites More sharing options...
Grrr Posted May 21, 2017 Share Posted May 21, 2017 ....the ss1 are only of the type "line" if this make a different Then you could just do this: (sssetfirst nil (ssget "_F" (list p1 p2 p3 p4) '((0 . "LINE")))) Ofcourse if you intend only to "grip" the selection set. 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.