wimal Posted April 26, 2018 Share Posted April 26, 2018 Can somebody help me to find out a code to obtain an angle of a nested line object by selecting it. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 26, 2018 Share Posted April 26, 2018 (edited) An example: (defun c:test ( / enx lst mat ) (cond ( (not (setq lst (nentselp "\nSelect nested line: "))) (princ "\nNo object selected.") ) ( (/= 4 (length lst)) (princ "\nThe selected object is not nested.") ) ( (/= "LINE" (cdr (assoc 0 (setq enx (entget (car lst)))))) (princ "\nThe selected object is not a line.") ) ( (setq mat (mapcar 'rcdr (rcdr (caddr lst)))) (princ (angtos (apply 'angle (mapcar '(lambda ( x ) (mxv mat (cdr (assoc x enx)))) '(10 11))))) ) ) (princ) ) ;; Reverse cdr - Lee Mac ;; Returns all but the last item of a list (defun rcdr ( l ) (reverse (cdr (reverse l))) ) ;; Matrix x Vector - Vladimir Nesterovsky ;; Args: m - nxn matrix, v - vector in R^n (defun mxv ( m v ) (mapcar '(lambda ( r ) (apply '+ (mapcar '* r v))) m) ) (princ) Edited April 27, 2018 by Lee Mac Quote Link to comment Share on other sites More sharing options...
wimal Posted April 27, 2018 Author Share Posted April 27, 2018 Thanks. I know you are the person writing this kind of codes. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 27, 2018 Share Posted April 27, 2018 You're welcome wimal. 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.