TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: civil.eng on May 10, 2021, 06:31:02 PM

Title: All circle diameter
Post by: civil.eng on May 10, 2021, 06:31:02 PM
Hi everyone,
I have a drawing that contains lots of circle and I need a lisp to select all the circles and then the lisp create diameter dimension to all of them, like this :

can someone help me?
Title: Re: All circle diameter
Post by: Lee Mac on May 10, 2021, 06:46:20 PM
Quick one:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:cdim ( / a c d e i r s v x )
  2.     (setq a (* pi 1.25) ;; Angle from center
  3.           d 0.25        ;; Multiple of radius from center
  4.     )
  5.     (if (setq s (ssget '((0 . "CIRCLE"))))
  6.         (progn
  7.             (setq v (getvar 'cmdecho))
  8.             (setvar 'cmdecho 0)
  9.             (repeat (setq i (sslength s))
  10.                 (setq i (1- i)
  11.                       e (ssname s i)
  12.                       x (entget e)
  13.                       c (trans (cdr (assoc 10 x)) e 1)
  14.                       r (cdr (assoc 40 x))
  15.                 )
  16.                 (command "_.dimdiameter" (list e (polar c a r)) "_non" (polar c a (* r d)))
  17.             )
  18.             (setvar 'cmdecho v)
  19.         )
  20.     )
  21.     (princ)
  22. )
Title: Re: All circle diameter
Post by: civil.eng on May 11, 2021, 02:48:44 AM
Thank you so much sir,
Can you rewrite it by vla-adddimDiametric ??
Thanks in advanced.
Title: Re: All circle diameter
Post by: BIGAL on May 11, 2021, 05:10:54 AM
Why are you not happy with the free answer ? If you want a VL solution have a go. Just google, Lee has done most of the work for you.
Title: Re: All circle diameter
Post by: Lee Mac on May 11, 2021, 06:04:06 AM
Can you rewrite it by vla-adddimDiametric ??

Why?
Title: Re: All circle diameter
Post by: jtoverka on May 11, 2021, 09:56:43 AM
The only reason one needs a VL instead of command is to use objectDBX. That aside the work is already done for you.
Title: Re: All circle diameter
Post by: HOSNEYALAA on May 11, 2021, 01:21:08 PM
TRY ANTHER  LISP FROM LEE

https://www.theswamp.org/index.php?topic=49517.0
Title: Re: All circle diameter
Post by: JohnK on May 11, 2021, 01:40:35 PM
Title: Re: All circle diameter
Post by: d2010 on May 24, 2021, 07:59:40 AM
SubTitle=I change whiteBackGround to manyGreen.
Q1=How to replace the onlyALL->manyGreen with other Image isInside a23.jpg?
Q2=You need execute (dfn_cmd_canceld) all times? (for; You must be sure, make flow-Control of Commands-Prompt with "dfn_cmd_canceld").
 :embarrassed:
Thank you so much sir,
Can you rewrite it by vla-adddimDiametric ??
Thanks in advanced.
You found full source "pp_tdcirclediameter.lsp"
Title: Re: All circle diameter
Post by: ribarm on June 27, 2022, 11:54:07 PM
@all circle diameter (radiuses) ???