Jump to content

radius dimension for the selected arcs


Recommended Posts

Posted

Greets 
is there any lisp to find the radius dimension for selected arcs in one time?

Posted

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

 

Posted (edited)

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

So circles exist, do dimensions Program 1 ?

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

 

Explain more details please.

Edited by BIGAL
Posted

Circles and arcs exist. Select all and get the radius of all in one time...

The result is as in the picture posted 11. 

Posted

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.

Posted (edited)

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

Lisp works great! Thank you very much, @marko_ribar! Good luck!

Edited by Nikon
Posted

m.alshboul

Specify the command for your version of AutoCAD, you may need to change "_.DIMRAD" to "_dimradius" or another variant.

Posted

I have AutoCAD 2024, i don't know what I will do

Posted (edited)

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
Posted

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

 

Posted

I bothered you with me, I'm really sorry but this doesn't work

Posted

I have AutoCAD 2015 at home, tomorrow at work I will try it in AutoCAD 2020...
Or someone else will tell you...

  • Like 1
Posted

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

 

Posted

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.

 

Posted (edited)

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
Posted

thanks Bigal, but this not working as me want

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