Our CNC department requested a co-worker include an offset to the part profile and have it on a different layer [rough_pass]. Our only issue is that it involves hundreds of hexagons. This phase they are tessellated so doing a few & arraying will work but the next 2 phases they are pseudo-random.
I found a great lisp in one of the forums that will allow you to select multiple polylines & offset in or out a given distance. The problem is that it uses vla-offset which ignores layers. Normally I would try and hack in something that would solve the issue but with my current project load & my lack of skill using 'vla-' stuff - I do not have the time.
Below is a clip of the critical section. I have also attached the entire file.
Code:
(progn ; level2 then -- proceed
(setq
obj (vlax-ename->vla-object ent)
oarea (vla-get-Area obj)
); setq
(if ; level3
(not ; Offset succeeded [returns T if so, because:]
(vl-catch-all-error-p ; returns T for error if inward but too small
(vl-catch-all-apply 'vla-offset (list obj *OIOdist))
); -error-p
); not
(if ; level4 is level3 then -- check comparative areas:
((if (= subpr "In") > <) (vla-get-Area (vlax-ename->vla-object (entlast))) oarea)
(progn ; level4 then -- went wrong way
(entdel (entlast))
(if ; level5 -- go the other way [if possible]
(vl-catch-all-error-p ; returns T for error if inward but too small
(vl-catch-all-apply 'vla-offset (list obj (- *OIOdist)))
); -error-p
(setq nogo (1+ nogo)); then -- add to count of too-small [no else]
); if level5
); progn
); if level4 [went wrong way -- no else; do nothing if it went right way]
(if (= subpr "Out") (vla-offset obj (- *OIOdist)) (setq nogo (1+ nogo)))
; level3 else -- too small for inward; go other way only if OffOut
; if OffIn, add to count of too-small
); if level3 [Offset succeeded]
); progn [then]
For now 'hard coding' the layer name & assume the layer exists will work. If this comes up again I can pretty up a user interface. Any help would be greatly appreciated.