Leaderboard
Popular Content
Showing content with the highest reputation on 12/12/2021 in all areas
-
This will ask the user for text and a point then create mtext at that location. will loop until new text isn't created (defun C:foo (/ LastEntity ThisEntity txt pt) (setq LastEntity t) (while (not (equal LastEntity ThisEntity)) (setq txt (getstring t "\nEnter Text: ")) (if (/= txt "") (setq pt (getpoint "Select Insertion Point")) (setq txt nil) ) (setq LastEntity (entlast)) (if (and txt pt) (entmake (list '(0 . "MTEXT") '(71 . 5) '(100 . "AcDbEntity") '(100 . "AcDbMText") (cons 1 txt) (cons 10 pt) ;Insertion Point (cons 40 (getvar "TextSize")) ) ) ) (setq ThisEntity (entlast)) ) (princ) )2 points
-
Hello again! Here it comes a nicer one. I shortly saw this box in a video and I managed to replicate it. If you wish to make one yourself follow these steps. Download the lisp, change in the program the dimensions a, b and c (sorry, this time there is no user-friendly interface). Run the lisp -the command is “giftbox1” – and print the drawing. Protect your desk: place a cardboard or more sheets of used paper. Put the drawing over that protective layer. To get accurate folds, I use to “draw” first over the fold-lines with a drayed-out ball-pen. Next cut the outlines. Also cut out those internal triangles. You should have something like this. Fold along the red lines (you used a color printer, right?). First fold along the transversal lines. Make sharp bends, and fold/unfold the paper a few times in both directions. Unfold the paper, keep just the blue ribbon bent as in the image. Fold along the longitudinal lines, the printed side goes inside and the blue ribbon remains outside. You should get something like a prism or a tube with square cross section. Glue those two trapeze shapes at the margin to complete the tube. Let the glue to set. Really, don’t go further while the paper is still wet! Shape the tube so that its cross section becomes a square and glue the bottom end. To press together the glued faces, I turned the box with the bottom side facing the table and I pressed it from inside with a pencil. Again, let the glue to harden. Gentle press down the top edge. You should see the upper lid closing the box. Rising the lid, the upper face will split in 4 and nicely gets aside to leave the box open. In fact, there is no “box and lid”, there is only one part, tailored from a single sheet of paper. Final thoughts: If you intend to make a box for her, before printing, change the blue ribbon in red (or pink or something like). There are horizontal lines giving the color, select them all and change their color at once. Using regular thin paper is fine. I used normal office paper (80 gr/m2). If you can get something a bit thicker, even better. But the weakness of this box is its bottom. Cut a square from thicker paper, the same size as the footprint of the box, and glue it to strengthen the bottom face. This is important especially if the lid’s height is close to the overall height of the box: to open it, you must pick the margins down, near the bottom, and when you apply pressure to hold down the box while lifting the lid, the pressure is applied mainly to the bottom face. Also, I made a box with the lid covering the sides all the way down and there left no room for my fingers. The resulting box was almost impossible to open. I’ve cut two half-circular openings, like in the next image. But in this case, it is mandatory to strengthen the bottom face as previously described. Or even better, glue two square patches, one from outside and one from inside. Enjoy! (defun c:GiftBox1() (setq a 20 b 42 c 53) (setq p0 (list 0 (* 0.1 a))) (setq x1 (* a 0.25) x2 (* a 1.25) x3 (* a 2.25) x4 (* a 3.25) x5 (* a 4.25)) (setq y1 b y2 (+ a b) y3 (+ a b c) ym (+ b (* a 0.5))) (setq cut (list (list (* a 0.5) (* a 0.5)) (list (* a -0.5) (* a 0.5)))) (setq color 7) ;cut lines (drawpline p0 (list (list x1 (* a -0.1)) (list (* a 4) 0) (list 0 y3) (list (/ a -10.0) (/ a 2.0)) (list (* a -0.8) 0) (list (* a -0.1) (* a -0.5)) (list 0 x1) (list (- a) 0) (list 0 (- x1)) (list (/ a -10.0) (/ a 2.0)) (list (* a -0.8) 0) (list (* a -0.1) (* a -0.5)) (list 0 x1) (list (- a) 0) (list 0 (- x1)) (list (- x1) (* a -0.1)) (list 0 (- (* 0.2 a) c)) (list x1 (* a -0.1)) (list (* a 0.5) (* a -0.5)) (list (* a -0.5) (* a -0.5)) (list (- x1) (* a -0.1)))) (drawPline (list (* 1.25 a) b) cut) (drawPline (list (* 2.25 a) b) cut) (drawPline (list (* 3.25 a) b) cut) (setq color 1) ; fold lines (mapcar 'line (list x1 x1 x1 x1 x1 x2 x2 x3 x3 x4 x4) (list y1 y2 y3 0 y2 0 y2 0 y2 0 y2) (list x5 x5 x5 x1 x1 x2 x2 x3 x3 x4 x4) (list y1 y2 y3 y1 y3 y1 y3 y1 y3 y1 y3)) (mapcar 'fold (list x1 x2 x3 x4)) (setq st (* 0.02 a) sm (- st)) (setq color 32) ;tree trunk (hatchMe (* 1.7 a) b (* 1.8 a) b 0 st 0 st 5) (setq color 96) ;tree branches (hatchMe (* 1.75 a) ym (* 1.75 a) ym sm sm st sm 21) (hatchMe (* 3.75 a) (+ st b) (* 3.75 a) (+ st b) sm st st st 10) (hatchMe (* 3.75 a) (+ b (* 9 st)) (* 3.75 a) (+ b (* 9 st)) sm st st st 9) (hatchMe (* 3.75 a) ym (* 3.75 a) ym sm sm st sm 8) (hatchMe (+ (* 2.75 a) (* 8 st)) (- ym (* 8 st)) (+ (* 2.75 a)(* 8 st)) (- ym (* 8 st)) sm st sm sm 9) (hatchMe (* 0.75 a) ym (* 0.75 a) (- ym (* 16 st)) sm sm sm st 9) (setq color 4) ;box cover (hatchMe x1 0 x5 0 0 (* st 0.5) 0 (* st 0.5) (fix (/ b st 0.5))) (command "zoom" "e") ) (defun fold(x) (line (+ x (* a 0.5)) (+ b (* 0.5 a)) (+ x a) (+ b (* 0.5 a))) ) (defun drawPline (start pList) (setq el (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 (length pList)) (cons 62 color) '(70 . 1) '(38 . 0) '(210 0 0 1)(list 10 (car start) (cadr start) 0))) (foreach p pList (setq start (mapcar '+ start p)) (setq el (append el (list (cons 10 start)))) ) (entmake el) ) (defun line (x1 y1 x2 y2) ; It draws a line between the given points. The color is global. (entmake (list '(0 . "LINE") (cons 62 color) (list 10 x1 y1 0) (list 11 x2 y2 0))) ) (defun hatchMe(x1 y1 x2 y2 dx1 dy1 dx2 dy2 n) ; hatch-like lines (repeat n (line x1 y1 x2 y2) (setq x1 (+ x1 dx1) y1 (+ y1 dy1) x2 (+ x2 dx2) y2 (+ y2 dy2)) ) )1 point
-
i am sorry , i thought there is a way to do texts without enter , i appreciate ur work ... thank u a lot for ur help1 point
-
Doesn't work like that. You know what you want to input but how does the computer know when your done inputting and to move on to the next step? I guess a timer could be set . How long do you make it to time out? make it to fast and you might not input anything and have to repeat the command. make it to long and its not saving anytime. what happens if you input the wrong thing and try and change it to late times up moving on. Whats the big deal with hitting enter? You can also right click with your mouse if setup properly. Only other thing i can think of is to remove the t in getstring. This means you can't use spaces anymore so when you hit the space bar it acts like enter. (setq txt (getstring t "\nEnter Text: ")) to (setq txt (getstring "\nEnter Text: "))1 point
-
Your wanting to add text on to existing text or all new text? You could modify one of my lisp if you need to add a number at the end. ;;----------------------------------------------------------------------------;; ;; ADD TEXT PREFIX OR SUFFIX TO EXISTING TEXT (defun C:TXT (/ rep str *str ss txt sn ent e) (initget "Prefix Suffix") (setq rep (cond ((getkword "\nAdd Text to [Prefix/Suffix]<Suffix>:")) ("Suffix") ;defaults to suffix ) ) (or (setq *str (getenv "Insert-Text")) (setq *str "Here")) ;gets last string from registry (if (= "" (setq str (getstring (strcat "\nEnter " rep " Text \"" *str "\": ")))) (setq str *str) ) (setenv "Insert-Text" str) ;saves to registry (if (setq ss (ssget "_:L" '((0 . "*TEXT")))) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (setq txt (vlax-ename->vla-object ent)) (cond ((= rep "Prefix") (vla-put-textstring txt (strcat str (vla-get-textstring txt))) ) ((= rep "Suffix") (vla-put-textstring txt (strcat (vla-get-textstring txt) str)) ) ) ) ) (princ) ) Also check this out for numbering things1 point