wimal Posted May 16, 2018 Share Posted May 16, 2018 (setq pt(nentsel (strcat "\n Select a leader < exit > : ")));get entity (setq e (entget (car pt)));;association list of entity (setq p1 (assoc 10 e)) How can I get 3 points of leader. Quote Link to comment Share on other sites More sharing options...
tombu Posted May 16, 2018 Share Posted May 16, 2018 (edited) Use the lisp function MEMBER It searches a list for an occurrence of an expression and returns the remainder of the list, starting with the first occurrence of the expression so: (defun C:test (/ e pt p2 p3) (setq pt(nentsel (strcat "\n Select a leader < exit > : ")) e (entget (car pt));;association list of entity e (member (assoc 10 e) e) p1 (cdr (assoc 10 e));; cdr removes the 10 leaving the coordinates. e (cdr e) p2 (cdr (assoc 10 e)) e (cdr e) p3 (cdr (assoc 10 e)) ) (princ "\np1=")(princ p1)(princ ", p2=")(princ p2)(princ ", p3=")(princ p3)(princ) ) should return what you're looking for. You may want to search for qlset.lsp by Frank Whaley who worked for Autodesk. This code allows you to examine the current QLEADER settings, or to initialize the setting before using the QLEADER command. It can tell you how many points the leader has for example. Not everyone uses the default settings. Edited May 16, 2018 by tombu Added output Quote Link to comment Share on other sites More sharing options...
Grrr Posted May 16, 2018 Share Posted May 16, 2018 First define a function that will check for that group code key, and return its value: (defun IsItDxf10 ( x ) (if (= (car x) 10) (cdr x)) ) Second learn how to use vl-remove-if-not function to retrieve the items from the list that match the function's criteria. Assuming that you know the dxf elist is obtained via (entget ). Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 16, 2018 Share Posted May 16, 2018 Use a method similar to that which I describe here. Quote Link to comment Share on other sites More sharing options...
wimal Posted May 17, 2018 Author Share Posted May 17, 2018 Thanks all fore helping me. Quote Link to comment Share on other sites More sharing options...
wimal Posted June 4, 2018 Author Share Posted June 4, 2018 Now I need to feed new value to third point of the leader. How can do that. Pl.help Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 4, 2018 Share Posted June 4, 2018 Now I need to feed new value to third point of the leader. How can do that. Pl.help You could use a function similar to the following: (defun substnthkey ( idx key val lst / cnt ) (setq cnt -1) (mapcar (function (lambda ( itm ) (cond ( (/= key (car itm)) itm) ( (/= idx (setq cnt (1+ cnt))) itm) ( (cons key val)) ) ) ) lst ) ) Example: _$ (substnthkey 1 10 '(0 0 0) '((1 . "A") (2 . "B") (10 1 2 3) (3 . "C") (10 2 3 4) (4 . "D") (10 3 4 5))) ((1 . "A") (2 . "B") (10 1 2 3) (3 . "C") (10 0 0 0) (4 . "D") (10 3 4 5)) This could also be written recursively: (defun substnthkey-rec ( idx key val lst ) (cond ( (null lst) nil) ( (or (/= key (caar lst)) (< -1 (setq idx (1- idx)))) (cons (car lst) (substnthkey-rec idx key val (cdr lst))) ) ( (cons (cons key val) (cdr lst))) ) ) Quote Link to comment Share on other sites More sharing options...
Grrr Posted June 4, 2018 Share Posted June 4, 2018 Thumbs up, Lee! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 4, 2018 Share Posted June 4, 2018 Thanks Grrr Quote Link to comment Share on other sites More sharing options...
wimal Posted June 5, 2018 Author Share Posted June 5, 2018 Thanks Mr Lee Mac 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.