nod684 Posted July 19, 2012 Posted July 19, 2012 (edited) Hello, i am currently doing a landscaping job and i come across this problem in which the pavers (hatch pattern) should follow the curved path. Is there a way to to this in lisp? I have tried using a custom linetype (with shape) but it didn't worked. I also tried the expresstools superhatch but still no avail. as i was going through the threads here i still cannot find one. But i noticed LeeMac is very good in LISP. any other solution? any help would be very much appreciated Hatch.dwg Edited July 19, 2012 by nod684 typo error Quote
MSasu Posted July 19, 2012 Posted July 19, 2012 My opinion is that is possible to write such routine, but it will be an extremely complicated task. The routine will have to follow the median path and draw perpendicular on it each row of tiles – the size of tiles on each row need to be slightly adjusted (increased or decreased) from one end of the row to the other to allow the consecutive rows to fit together. Also take care to don't exceed the lateral limits. And all this for just esthetical purpose. The said tile said size adjustment is similar with what the fitter workers will do in real life with the gap between rows. Quote
marko_ribar Posted July 19, 2012 Posted July 19, 2012 All I can think is something like this routine : (vl-load-com) (defun c:hatchbetween2curves ( / msp clay hpn hps ss1 ss2 c1 c2 n stpar enpar ln lnstr k par parr p1 p2 p11 p22 phor anh hdata lin ch z ssz ) (setq msp (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))) (setq clay (getvar 'clayer)) (prompt (strcat "\nType HPNAME variable <" (getvar 'hpname) "> : ")) (setq hpn (getstring)) (if (not (eq hpn "")) (setvar 'hpname hpn)) (prompt (strcat "\nType HPSCALE variable <" (rtos (getvar 'hpscale)) "> : ")) (initget 6) (setq hps (getreal)) (if (not (null hps)) (setvar 'hpscale hps)) (prompt "\nPick first curve") (while (not ss1) (setq ss1 (ssget "_+.:E:S:L" '((0 . "*LINE,RAY,XLINE,CIRCLE,ELLIPSE,ARC")))) ) (prompt "\nPick second curve") (while (not ss2) (setq ss2 (ssget "_+.:E:S:L" '((0 . "*LINE,RAY,XLINE,CIRCLE,ELLIPSE,ARC")))) ) (setq c1 (ssname ss1 0)) (setq c2 (ssname ss2 0)) (initget 6) (setq n (cond ((getint "\nType number of spaces-segments between 2 curves <25> : ")) ( 25 ) ) ) (setq stpar (vlax-curve-getstartparam c1)) (setq enpar (vlax-curve-getendparam c1)) (setq ln -1) (while (tblsearch "LAYER" (setq lnstr (itoa (setq ln (1+ ln)))))) (setq lnstr (itoa ln)) (vl-cmdf "_.-layer" "m" lnstr "") (setvar 'clayer clay) (setq k -1) (repeat (+ n 1) (setq par (+ stpar (* (/ (- enpar stpar) (float n)) (float (setq k (1+ k)))))) (setq p1 (vlax-curve-getpointatparam c1 par)) (setq p2 (vlax-curve-getclosestpointto c2 p1)) (if (/= k n) (progn (setq parr (+ stpar (* (/ (- enpar stpar) (float n)) (float (+ k 0.5))))) (setq p11 (vlax-curve-getpointatparam c1 parr)) (setq p22 (vlax-curve-getclosestpointto c2 p11)) (setq phor (mapcar '(lambda ( a b ) (/ (+ a b) 2.0)) p11 p22)) (setq anh (cvunit (angle p11 p22) "radians" "degrees")) (setq hdata (cons (cons anh phor) hdata)) ) ) (setq lin (vla-addline msp (vlax-3d-point p1) (vlax-3d-point p2))) (vla-put-layer lin lnstr) ) (foreach h hdata (vl-cmdf "_.-hatch" "p" "" "" (car h) "o" "s" (cdr h) "" (cdr h) "") ) (prompt (strcat "\nDo you want to <E>rase or <L>eave lines on new layer \"" lnstr "\" : ")) (initget 1 "Erase Leave") (setq ch (getkword)) (if (eq ch "Erase") (repeat (setq z (sslength (setq ssz (ssget "_X" (list '(0 . "LINE") (cons 8 lnstr)))))) (entdel (ssname ssz (setq z (1- z)))) ) ) (vl-cmdf "_.-purge" "LA" "" "n") (princ) ) (defun c:hb2c nil (c:hatchbetween2curves)) (prompt "\nShortcut for c:hatchbetween2curves is c:hb2c") (princ) M.R. Quote
nod684 Posted July 19, 2012 Author Posted July 19, 2012 My opinion is that is possible to write such routine, but it will be an extremely complicated task. The routine will have to follow the median path and draw perpendicular on it each row of tiles – the size of tiles on each row need to be slightly adjusted (increased or decreased) from one end of the row to the other to allow the consecutive rows to fit together. Also take care to don't exceed the lateral limits. And all this for just esthetical purpose.The said tile said size adjustment is similar with what the fitter workers will do in real life with the gap between rows. yes, i know its a very complicated task....i hope Autodesk will consider this in their future releases.. All I can think is something like this routine : (vl-load-com) (defun c:hatchbetween2curves ( / msp clay hpn hps ss1 ss2 c1 c2 n stpar enpar ln lnstr k par parr p1 p2 p11 p22 phor anh hdata lin ch z ssz ) (setq msp (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))) (setq clay (getvar 'clayer)) (prompt (strcat "\nType HPNAME variable <" (getvar 'hpname) "> : ")) (setq hpn (getstring)) (if (not (eq hpn "")) (setvar 'hpname hpn)) (prompt (strcat "\nType HPSCALE variable <" (rtos (getvar 'hpscale)) "> : ")) (initget 6) (setq hps (getreal)) (if (not (null hps)) (setvar 'hpscale hps)) (prompt "\nPick first curve") (while (not ss1) (setq ss1 (ssget "_+.:E:S:L" '((0 . "*LINE,RAY,XLINE,CIRCLE,ELLIPSE,ARC")))) ) (prompt "\nPick second curve") (while (not ss2) (setq ss2 (ssget "_+.:E:S:L" '((0 . "*LINE,RAY,XLINE,CIRCLE,ELLIPSE,ARC")))) ) (setq c1 (ssname ss1 0)) (setq c2 (ssname ss2 0)) (initget 6) (setq n (cond ((getint "\nType number of spaces-segments between 2 curves <25> : ")) ( 25 ) ) ) (setq stpar (vlax-curve-getstartparam c1)) (setq enpar (vlax-curve-getendparam c1)) (setq ln -1) (while (tblsearch "LAYER" (setq lnstr (itoa (setq ln (1+ ln)))))) (setq lnstr (itoa ln)) (vl-cmdf "_.-layer" "m" lnstr "") (setvar 'clayer clay) (setq k -1) (repeat (+ n 1) (setq par (+ stpar (* (/ (- enpar stpar) (float n)) (float (setq k (1+ k)))))) (setq p1 (vlax-curve-getpointatparam c1 par)) (setq p2 (vlax-curve-getclosestpointto c2 p1)) (if (/= k n) (progn (setq parr (+ stpar (* (/ (- enpar stpar) (float n)) (float (+ k 0.5))))) (setq p11 (vlax-curve-getpointatparam c1 parr)) (setq p22 (vlax-curve-getclosestpointto c2 p11)) (setq phor (mapcar '(lambda ( a b ) (/ (+ a b) 2.0)) p11 p22)) (setq anh (cvunit (angle p11 p22) "radians" "degrees")) (setq hdata (cons (cons anh phor) hdata)) ) ) (setq lin (vla-addline msp (vlax-3d-point p1) (vlax-3d-point p2))) (vla-put-layer lin lnstr) ) (foreach h hdata (vl-cmdf "_.-hatch" "p" "" "" (car h) "o" "s" (cdr h) "" (cdr h) "") ) (prompt (strcat "\nDo you want to <E>rase or <L>eave lines on new layer \"" lnstr "\" : ")) (initget 1 "Erase Leave") (setq ch (getkword)) (if (eq ch "Erase") (repeat (setq z (sslength (setq ssz (ssget "_X" (list '(0 . "LINE") (cons 8 lnstr)))))) (entdel (ssname ssz (setq z (1- z)))) ) ) (vl-cmdf "_.-purge" "LA" "" "n") (princ) ) (defun c:hb2c nil (c:hatchbetween2curves)) (prompt "\nShortcut for c:hatchbetween2curves is c:hb2c") (princ) M.R. Thanks for this! tried out the lisp and here's what i got! (see attached image) some minor problem with the pattern overlappings but hey! its closed! Quote
SEANT Posted July 20, 2012 Posted July 20, 2012 I’ve posted a mapping routine(.NET) that can simulate this functionality in this thread: http://www.cadtutor.net/forum/showthread.php?41260-drawing-on-a-sphere As a matter of fact, post #11 of that thread shows an example that uses the AR-HBONE. The workflow is a bit convoluted but here is an example of the result. Each brick shows some curve/morphing, so it may not be appropriate. Perhaps not too bad if it is just for a visual. Hatch.dwg Quote
eldon Posted July 20, 2012 Posted July 20, 2012 Just wait until the client actually wants it built. Should give someone a headache Quote
marko_ribar Posted July 20, 2012 Posted July 20, 2012 (edited) Maybe I'm wrong, but I tried dll and after I select sphere I get error : Unable to acquire 3dsolid face... I am using A2012 64 Win 7... Can you help, Seant? M.R. Select face of solid: Error while acquiring Face! Edited July 20, 2012 by marko_ribar Quote
SEANT Posted July 20, 2012 Posted July 20, 2012 Yes. That particular version was written and tested with AutoCAD 2009 (32 bit). Even back then there were signs of incompatibility – see post 12 of that thread. Unfortunately, I still cannot test against AutoCAD 2010-2011. I am refactoring the project, as well as a few more, for AutoCAD2012-2013 to eventually submit to Autodesk Exchange Apps. Quote
nod684 Posted July 21, 2012 Author Posted July 21, 2012 Just wait until the client actually wants it built. Should give someone a headache actually this is giving me a lot of headache too hehe! I’ve posted a mapping routine(.NET) that can simulate this functionality in this thread: http://www.cadtutor.net/forum/showthread.php?41260-drawing-on-a-sphere As a matter of fact, post #11 of that thread shows an example that uses the AR-HBONE. The workflow is a bit convoluted but here is an example of the result. Each brick shows some curve/morphing, so it may not be appropriate. Perhaps not too bad if it is just for a visual. thanks! i will try this one out! Quote
nod684 Posted August 7, 2012 Author Posted August 7, 2012 guess there is no way to do this as of the moment Quote
marko_ribar Posted August 7, 2012 Posted August 7, 2012 Maybe, I don't know to manipulate so good with geometry??? I am arch., tried dlls on A2009 32 bit and it works, but I am unable to reproduce hatch Sean posted... My canvas block when select face has 2 shapes - inside shape follows curvatures and outside is boundary rectangle... When I hatch => explode and use "CVP" no deformations occurs - only lines have been transformed to splines... If only Sean can demonstrate with animated gif, what he did... M.R. Quote
marko_ribar Posted August 7, 2012 Posted August 7, 2012 (edited) I think I figured out how to do it... Make solid with shape - half ellipse region positioned perpendicular to plline that is pedit=>splined as extrude path... NETLOAD => CPM => hatch => explode => CVP and that's it... Example I posted now is with half circle region shape and pline splined as extrude path with low number of vertices for curvature... But this explains whole process... It should project hatch on curved surface with CVP very fast... If it's slow something with surface is wrong - when unfolded result should always be rectangle... M.R. hatch-proj on curved surface.dwg Edited August 7, 2012 by marko_ribar attached dwg was corrupted, so it's replaced with good one Quote
nod684 Posted August 7, 2012 Author Posted August 7, 2012 I think I figured out how to do it... Make solid with shape - half ellipse region positioned perpendicular to plline that is pedit=>splined as extrude path... NETLOAD => CPM => hatch => explode => CVP and that's it... Example I posted now is with half circle region shape and pline splined as extrude path with low number of vertices for curvature... But this explains whole process... It should project hatch on curved surface with CVP very fast... If it's slow something with surface is wrong - when unfolded result should always be rectangle... M.R. yes...and it is limited to this hatch pattern only. guess there is no way we can have hatch follow a path :sigh: Quote
eldon Posted August 7, 2012 Posted August 7, 2012 You can get an approximate picture with creating several blocks and using Measure. But in the real world, paviors are of fixed dimensions and are solid, so if the client sees the paviors following a curved path, and wants what he sees, you are going to have terrible problems making customised paving blocks. Better the client does not see some clever drafting, and you realise that your vision is going to cost an awful lot to achieve. However, if you have an unlimited budget, then go for it. Quote
ReMark Posted August 7, 2012 Posted August 7, 2012 If this is what you do for a living then go out and hire someone to write you a customized lisp program to hand the chore. Quote
nod684 Posted August 8, 2012 Author Posted August 8, 2012 If this is what you do for a living then go out and hire someone to write you a customized lisp program to hand the chore. i did try hiring someone but still no avail Quote
Organic Posted August 8, 2012 Posted August 8, 2012 i did try hiring someone but still no avail Perhaps try http://www.lee-mac.com/contact.html (http://www.cadtutor.net/forum/member.php?16898-Lee-Mac) Quote
Dadgad Posted August 8, 2012 Posted August 8, 2012 Try this one. http://www.lee-mac.com/objectalign.html Quote
nod684 Posted August 8, 2012 Author Posted August 8, 2012 Try this one. http://www.lee-mac.com/objectalign.html thanks. I have seen this already but im afraid it is not applicable Perhaps try http://www.lee-mac.com/contact.html (http://www.cadtutor.net/forum/member.php?16898-Lee-Mac) Yes, i kinda know him (well most LISP users should know him) He has quite a good reputation in field of lisp programming i haven't asked him yet Quote
marko_ribar Posted August 9, 2012 Posted August 9, 2012 My brief comment ab topic with Sean's routine : http://www.cadtutor.net/forum/showthread.php?41260-drawing-on-a-sphere/page2&p=#16 M.R. 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.