Results 1 to 2 of 2

Thread: AutoLISP: vla-offset and layers

  1. #1
    Join Date
    Login to Give a bone

    Default AutoLISP: vla-offset and layers

    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.

    (progn ; level2 then -- proceed
                  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.
    Attached Files Attached Files

  2. #2
    Certifiable AUGI Addict
    Join Date
    Tallahassee, FL
    Login to Give a bone

    Default Re: AutoLISP: vla-offset and layers

    Tom Beauford P.S.M. - Civil 2020 on Windows 10 Enterprise
    Design Analysis - Leon County Public Works/Engineering Wrap [CODE] tags around selected text
    2280 Miccosukee Rd. Tallahassee, FL 32308-5310
    Ph# (850)606-1516 Home Page

Similar Threads

  1. Autolisp program to label station and offset.
    By aaronic_abacus in forum AutoLISP
    Replies: 7
    Last Post: 2020-09-16, 01:36 AM
  2. Replies: 0
    Last Post: 2018-03-13, 08:29 AM
  3. 2011: label points at an offset from alignment showing stat, offset, and description
    By mw156 in forum AutoCAD Civil 3D - Survey
    Replies: 6
    Last Post: 2016-09-29, 06:10 PM
  4. Replies: 6
    Last Post: 2014-09-20, 03:54 AM
  5. Replies: 1
    Last Post: 2014-03-24, 06:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts