Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Autocad spray 2

Status
Not open for further replies.

Przy

Mechanical
Nov 30, 2016
2
0
0
US
thread555-44373 Hi.. Can anyone help me spray closed donuts in AutoCAD. I got the spray to spray points but need solid circles. Thank you.

Here is the lisp that I used from the thread posted in Feb.

(princ "Type SPRAY to start")
(defun c:spray ()
(setvar "cmdecho" 0)
(setq CurRead T TimeTol 0.0000002)
(setq OldTime (getvar "CDATE"))
(while CurRead
(setq ReadStuff (grread T 5 0)
NewTime (getvar "CDATE")
DeltaTime (- NewTime OldTime)
SprayFlag (if (> DeltaTime TimeTol) T nil)
);
(if (/= (car ReadStuff) 5) (setq CurRead nil))
(if SprayFlag
(progn
(setq Pt (cadr ReadStuff))
(entmake (list '(0 . "POINT") (cons 10 Pt)))
;;(command "point" Pt)
(setq OldTime NewTime)
);progn
);if
);while
(princ)
);defun
 
Replies continue below

Recommended for you

Try this modified code:
Code:
(princ "Type SPRAY to start")
 (defun c:spray ()
 (setvar "cmdecho" 0)
 (setq DoDi 0.5) ;;set desired donut OD here
 (setq DoR (/ DoDi 2))
 (setq hador (/ DoDi 4))
 (setq CurRead T TimeTol 0.00000005)
 (setq OldTime (getvar "CDATE"))
 (while CurRead
 (setq ReadStuff (grread T 5 0)
 NewTime (getvar "CDATE")
 DeltaTime (- NewTime OldTime)
 SprayFlag (if (> DeltaTime TimeTol) T nil)
 );
 (if (/= (car ReadStuff) 5) (setq CurRead nil))
 (if SprayFlag
 (progn
 (setq Pt (cadr ReadStuff))
 (setq PtL (mapcar '- pt (list hador 0.0)))
 (setq PtR (mapcar '+ pt (list hador 0.0)))
 (entmake (list 
 			'(0 . "LWPOLYLINE")
			'(100 . "AcDbEntity")
 			'(100 . "AcDbPolyline")
			'(90 . 2)
			'(70 . 1)
			(cons 43 DoR)
			(cons 10 ptL)
			'(42 . 1.0)
			(cons 10 ptR)
			'(42 . 1.0)
	))
 (setq OldTime NewTime)
 );progn
 );if
 );while
 );defun
 (princ)
 
Status
Not open for further replies.
Back
Top