A Complex Lisp Project (Mirror / Draw Line / Hatch)

A Complex Lisp Project (Mirror / Draw Line / Hatch)

strat8ender
Explorer Explorer
455 Views
4 Replies
Message 1 of 5

A Complex Lisp Project (Mirror / Draw Line / Hatch)

strat8ender
Explorer
Explorer

Hi friends!

 

For a project i have to repeat some commands millons of times. If I had the lisp commands I needed, I would save an unimaginable amount of time. I would be very grateful if someone among you could help me.

 

Here is what i need:

 

Name.png

 

0 Likes
Accepted solutions (1)
456 Views
4 Replies
Replies (4)
Message 2 of 5

ВeekeeCZ
Consultant
Consultant

It could be easy but you know, lines have 2 ends, also hatch can't cover an infinite area... so what it is that define those??

0 Likes
Message 3 of 5

strat8ender
Explorer
Explorer

Yeah you're right. Probably there should be a question on command about line dimensions and it should close two lines for doing proper hatch.

0 Likes
Message 4 of 5

ВeekeeCZ
Consultant
Consultant
Accepted solution

Possibly like this...

It does not test whether those 2 lines are not in some rediculous position...

 

(vl-load-com)

(defun c:Mirrtohatch ( / s r r1 r2 rm n n1 n2 x d c1 c2 p) (if (and (setq s (car (entsel "\nSelect source line: "))) (setq r (car (entsel "\nSelect reference line: "))) (setq r1 (vlax-curve-getstartpoint r)) (setq r2 (vlax-curve-getendpoint r)) (setq rm (mapcar '/ (mapcar '+ r1 r2) '(2 2 2))) ) (progn (setq n (vla-mirror (vlax-ename->vla-object s) (vlax-3d-point r1) (vlax-3d-point r2)) n1 (vlax-curve-getstartpoint n) n2 (vlax-curve-getendpoint n) x (if (< (distance n1 rm) (distance n2 rm)) n1 n2) d (* 2 (max (distance x r1) (distance x r2))) c1 (polar x (angle x r1) d) c2 (polar x (angle x r2) d)) (entmake (list '(0 . "LINE") (cons 10 x) (cons 11 c1))) (entmake (list '(0 . "LINE") (cons 10 x) (cons 11 c2))) (setq p (entmakex (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(90 . 4) '(70 . 1)) (mapcar (function (lambda (e) (cons 10 e))) (list r1 c1 c2 r2))))) (command "_.-hatch" "_select" p "" "") (entdel p) )) (princ) )

 

Message 5 of 5

strat8ender
Explorer
Explorer

Woww you're superhuman 😍 Works perfectly

0 Likes