afwjlk2 Posted September 17, 2014 Share Posted September 17, 2014 Found this one in a forum. Can anyone clean this up? Thank you in advance. ;;-------------------Solid Hatch}-----------------------;; ;; ;; ;; Creates a solid hatch ;; ;; with respect to the color of the objects ;; ;;------------------------------------------------------;; (defun c:Sldhtch (/ *error* v l ss doc) (defun C:hatchcol2 ( / obj hatcol pt) (vl-load-com) (princ "\nPlease pick object for color") (setq obj (car (entsel))) (setq hatcol (vlax-get-property (vlax-Ename->Vla-Object obj) 'color)) (setq pt (getpoint "\nPlease pick inside objects")) (setvar "HPNAME" "Solid") ;set hatch pattern (command "-Hatch" pt "" "CO" hatcol "" "") ) (defun *error* (x) (if v (mapcar 'setvar '(HPNAME CMDECHO) v) ) (if (wcmatch (strcase x) "*BREAK*,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " x " **")) ) ) (setq l (entlast) v (mapcar 'getvar '(HPNAME CMDECHO)) ) (if (setq ss (ssget "_:L" '((0 . "SPLINE")))) (progn (mapcar 'setvar '(HPNAME CMDECHO) '("SOLID" 0)) (setq l (entlast)) (vla-startUndomark (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))) ((lambda (i / sn c o) (while (setq sn (ssname ss (setq i (1+ i)))) (command "_.-hatch" "S" sn "" "") (if (not (eq l (setq o (entlast)))) (if (setq c (assoc 62 (entget sn))) (entmod (append (entget o) (list (cons 62 (cdr c))))) (entmod (append (entget o) '((62 . 256)))) ) ) (setq l o) ) ) -1 ) (vla-Endundomark doc) ) ) (*error* nil) )(vl-load-com) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 18, 2014 Share Posted September 18, 2014 Put it through the washer with spin cycle and it came out clean. Can anyone clean this up? ???? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 18, 2014 Share Posted September 18, 2014 Found this one in a forum. Where did you get that codes from ? and why did you remove the author name from the routine ? Quote Link to comment Share on other sites More sharing options...
afwjlk2 Posted September 18, 2014 Author Share Posted September 18, 2014 I apologize. I meant no harm by it. I replace the headings in the routines. I do not pass them off as my own. I am in the process of learning to create LISP. Quote Link to comment Share on other sites More sharing options...
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.