Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Everyone
I am looking for a lisp to install dimension automatically on a hatch like this.
Solved! Go to Solution.
Hi Everyone
I am looking for a lisp to install dimension automatically on a hatch like this.
Solved! Go to Solution.
Look into HatchB.lsp this makes a pline representing the boundary of a hatch, then get all vertice points then can look for Min X point Max X point and do dim. Hint Vl-sort on list of X & Y, 1st is min last is max. ((134.45 678.99)(........
(setq plent (entsel "\nPick pline"))
(if plent (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car plent))))))
(princ co-ord)
hey there,
check the following
(defun c:dim_hatch (/ hatch_sset llc urc hatch_vertices left_most_dim_point right_most_dim_point dim_object)
(if (setq hatch_sset (ssget '((0 . "hatch"))))
(foreach hatch (vl-remove-if 'listp (mapcar 'cadr (ssnamex hatch_sset)))
(vla-getboundingbox (vlax-ename->vla-object hatch) 'llc 'urc)
(setq llc (vlax-safearray->list llc)
urc (vlax-safearray->list urc)
hatch_vertices (mapcar 'cdr (vl-remove-if-not '(lambda (group) (member (car group) '(10 11))) (entget hatch)))
)
(vl-some '(lambda (vertex) (equal (car llc) (car (setq left_most_dim_point vertex)) 1e-4)) hatch_vertices)
(vl-some '(lambda (vertex) (equal (car urc) (car (setq right_most_dim_point vertex))1e-4)) hatch_vertices)
(setq dim_object (vla-adddimrotated (vla-get-block (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object))))
(vlax-3d-point left_most_dim_point)
(vlax-3d-point right_most_dim_point)
(vlax-3d-point (polar llc (* 1.5 pi) (* 2 (getvar 'dimtxt))))
0
)
)
)
)
(princ)
)
If you look at a thin hatch at 45 degs then Vla-getboundingbox may not be suitable as it is a Box lower Y is same left or right or but using a pline reflecting the hatch shape would mean the extension lines go to correct point.
The image is a road cross section so the left and right edges hopefully are vertical.
your right, but op showed not that kind of hatch as far as i can figure from his pic attached.