Quantcast
Channel: Autodesk India Community aggregator
Viewing all articles
Browse latest Browse all 1680

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Lisp Routine Help

$
0
0
I was wondering if I could get some assistance. I have pieced this lisp together from a few I have come across here in the groups, but am now stuck with the final pieces. Once the pline is drawn I would like the lisp routine to select the pline (last ?) instead of the user doing so. I would then like to offset the line 1 (foot) and then erase the original line drawn, so the user does not have to.
 
Any assistance would be GREATLY appreciated..Thanks
 
(defun c:Test ( / *error* of undo doc ss )
  (vl-load-com)
 
  (command "pline")
(while (> (getvar "cmdactive") 0) (command pause))
 
  (defun *error* ( msg )
    (and undo (vla-EndUndomark doc))
    (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
        (princ (strcat "\n** Error: " msg " **")))
    (princ)
   )
 
  (if (and (ssget '((0 . "ARC,CIRCLE,ELLIPSE,*LINE")))
           (setq of (getdist "\nSpecify Offset Distance: ")))
    (progn
      (setq undo
        (not
          (vla-StartUndomark
            (setq doc
              (vla-get-ActiveDocument
                (vlax-get-acad-object)
              )
            )
          )
        )
      )
      
      (vlax-for obj (setq ss (vla-get-ActiveSelectionSet doc))
        (mapcar
          (function
            (lambda ( o )
              (vl-catch-all-apply
                (function vla-offset) (list obj o)
              )
            )
          )
          (list of (- of))
        )
      )
      (vla-delete ss)
 
      (setq undo (vla-EndUndoMark doc))
    )
  )
  (princ)
)

Viewing all articles
Browse latest Browse all 1680

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>