CAD Posted January 20, 2019 Posted January 20, 2019 hELLO, Is there a lisp that could change several Polyline with random thickness to Hatch pattrene Solid, with a lisp, when u type command P2H see attachment. test2.dwg Quote
ronjonp Posted January 21, 2019 Posted January 21, 2019 Use Lee's Polyline Outline then hatch them. Quote
CAD Posted January 21, 2019 Author Posted January 21, 2019 Hello Ronjonp, the lisp is almost perfect, but can u make it, so by command P2H, it autom. select all Polyline and make the hatch solid? like attachment? Quote
ronjonp Posted January 21, 2019 Posted January 21, 2019 (defun c:mpolyoutlineh (/ b d e h i s) (if (setq s (ssget "_:L" '((0 . "LWPOLYLINE") (-4 . "<NOT") (-4 . "<>") (42 . 0.0) (-4 . "NOT>")))) (progn (initget "Yes No") (setq d (/= "No" (getkword "\nDelete Original? [Yes/No] <Yes>: "))) (setq b (vlax-get (vla-get-activedocument (vlax-get-acad-object)) (if (= (getvar 'cvport) 1) 'paperspace 'modelspace ) ) ) (repeat (setq i (sslength s)) ;; RJP mod to apply solid hatch to outlines ;; Odd results if you have self intersecting plines (foreach c (lm:polyoutline (setq e (ssname s (setq i (1- i))))) (cond ((setq h (vlax-invoke b 'addhatch achatchobject "SOLID" :vlax-true)) (vlax-invoke h 'appendouterloop (list (vlax-ename->vla-object c))) (vla-evaluate h) (vla-put-layer h (cdr (assoc 8 (entget e)))) ) ) ) (if d (entdel e) ) ) ) ) (princ) ) Quote
CAD Posted January 21, 2019 Author Posted January 21, 2019 (edited) Hello Ronjonp, I load the lisp and type mpolyoutlineh, then the lisp still ask me to select te object etc? but doesn't automatic convert the Pline to Hatch solid? it would be great, if the lisp not asking all the questions. Edited January 21, 2019 by CAD Quote
ronjonp Posted January 21, 2019 Posted January 21, 2019 Not sure .. works here? Are you calling the correct code ? c:mpolyoutlineh Quote
CAD Posted January 21, 2019 Author Posted January 21, 2019 (edited) 1 hour ago, ronjonp said: when i type mpolyoutlineh it ask me to select objects? is there any settings i not have done? Edited January 21, 2019 by CAD Quote
ronjonp Posted January 21, 2019 Posted January 21, 2019 I'm confused. The prompt to select objects is to select the polylines you want to convert. You also have to load all of the code from Lee's site as it is the base of the program. Quote
CAD Posted January 21, 2019 Author Posted January 21, 2019 (edited) sorry confuse You, but my idea is, when i type mpolyoutlineh the lisp Lee or the yours it turns all Polylines to outline and instant change to Hatch solid. so i dont have to select the polylines. Just 1 lisp do all the work, with one command like mpolyoutlineh Edited January 21, 2019 by CAD Quote
CAD Posted January 21, 2019 Author Posted January 21, 2019 (edited) still asking select objects, iam using acad 2017 is that maybe a problem? Command: MPOLYOUTLINEH Select objects: Specify opposite corner: 3 found Select objects: Specify opposite corner: 3 found (3 duplicate), 3 total Select objects: Delete Original? [Yes/No] <Yes>: Edited January 21, 2019 by CAD Quote
CAD Posted January 21, 2019 Author Posted January 21, 2019 (edited) SOrry thx for yur time! The lisp works good, but there are severals steps 2 do it, Like when i type MPOLYOUTLINEH, it ask me select object, i then select objects, then it ask me delete yes or no, and i click Yes, then it finish. I would like to see the lisp that don't have do step bij step, but instant change it. I do apolgize for all my mistaken/request. Edited January 21, 2019 by CAD Quote
ronjonp Posted January 21, 2019 Posted January 21, 2019 (edited) Try this: (defun c:mpolyoutlineh (/ b e h i s) (if (setq s (ssget "_X" '((0 . "LWPOLYLINE") (-4 . "<NOT") (-4 . "<>") (42 . 0.0) (-4 . "NOT>")))) (progn (repeat (setq i (sslength s)) ;; RJP mod to apply solid hatch to outlines ;; Odd results if you have self intersecting plines (foreach c (lm:polyoutline (setq e (ssname s (setq i (1- i))))) (setq b (vlax-ename->vla-object (cdr (assoc 330 (entget e))))) (cond ((setq h (vlax-invoke b 'addhatch achatchobject "SOLID" :vlax-true)) (vlax-invoke h 'appendouterloop (list (vlax-ename->vla-object c))) (vla-evaluate h) (vla-put-layer h (cdr (assoc 8 (entget e)))) ) ) ) ;; If the layer is locked nothing will be deleted (entdel e) ) ) ) (princ) ) Edited January 21, 2019 by ronjonp Quote
CAD Posted January 21, 2019 Author Posted January 21, 2019 I think this is perfect ,with one command, job is done, tomorrow i will test it more, but i looks like it runs perfect sofar!! Quote
CAD Posted January 22, 2019 Author Posted January 22, 2019 (edited) I think the lisp works fine thanks alot!!!! Ronjonp Edited January 22, 2019 by CAD Quote
ronjonp Posted January 22, 2019 Posted January 22, 2019 1 minute ago, CAD said: I think the lisp works fine thanks alot!!!! Ronjonp Glad to help, although you really should be thanking Lee since his code is the 'magic sauce' that even makes it possible. 1 Quote
CAD Posted January 22, 2019 Author Posted January 22, 2019 You the best!! Lee lisp combine with you works perfect Quote
Lee Mac Posted January 22, 2019 Posted January 22, 2019 3 hours ago, ronjonp said: Glad to help, although you really should be thanking Lee since his code is the 'magic sauce' that even makes it possible. Thanks Ron 1 Quote
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.