IMO geometry algorithm (tips: quadrilateral area) is faster than "guessing",
but coding with iteration inters is much easier
here i have a simple concept, just pick at one segment leg then slide.
the rest you can optimize..
(defun c:aaa ( / ang en i k l p p1 ep )
(and
(mapcar 'set '(en p) (entsel "Pick segment on LWPOLYLINE.. "))
(setq p1 (osnap p "nea"))
(setq p (trans p1 1 0)
i (fix (vlax-curve-getparamatpoint en p)))
(setq ep (vlax-curve-getEndParam en))
(>= ep 3)
(< 0 i (1- ep))
(setq ang
(mapcar ''((x) (angle '(0. 0. 0.) (vlax-curve-getFirstDeriv en x)))
(list (1- i) (1+ i))
)
)
(while
(and p
(mapcar 'set '(k p) (grread t 13))
(= 5 k)
(setq p1 (trans p 1 0))
)
(redraw)
(setq l
(mapcar ''((a b / p)
(list
(setq p (vlax-curve-getPointAtParam en b))
(inters p (polar p a 1.0) p1
(polar p1 (angle '(0. 0. 0.) (vlax-curve-getFirstDeriv en i)) 1.0 )
nil
)
)
)
ang
(list i (1+ i))
)
)
(grvecs
(apply 'append
(mapcar
''((x)
(cons (car x) (mapcar ''((x) (trans x 0 1)) (cdr x)))
)
(cons
(cons 2 (mapcar 'cadr l))
(mapcar ''((x) (cons 2 x))
l
)
)
)
)
)
)
)
(princ)
)
This should work, select the 'yellow' cells Ctrl+c then in AutoCAD LT make sure the command line is active, the cursor should be blinking in the command line, so you might need to click on the command line a couple of times, then Ctrl+v (if the command line isn't active then AutoCAD will use pasteclip).
Hatch.xlsx
Matching your sample put this in cell G2 =CONCATENATE("-hatch Properties ",C2," ",D2," ",E2," ",A2,",",B2," ") then copy down for all hatches, then select the cells in column G copy then paste to Autocad command line. hatches should appear.
What about the coordinates of:
EDIT: I just realized its too easy for any shape
pseudo code --> enclosure+crate+adjacent+extension+horizontal
Lisp Code