Jump to content

radius dimension for the selected arcs


m.alshboul

Recommended Posts

You can simply obtain DXF group 40 for the arcs, e.g.:

(defun c:test ( / i s )
    (if (setq s (ssget '((0 . "ARC"))))
        (repeat (setq i (sslength s))
            (princ (strcat "\nArc radius: " (rtos (cdr (assoc 40 (entget (ssname s (setq i (1- i)))))))))
        )
    )
    (princ)
)

 

Link to comment
Share on other sites

Lisp writes the values of the radii of the arcs in the command string, but how to make the dimensions of the arcs in

the drawing? Is it possible to add a circle as well?

 

 

Image 4.png

Edited by Nikon
Link to comment
Share on other sites

So circles exist, do dimensions Program 1 ?

No circles exist add circle and do dims, Program 2 ?

 

Explain more details please.

Edited by BIGAL
Link to comment
Share on other sites

Thanks, Mr. Lee Mac, but as Mr. Nikon said I need to make the dimensions of the arcs, all arcs at one time, and when you add the circles the lisp will be more amazing.

Link to comment
Share on other sites

Untested...

 

(defun c:test ( / i s e )
    (if (setq s (ssget '((0 . "CIRCLE,ARC"))))
        (repeat (setq i (sslength s))
            (setq e (ssname s (setq i (1- i))))
            (vl-cmdf "_.DIMRAD" e (vlax-curve-getpointatdist e (/ (vlax-curve-getdistatparam e (vlax-curve-getendparam e)) 2.0))) 
        )
    )
    (princ)
)

 

Edited by marko_ribar
Link to comment
Share on other sites

In AutoCAD, create a radius. At the command prompt, type r (Radius)

See in the command line how the Radius command is displayed, 
copy and paste into lisp instead of "_.DIMRAD" (perhaps  "DIMRADIUS")

(defun c:test ( / i s e ) 
(if (setq s (ssget '((0 . "CIRCLE,ARC")))) 
(repeat (setq i (sslength s)) (setq e (ssname s (setq i (1- i)))) 
(vl-cmdf "DIMRADIUS" e (vlax-curve-getpointatdist e (/ (vlax-curve-getdistatparam e (vlax-curve-getendparam e)) 2.0))) ) ) 
(princ) 
)

 

Edited by Nikon
Link to comment
Share on other sites

have you tried with this?  "_dimradius"

(defun c:test ( / i s e )
 (if (setq s (ssget '((0 . "CIRCLE,ARC"))))
 (repeat (setq i (sslength s))
 (setq e (ssname s (setq i (1- i))))
 (vl-cmdf "_dimradius" e (vlax-curve-getpointatdist e (/ (vlax-curve-getdistatparam e (vlax-curve-getendparam e)) 2.0))) 
 )
 )
 (princ)
)

 

Link to comment
Share on other sites

And to test, if you copy and paste this code directly into the command line?

((lambda ( / ent dxf_ent)
  (while (not (eq ent "eXit"))
    (initget "eXit")
    (while (null (setq ent (entsel "\nSelect an arc or a circle to dim, [eXit] for quit: "))) (initget "eXit"))
    (if (/= ent "eXit")
      (progn
        (setvar "cmdecho" 0)
        (setq dxf_ent (entget (car ent)))
        (cond
          ((eq (cdr (assoc 0 dxf_ent)) "ARC")
            (command "_.dimradius" (cadr ent) "")
          )
          ((eq (cdr (assoc 0 dxf_ent)) "CIRCLE")
            (command "_.dimdiameter" (cadr ent) "")
          )
          (T
            (princ "\nIsn't an arc or circle!")
          )
        )
        (setvar "cmdecho" 1)
      )
    )
  )
  (prin1)
))

 

Link to comment
Share on other sites

TSUKY does not work in Bricscad V20.

 

(command "_.dimdiameter" (cadr ent) "")

 _.dimdiameter
Select arc or circle to dimension:
Opposite Corner: 
Invalid window specified.
Opposite Corner: nil
Opposite Corner: 
Cancel

 

NIKON works needs tuning to suit dim style etc, minor issue dwg dependant.

 

Link to comment
Share on other sites

The Tsuky code works in AutoCAD 2020 (Only selects not all objects, but one object),

and what needs to be added to make a full-fledged lisp
(defun c:test...???

Edited by Nikon
Link to comment
Share on other sites

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