Jump to content

Recommended Posts

Posted

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)

Posted

Put it through the washer with spin cycle and it came out clean.

Can anyone clean this up?

 

????

Posted
Found this one in a forum.

 

Where did you get that codes from ? and why did you remove the author name from the routine ? :x

Posted

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...