Jump to content

Sharing! match_hatch


AIberto

Recommended Posts

(defun c:match_hatch (/ s0 hp ha hs ss i s1)
 (if (and
(setq s0 (car (entsel "\nSelect source hatch: ")))
(TKS-etype s0 "hatch")
     )
   (progn
     (redraw s0 3)
     (setq hp (TKS-get-dxf 2 s0)
    ha (TKS-r2d (TKS-get-dxf 52 s0))
    hs (TKS-get-dxf 41 s0)
     )
     (setvar "CLAYER" (TKS-get-dxf 8 s0))
     (princ "\nSelect destination object: ")
     (if (setq ss (ssget '((0 . "*polyline,circle,ellipse")))
	i -1
  )
(progn
  (while (setq s1 (ssname ss (setq i (1+ i))))
    (command "hatch" hp hs ha s1 "")
  )
)
     )
     (redraw s0 4)
   )
 )
)
(defun TKS-R2D (rad)
 (* (/ rad pi) 180.0)
)

(defun TKS-Etype (ename etype)
 (wcmatch (TKS-get-dxf 0 ename) (strcase etype))
)

(defun TKS-get-DXF (code ename / ent lst a)
 (if (= (type code) 'LIST)
   (progn
     (setq ent (entget ename)
    lst '()
     )
     (foreach a code
(setq lst (cons (list a (cdr (assoc a ent))) lst))
     )
     (reverse lst)
   )
   (if (= code -3)
     (cdr (assoc code (entget ename '("*"))))
     (cdr (assoc code (entget ename)))
   )
 )
)


 

 

TEST.gif

Link to comment
Share on other sites

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...