Jerry_VN Posted July 22 Share Posted July 22 (edited) This is LeeMac's code, I want to add a total dimension line, can someone help me? (defun c:iDim ( / doc spc p1 p2 ss lst ) ;; ゥ Lee Mac 2010 (vl-load-com) (LM:ActiveSpace 'doc 'spc) (if (and (setq p1 (getpoint "\nSpecify First Point: ")) (setq p2 (getpoint "\nSpecify Second Point: " p1)) (setq ss (apply 'ssget (append (list "_C") (mapcar '(lambda ( foo ) (apply 'mapcar (cons foo (list p1 p2))) ) '(min max) ) (list '((0 . "~*DIMENSION"))) ) ) ) (setq lst ( (lambda ( l / i ) (setq i (LM:GetObjIntersectionsinSS l ss)) (vla-delete l) i ) (vlax-ename->vla-object (entmakex (list (cons 0 "LINE") (cons 10 p1) (cons 11 p2) ) ) ) ) ) ) (progn (setq lst (vl-sort lst '(lambda ( a b ) (< (distance p1 a) (distance p1 b))) ) ) (mapcar '(lambda ( p1 p2 ) (vla-AddDimAligned spc (vlax-3D-point p1) (vlax-3D-point p2) (vlax-3D-point p1) ) ) (reverse (cdr (reverse lst))) (cdr lst) ) ) ) (princ) ) (defun LM:GetObjIntersectionsinSS ( obj ss ) ;; ゥ Lee Mac 2010 ( (lambda ( i / j a b iLst ) (while (setq e (ssname ss (setq i (1+ i)))) (setq iLst (append iLst (LM:GroupByNUm (vlax-invoke obj 'IntersectWith (vlax-ename->vla-object e) acExtendNone ) 3 ) ) ) ) ) -1 ) ) (defun LM:GroupByNum ( l n / a b ) ;; ゥ Lee Mac 2010 (while l ( (lambda ( i ) (while (< 0 i) (setq a (cons (car l) a) l (cdr l) i (1- i)) ) (setq b (cons (reverse a) b) a nil) ) n ) ) (reverse b) ) (defun LM:ActiveSpace ( *doc *spc ) (set *spc (if (or (eq AcModelSpace (vla-get-ActiveSpace (set *doc (vla-get-ActiveDocument (vlax-get-acad-object) ) ) ) ) (eq :vlax-true (vla-get-MSpace (eval *doc))) ) (vla-get-ModelSpace (eval *doc)) (vla-get-PaperSpace (eval *doc)) ) ) ) Edited July 22 by SLW210 Added Code Tags! Quote Link to comment Share on other sites More sharing options...
SLW210 Posted July 22 Share Posted July 22 In the future please use Code Tags for code. (<> in the editor toolbar) 1 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 22 Share Posted July 22 Please post a sample dwg have done this before. Quote Link to comment Share on other sites More sharing options...
Jerry_VN Posted July 23 Author Share Posted July 23 please check it for example.dwg Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 23 Share Posted July 23 There was a Autodim post by Marko rebar today maybe try that. Now where is it ? Quote Link to comment Share on other sites More sharing options...
Jerry_VN Posted July 23 Author Share Posted July 23 Just help me where it is Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 27 Share Posted July 27 I thought I posted its in Downloads Quote Link to comment Share on other sites More sharing options...
SLW210 Posted July 28 Share Posted July 28 This one? 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.