Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/17/2023 in all areas

  1. Give this a try: (defun c:DC ( / curlay) (setq curlay (getvar "CLAYER")) (setvar "clayer" "S - DETAIL CUT") (vl-cmdf "._insert" "Detail Cut" "_s" 36.0 "_r" 0) (setvar "clayer" curlay) (princ) )
    1 point
  2. If more than 1 attribute say 2 (vla-put-textstring (car (vlax-invoke blk 'getattributes)) "test") (setq atts (vlax-invoke blk 'getattributes)) (vla-put-textstring (nth 0 atts) "Test1") ; can use (car atts) (vla-put-textstring (nth 1 atts) "Test2") ; can use (cadr atts) ; for multi atts find easier to use nth method
    1 point
  3. (if (setq ins (getpoint "\nSpecify insertion point: ")) (progn (setq blk (vla-insertblock (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))) (vlax-3D-point (trans ins 1 0)) "block" 1 1 1 0)) (vla-put-textstring (car (vlax-invoke blk 'getattributes)) "test") ) ) Note that you can avoid the conversion from variants & safearrays to native LISP data types by leveraging vlax-invoke/vlax-get.
    1 point
  4. (defun c:Test ( / int sel ent pts 1st grp ) ;;----------------------------------------------------;; ;; Author : Tharwat Al Choufi ;; ;; website: https://autolispprograms.wordpress.com ;; ;;----------------------------------------------------;; (and (setq int -1 sel (ssget "_:L" '((0 . "LWPOLYLINE")))) (while (setq int (1+ int) ent (ssname sel int)) (and (mapcar (function (lambda (q) (and (= (car q) 10) (setq pts (cons (cdr q) pts))) ) ) (entget ent)) (< 1 (length pts)) (setq 1st (car pts)) (mapcar (function (lambda (p) (setq grp (cons (list (distance 1st p) 1st p) grp) 1st p))) (cdr pts)) (setq grp (car (vl-sort grp (function (lambda (j k) (> (car j) (car k))))))) (vlax-invoke (vlax-ename->vla-object ent) 'mirror (append (cadr grp) '(0.0)) (append (caddr grp) '(0.0))) (entdel ent) (setq grp nil pts nil) ) ) ) (princ) ) (vl-load-com)
    1 point
  5. (defun c:pp() (setq ssp (ssget "X" (list '(0 . "LWPOLYLINE")))) (repeat (setq i (sslength ssp)) (setq pl1 (ssname ssp (setq i (1- i))) el1 (entget pl1) points (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) el1)) ) (cond ((= 3 (length points)) (setq points (if (< (distance (car points) (cadr points))(distance (cadr points) (caddr points)))(reverse points)points)))) (entmake (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(8 . "0") '(90 . 3) '(70 . 0) '(38 . 0) '(67 . 0) (cons 10 (car points)) (cons 10 (cadr points)) (cons 10 (mapcar '- (cadr points) (mapcar '- (caddr points)(cadr points)))))) ) ) Does this work for you? It draws new polylines on the layer "0". Change to suit your needs... *** editing *** Should the original polyline have been deleted? If so, please insert at the end of the loop: (entdel pl1)
    1 point
  6. So you could use one of these: https://stackoverflow.com/questions/36852628/autolisp-entity-data-retrieval/48857993#48857993 massoc functions to get the coordinates of the polyline, and loop though this list to work out the distance between points - the largest distance will give you the mirror line. Should be simple then to use (command "mirror"..... ) afterward.
    1 point
  7. To my observation at first glance d1 must be equal to d2, and radius r is half d1 (d2)... Also if D is smaller side of rectangle, then : d=d1=d2 r=d/2 (rem D d)=0, or n=D/d, and n=(fix n), and n E (1,3,5,7,9,...,(2*k+1)); k E (0,1,2,3,...) So real unknown variable is n
    1 point
×
×
  • Create New...