m.alshboul Posted November 18, 2023 Posted November 18, 2023 Greets is there any lisp to find the radius dimension for selected arcs in one time? Quote
Lee Mac Posted November 18, 2023 Posted November 18, 2023 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) ) Quote
Nikon Posted November 18, 2023 Posted November 18, 2023 (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? Edited November 18, 2023 by Nikon Quote
BIGAL Posted November 19, 2023 Posted November 19, 2023 (edited) So circles exist, do dimensions Program 1 ? No circles exist add circle and do dims, Program 2 ? Explain more details please. Edited November 19, 2023 by BIGAL Quote
Nikon Posted November 19, 2023 Posted November 19, 2023 Circles and arcs exist. Select all and get the radius of all in one time... The result is as in the picture posted 11. Quote
m.alshboul Posted November 19, 2023 Author Posted November 19, 2023 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. Quote
marko_ribar Posted November 19, 2023 Posted November 19, 2023 (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 November 19, 2023 by marko_ribar Quote
Nikon Posted November 19, 2023 Posted November 19, 2023 (edited) Lisp works great! Thank you very much, @marko_ribar! Good luck! Edited December 14, 2023 by Nikon Quote
Nikon Posted November 19, 2023 Posted November 19, 2023 m.alshboul Specify the command for your version of AutoCAD, you may need to change "_.DIMRAD" to "_dimradius" or another variant. Quote
m.alshboul Posted November 19, 2023 Author Posted November 19, 2023 I have AutoCAD 2024, i don't know what I will do Quote
Nikon Posted November 19, 2023 Posted November 19, 2023 (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 November 19, 2023 by Nikon Quote
Nikon Posted November 19, 2023 Posted November 19, 2023 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) ) Quote
m.alshboul Posted November 19, 2023 Author Posted November 19, 2023 I bothered you with me, I'm really sorry but this doesn't work Quote
Nikon Posted November 19, 2023 Posted November 19, 2023 I have AutoCAD 2015 at home, tomorrow at work I will try it in AutoCAD 2020... Or someone else will tell you... 1 Quote
Tsuky Posted November 19, 2023 Posted November 19, 2023 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) )) Quote
BIGAL Posted November 20, 2023 Posted November 20, 2023 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. Quote
Nikon Posted November 20, 2023 Posted November 20, 2023 (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 November 20, 2023 by Nikon Quote
m.alshboul Posted November 20, 2023 Author Posted November 20, 2023 thanks Bigal, but this not working as me want 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.