ryan osmun Posted October 10, 2012 Author Posted October 10, 2012 just trying to show more in depth of what i need. the example on the left i made by hand to show exactly what i would like. the one on the right is showing the exact way that the autodim command works. does this make sense? Quote
ryan osmun Posted October 10, 2012 Author Posted October 10, 2012 so i could draw the lines in thats not the biggest issue. the only issue im having is that the text with the autodim command is messy and not always upright or close enough to the line. Quote
ReMark Posted October 10, 2012 Posted October 10, 2012 I drew the lines between the circles. AutoDim put in the dimensions. Quote
Tharwat Posted October 10, 2012 Posted October 10, 2012 so i could draw the lines in thats not the biggest issue. the only issue im having is that the text with the autodim command is messy and not always upright or close enough to the line. I modified the routine to meet your needs for now , which is would make and put the dimension entity on the line exactly besides that would delete the selected line since that you draw them only to run the code . (defun c:AutoDim (/ spc acdoc Textheight CurrentTextstyle selectionset) ;;; Tharwat 10. Oct. 2012 ;;; (vl-load-com) (setq spc (if (> (vla-get-activespace (setq acdoc (vla-get-activedocument (vlax-get-acad-object)) ) ) 0 ) (vla-get-modelspace acdoc) (vla-get-paperspace acdoc) ) ) (setq Textheight (if (eq (cdr (assoc 40 (setq CurrentTextstyle (entget (tblobjname "style" (getvar 'Textstyle)) ) ) ) ) 0. ) (cdr (assoc 42 CurrentTextstyle)) (cdr (assoc 40 CurrentTextstyle)) ) ) (if (setq selectionset (ssget '((0 . "LINE")))) (progn (vla-StartUndoMark acdoc) ((lambda (intger / selectionsetname entgetlist dimension p1 p2) (while (setq selectionsetname (ssname selectionset (setq intger (1+ intger)) ) ) (setq entgetlist (entget selectionsetname)) (setq dimension (vla-adddimaligned spc (vlax-3d-point (setq p1 (cdr (assoc 10 entgetlist))) ) (vlax-3d-point (setq p2 (cdr (assoc 11 entgetlist))) ) (vlax-3d-point (setq p2 (cdr (assoc 11 entgetlist))) ) ) ) (vla-put-textrotation dimension (angle p1 p2)) (entdel selectionsetname) ) ) -1 ) (vla-EndUndoMark acdoc) ) (princ "\n < *** No lines selected *** >") ) (princ) ) Quote
ReMark Posted October 10, 2012 Posted October 10, 2012 Ryan: The text position relative to the line is controlled via two options in the DimStyle dialog box. I think "how" the lines are drawn may address your comment re: messy. Quote
ryan osmun Posted October 10, 2012 Author Posted October 10, 2012 thats how it came out for you? that looks good, i know its spread out more than most drawings i would have, but it seems to be coming out better than mine are. Quote
ReMark Posted October 10, 2012 Posted October 10, 2012 thats how it came out for you? that looks good, i know its spread out more than most drawings i would have, but it seems to be coming out better than mine are. Yes, that is how it came out for me. The difference is I tweaked a couple of DimStyle settings and I paid close attention to how I drew my interconnecting lines. Quote
ryan osmun Posted October 10, 2012 Author Posted October 10, 2012 i just used your exact lsp you made and that is perfect!!! Quote
ReMark Posted October 10, 2012 Posted October 10, 2012 And here are the other changes I made. Then I just made sure to draw all my connecting lines from left to right. Quote
ryan osmun Posted October 10, 2012 Author Posted October 10, 2012 the only other thing that could make it better for me is if you could figure out a way to do that same thing with out having to draw in the lines. i owe a ton of thanks for this! if i can pay you or do anything let me know. Quote
RobDraw Posted October 10, 2012 Posted October 10, 2012 If you have to draw the lines, you may as well draw dimensions. Yes or no? Quote
ryan osmun Posted October 10, 2012 Author Posted October 10, 2012 i guess but the way that i am drawing dimension lines takes me a lot more time then this does. i have it set up to where i i have the center, and intersection off sets on. so i have to click the center of the circle go to the next circle click there and then click once again in the center of the circle to place the dim line where i want it (in between the two circles). when i dim it to the perimeter i click center of the circle go to the perimeter click the intersection then go back to the circle to click in the center to place the line. its very tedious and with those two off sets it grabs many other places than where i would like it to. so with what you have came up with it still saves me quite a bit of time. i know its hard to tell on these little designs but when i have a 1500 sq ft area it can be time consuming. Quote
Tharwat Posted October 10, 2012 Posted October 10, 2012 (edited) Then I just made sure to draw all my connecting lines from left to right. No need for that anymore , here is the final code which I think it is complete now and hope this helps . (defun c:AutoDim (/ spc acdoc Textheight CurrentTextstyle selectionset ang) ;;; Tharwat 10. Oct. 2012 ;;; (vl-load-com) (setq spc (if (> (vla-get-activespace (setq acdoc (vla-get-activedocument (vlax-get-acad-object)) ) ) 0 ) (vla-get-modelspace acdoc) (vla-get-paperspace acdoc) ) ) (if (setq selectionset (ssget '((0 . "LINE")))) (progn (vla-StartUndoMark acdoc) ((lambda (intger / selectionsetname entgetlist dimension p1 p2) (while (setq selectionsetname (ssname selectionset (setq intger (1+ intger)) ) ) (setq entgetlist (entget selectionsetname)) (setq dimension (vla-adddimaligned spc (vlax-3d-point (setq p1 (cdr (assoc 10 entgetlist))) ) (vlax-3d-point (setq p2 (cdr (assoc 11 entgetlist))) ) (vlax-3d-point (setq p2 (cdr (assoc 11 entgetlist))) ) ) ) (setq ang (angle p1 p2)) (cond ((and (>= ang (/ pi 2.)) (<= ang (+ pi (/ pi 2.)))) (setq ang (+ ang pi)) ) ((= ang pi) (setq ang (- ang pi))) ((> ang 0.0) (setq ang (- ang (+ pi pi)))) ) (vla-put-textrotation dimension ang ) (entdel selectionsetname) ) ) -1 ) (vla-EndUndoMark acdoc) ) (princ "\n < *** No lines selected *** >") ) (princ) ) Edited October 11, 2012 by Tharwat Unneeded extra code deleted Quote
ryan osmun Posted October 10, 2012 Author Posted October 10, 2012 thats awesome thanks so much!! Quote
Tharwat Posted October 10, 2012 Posted October 10, 2012 thats awesome thanks so much!! You're welcome , and happy that you find it useful Quote
ryan osmun Posted October 10, 2012 Author Posted October 10, 2012 one more thing lol could you make that lisp so that its metric also? Quote
ReMark Posted October 10, 2012 Posted October 10, 2012 Tharwat: Thanks for taking the time to revise your code to meet Ryan's needs. You are an asset to the CADTutor forum. Quote
Tharwat Posted October 11, 2012 Posted October 11, 2012 one more thing lol could you make that lisp so that its metric also? Noting related to the code to change it to metric or inches , just adjust your current Dimension style and you 'd get it as you wish . Tharwat: Thanks for taking the time to revise your code to meet Ryan's needs. You are an asset to the CADTutor forum. It is very kind of you to say that Remark. Thanks . Quote
ReMark Posted October 11, 2012 Posted October 11, 2012 I have a suggestion Tharwat. You should retain both versions. I would rename one of them as DimAuto though as to avoid any confusion. There will be people who prefer not to have their lines replaced by dimensions. You might also want to add a line in the file itself that tells the use your lisp routine works with lines only. Quote
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.