Jump to content

Recommended Posts

Posted

EX.jpg

 

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?

  • Replies 93
  • Created
  • Last Reply

Top Posters In This Topic

  • ryan osmun

    36

  • ReMark

    31

  • Tharwat

    24

  • RobDraw

    3

Top Posters In This Topic

Posted Images

Posted

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.

Posted

AutoDim1.jpg

I drew the lines between the circles.

AutoDim put in the dimensions.

Posted
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)
)

Posted

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.

Posted

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.

Posted
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.

Posted

i just used your exact lsp you made and that is perfect!!!

Posted

DimStyle2.JPG

And here are the other changes I made.

 

Then I just made sure to draw all my connecting lines from left to right.

Posted

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.

Posted

If you have to draw the lines, you may as well draw dimensions. Yes or no?

Posted

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.

Posted (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 by Tharwat
Unneeded extra code deleted
Posted
thats awesome thanks so much!!

 

You're welcome , and happy that you find it useful :)

Posted

one more thing lol could you make that lisp so that its metric also?

Posted

Tharwat: Thanks for taking the time to revise your code to meet Ryan's needs. You are an asset to the CADTutor forum.

Posted
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 .

Posted

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...