Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/22/2021 in all areas

  1. Hello all! I recently came across this youtube video. I'm not very good at origami but I do know some AutoLisp, so here is my version. If you'd like to make your own, download the attached Lisp and edit the text with something like Notepad. I admit that I'm not an artist, so for sure you will make a better choose on colors. Also choose a nice font *before* you run the Lisp. About the W parameter in the Lisp file: while a smaller value may lead to a nicer looking cube, you will have hard time putting the parts together, and also the final cube will probably fall apart easier. For your first cube make it at least at 25 units (for an edge of 100 units). Run the Lisp & print the faces at the desired scale (I printed them all on the same A4 sheet). Then cut the faces. The bend lines should be visible over the colors, but unfortunately AutoCAD made them disappear. First locate the bending lines. There is no bending line where the color ends! Make 4 bends along each face. Next 2 more bends across. Now you can start putting the faces together. Don't use glue. See the youtube video above and also the next images. And don't forget to watch the colors and the text orientation so that the faces go in the right place! Sometimes I feel that I should've been born an octopus, because two hands are never enough. But don't worry, it can all be done with some patience. An important aspect for this project is accuracy! I can't wait to see images of your gift boxes. Here is mine: Have fun! ;| This program draws the flat pattern of the 6 faces on can use to make a gift-box. More rxplanations to be found in the CADTutor forum November 2011 m_fuccaro@hotmail.com |; (defun c:giftbox() (setq e 100 ; cube edge length w 25 ; wraping ribbon width BackColor 10733985 ; use true collors colors (list 16724137 12929535 16738370) ; change the texts and the colors to customize texts(list "Packaged with love" "CADTutor Forum is a nice place" "Happy Cristmas!") gap 20 ) (setq linecolor 2) (setq x0 0 y0 0) (blockmaker) ; to make the scizor cut-mark symbol (face 0 0 0) (face (+ e e gap) 0 0) (face 0 (+ e w w gap) 1) (face (+ e e gap) (+ e w w gap) 1) (face 0 (+ e e (* 4 w) gap gap) 2) (face (+ e e gap) (+ e e (* 4 w) gap gap) 2) ) (defun face(x0 y0 i) ; this draws a complete face with ribbon and tex (setq w4 (/ w 4.0)) (setq lineColor 1) (mapcar 'vert (list 0 (/ e 2) (/ (* 3 e) 2) (* 2 e))) (mapcar 'horiz (list 0 (/ e 2) (+ (/ e 2) (/ w 2)) (+ (/ e 2) (/ w 2) w) (+ (/ e 2) w w) (+ e w w))) (solidcolor w4 0 (+ e e (- w4)) (- (/ e 2) w4) backColor) (solidcolor w4 (+ (/ e 2) w4) (+ e e (- w4)) (+ (/ e 2) (/ w 2) (* 5 w4)) (nth i colors)) (solidcolor w4 (+ (/ e 2) (* 9 w4)) (+ e e (- w4)) (+ e w w) backColor) (entmake (list '(0 . "TEXT") (cons 1 (nth i texts)) (list 10 0 0 0) (cons 40 1)(cons 41 1)(cons 420 14281177))) (setq en (entlast) el (entget en) box(textbox (entget en)) factor (/ (* 0.8 w) (- (cadadr box) (cadar box)))) (setq el (entmod (subst (cons 40 factor) '(40 . 1) el))) (setq box(textbox el) factor (/ (+ e e (* -1.4 w)) (- (caadr box) (caar box)))) (setq el (entmod (subst (cons 41 factor) '(41 . 1) el))) (entmod (subst (list 10 (+ x0 (* 0.7 w)) (+ y0 (/ e 2.0) (* 0.75 w)) 2) (assoc 10 el) el)) (entmake (list '(0 . "INSERT") '(2 . "CUTMARK") (list 10 x0 y0 0))) (entmake (list '(0 . "INSERT") '(2 . "CUTMARK") (list 10 x0 y0 0) (cons 50 (/ PI 2)))) (entmake (list '(0 . "INSERT") '(2 . "CUTMARK") (list 10 x0 (+ y0 e w w) 0))) (entmake (list '(0 . "INSERT") '(2 . "CUTMARK") (list 10 (+ x0 e e) y0 0) (cons 50 (/ PI 2)))) ) (defun line(x1 y1 x2 y2) (entmake (list '(0 . "LINE") (list 10 (+ x0 x1) (+ y0 y1) 1) (list 11 (+ x0 x2) (+ y0 y2) 1) (cons 62 LineColor))) ) (defun horiz(y) (line 0 y (+ e e) y) ) (defun vert(x) (line x 0 x (+ e w w)) ) (defun solidColor(x1 y1 x2 y2 color) ; all the rectangular color areas are solid hatches (entmake (list '(0 . "HATCH") '(100 . "AcDbEntity") '(100 . "AcDbHatch") '(10 0 0 0) '(210 0 0 1) '(2 . "SOLID") (cons 420 color) '(70 . 1) '(71 . 0) '(91 . 1) '(92 . 7) '(72 . 0) '(73 . 1) '(93 . 4) (list 10 (+ x0 x1) (+ y0 y1) 0) (list 10 (+ x0 x2) (+ y0 y1) 0) (list 10 (+ x0 x2) (+ y0 y2) 0) (list 10 (+ x0 x1) (+ y0 y2) 0) '(97 . 0) '(75 . 1) '(76 . 1) '(47 . 1) '(98 . 1) '(10 0 0 0) '(450 . 0) '(451 . 0) '(460 . 0) '(461 . 0) '(452 . 0) '(462 . 0) '(453 . 2) '(463 . 0) '(421 . 1) '(463 . 1.0) '(470 . ""))) ) (defun blockMaker() ; makes a simple scizor-like mark (entmake (list '(0 . "BLOCK") '(2 . "CutMark") '(10 0 0 0) '(70 . 0))) (entmake (list '(0 . "CIRCLE") (list 10 -15 3 0) (cons 40 1.5)(cons 62 lineColor))) (entmake (list '(0 . "CIRCLE") (list 10 -15 -3 0) (cons 40 1.5)(cons 62 lineColor))) (line -15 1.5 -4 -2) (line -15 -1.5 -4 2) (line -6 0 0 0) (entmake (list (cons 0 "ENDBLK"))) )
    2 points
  2. Here is another way .. checks that there is something within a distance of 1.5 ( based on the sample drawing ). Should be fairly fast (defun c:foo (/ a b c d el r s) ;; RJP » 2021-11-22 (cond ((setq s (ssget "_X" '((0 . "TEXT") (8 . "urb_rasante,CVL_RAS_TX")))) (setq d 1.5) (foreach e (mapcar 'cadr (ssnamex s)) (if (= "CVL_RAS_TX" (cdr (assoc 8 (setq el (entget e))))) (setq a (cons (list (cdr (assoc 11 el)) (cdr (assoc 1 el))) a)) (setq b (cons (list (cdr (assoc 11 el)) e) b)) ) ) (setq a (vl-sort a '(lambda (r j) (< (caar r) (caar j))))) (setq b (vl-sort b '(lambda (r j) (< (caar r) (caar j))))) (while (setq c (car a)) (setq a (cdr a)) (if (vl-some '(lambda (x) (<= (distance (car c) (car (setq r x))) d)) b) (list (entmod (append (entget (cadr r)) (list (cons 1 (cadr c))))) (setq b (vl-remove r b)) ) (entmake (list '(0 . "circle") (cons 10 (car c)) '(40 . 5) '(8 . "NoMatch"))) ) ) ) ) (princ) )
    1 point
  3. have a single script with this content? then each drawing will run a script with same file name (command "script" (strcat (vl-filename-base (getvar "dwgname")) ".scr"))
    1 point
  4. Looking over your code @Tharwat very nice. I will use this when comparing entity's from now on. I also saw something awhile back for entmod. When pulling the assoc # don't use cdr on them. makes it about 5-10% faster. (setq get (entget ent) ins (cdr (assoc 10 get)) txt (assoc 01 get) ) .... (entmod (subst (cadr srt) (cadr itm) (last itm))) (entmod (subst stxt ctxt get)) ;if they are not in a list (setq get (entget ent) ins (cdr (assoc 10 get)) txt (cdr (assoc 01 get)) ) .... (entmod (subst (cons 1 (cadar srt)) (assoc 1 (last itm)) (last itm)))
    1 point
×
×
  • Create New...