Callout dimension of a chamfer by select 2 edges!

Callout dimension of a chamfer by select 2 edges!

Anonymous
Not applicable
2,766 Views
23 Replies
Message 1 of 24

Callout dimension of a chamfer by select 2 edges!

Anonymous
Not applicable

Chamfer.png

 

--------------------------------------------

Instead of callout the dimension 10x10, Can we choose 2 edges to callout a C10 as ficture above in Autocad or have a lisp to do that ?

0 Likes
Accepted solutions (2)
2,767 Views
23 Replies
Replies (23)
Message 21 of 24

hak_vz
Advisor
Advisor

I will later modify it to allow selection of lines and lwpolylines. If you any request just ask.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 22 of 24

Kent1Cooper
Consultant
Consultant
Accepted solution

If the answers to some of my earlier questions are that it will always be between orthogonal elements, here's another approach.  It works with either a Line or either kind of Polyline.  It simply checks the angle of the selected Line or Polyline line segment, and if it's at any of the 45° directions, it proceeds.  It refuses not only other object types but also arc segments of Polylines.

BUT, as with several other offerings on this thread, it will label any 45°-direction Line or Polyline line segment, whether or not it's actually a Chamfer, and even if it is, whether or not the adjacent Lines or Polyline segments extend orthogonally from its ends.  So it's up to the User to select only an appropriate object.

(vl-load-com)
(defun C:CCML ; = Chamfered Corner Multileader Label
  (/ *error* doc svn svv esel ent pick ang mid)
  (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break"))
      (princ (strcat "\nError: " errmsg))
    ); if
    (mapcar 'setvar svn svv); reset System Variables
    (vla-endundomark doc)
    (princ)
  ); defun - *error*
  (vla-startundomark (setq doc (vla-get-activedocument (vlax-get-acad-object))))
  (setq ; System Variable saving/resetting without separate variables for each:
    svn '(aperture orthomode); System Variable Names
    svv (mapcar 'getvar svn); System Variable current Values
  ); setq
  (mapcar 'setvar svn (list (getvar 'aperture) 0))
    ; prevent Osnapping to something else, Ortho off
  (setq esel (entsel "\nChamfered edge Line/Polyline: "))
  (if
    (and
      (setq ent (car esel) pick (cadr esel))
      (wcmatch (cdr (assoc 0 (entget ent))) "LINE,*POLYLINE")
      (not (osnap pick "_cen")); if on Polyline, not an arc segment
    ); and
    (progn ; then
      (setq ang
        (angle
          '(0 0)
          (vlax-curve-getFirstDeriv ent (vlax-curve-getParamAtPoint ent (setq mid (osnap pick "_mid"))))
        ); angle & ang
      ); setq
      (if
        (and
          (equal (rem ang (/ pi 4)) 0 1e-3); multiple of 45°
          (not (equal (rem ang (/ pi 2)) 0 1e-3)); but not multiple of 90°
        ); and
        (progn ; then
          (setq end (osnap pick "_end")); either end
          (command
            "_.mleader" "_non" mid pause
            (strcat "C" (rtos (* (distance mid end) (sqrt 0.5) 2))) ""
              ; in current Units mode/precision settings; use line below instead to round to integer
;;            (strcat "C" (rtos (* (distance mid end) (sqrt 0.5) 2) 2 0)) ""
          ); command
        ); progn
        (prompt "\nError - not equal-distance Chamfer of orthogonal edges."); else
      ); if [angle]
    ); progn
    (prompt "\nNothing selected, not a Line or Polyline, or on a Polyline arc segment."); else
  ); if [object type]
  (mapcar 'setvar svn svv); reset
  (vla-endundomark doc)
  (princ)
); defun
(prompt "\nType CCML for a Chamfered Corner Multileader Label.")

 

Kent Cooper, AIA
Message 23 of 24

Anonymous
Not applicable

Thank you so much, It meets my expectation!

0 Likes
Message 24 of 24

Kent1Cooper
Consultant
Consultant

@Kent1Cooper wrote:

....  If they are not always perpendicular, or not always orthogonal, but if the Chamfer setbacks are always equal, then choosing the two Lines or segments on either side of the corner, not the corner piece, would be more useful.


Just because of my interest in making routines as universal as I can, here's one that uses that approach to work with adjacent-to-the-Chamfer elements running in any direction and at any angular relationship.  I adapted code from another routine of mine that limits selection of those adjacent elements to straight things only [here further limiting it to Chamferable straight things], and also allows selection of nested objects, so you can label a Chamfer inside a Block/Xref.

 

It draws a LEADER instead of an MLEADER because the latter will misbehave if the current MLeader option is Content-first or Landing-first, rather than arrowHead-first.  And the ability to add more Leader arrows to an MLeader is not needed in this situation.

 

See comments at the top of the file, and the ;; lines near the end if you want the value rounded to the nearest whole number.

Kent Cooper, AIA
0 Likes