automatiing radius dimension

automatiing radius dimension

Anonymous
Not applicable
1,623 Views
1 Reply
Message 1 of 2

automatiing radius dimension

Anonymous
Not applicable

Hello.

I encountered for very usable autolisp called dimr. It makes automaticly lenght dimensions of arch, polylines and lines, but sometimes I need to make dimensions of radius. Could someone help me to improve this lisp? It have to have make automaticly radius dimension from multiple selected arch or polylines in center of arch like in screenshot.

 

(vl-load-com)
(defun c:dimr (/ *error* acsp adoc cent dimobj dimp ent obj osm rad)
   ;;error trapping function
   ;; by Doug Broad (edited)
    (defun *error* (msg)
    (cond ((or (not msg)
	       (member msg '("console break" "Function cancelled" "quit / exit abort"))
	       )
	   )
	  ((princ (strcat "\nError: " msg)))
	  )
      (if osm (setvar "osmode" osm))
      (command "._undo" "_end")
      (command)
    (princ)
    )
  
  (command "._undo" "_begin")
  (setq osm (getvar "osmode"))
  (setvar "osmode" 512)
  (or adoc
      (setq adoc
	     (vla-get-activedocument
	       (vlax-get-acad-object)
	     )
      )
  )
  (if (zerop (getvar "tilemode"))	
    (setq acsp (vla-get-paperspace adoc))
    (setq acsp (vla-get-modelspace adoc))
  )

  (while (setq ent (entsel "\n  >>  Select circle or arc (press Enter to Exit) >> "))
    (setq dimp (cadr ent))
  (setq	obj (vlax-ename->vla-object
	      (car ent)
	    )
  )
  (if (or (eq "AcDbCircle" (vla-get-objectname obj))
	  (eq "AcDbArc" (vla-get-objectname obj))
      )
    (progn
      (setq cent (vlax-get obj 'Center)
	    rad	 (vlax-get obj 'Radius)
      )
      (setvar "osmode" 512)
      (setq dimp
	     (vlax-curve-getclosestpointto
	       obj
	       (osnap
;;;		 (getpoint cent "\n  >>  Specify point on object  >> ");<-- to specify a point manually
		 dimp
		 "_nea"
	       )
	     )
      )

      (setq dimobj (vlax-invoke
		     acsp 'Adddimradial	cent dimp 0.0)
      )
      (vlax-put dimobj 'Textposition cent)
    )
  )
	       )
  (*error* nil)
  (princ)
)
(prompt "\n\t***\tProgram to draw radial dimension loaded \n")
(prompt "\n\t***\tType DIMR to execute.. ")
(prin1)

 

 

 

0 Likes
1,624 Views
1 Reply
Reply (1)
Message 2 of 2

devitg
Advisor
Advisor

Please test it . the command is 

 

autrad    

0 Likes