Message 1 of 5

Not applicable
01-10-2019
05:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
Can you help me with a lisp that after selecting some objects it will create a frame around it (like the example).
very similar to the lisp entitled "TEXTBOX" , but I want that after calling the lisp it will allow to select items, and the default offset will be 0.35mm.
The textbox lisp work like that:
It will be enabling the user to create a 2D polyline
rectangular frame around selected Text & MText objects, with a
user-defined offset. (The default is 0.35mm) .
And I want it to allow me to select either one single text and some entities.
Thank you,
Eyal
Here is the textbox lisp for indication:
;;----------------------------=={ Box Text }==--------------------------;; ;; ;; ;; This program performs in much the same way as the Express Tools' ;; ;; 'TCircle' command: enabling the user to create a 2D polyline ;; ;; rectangular frame around selected Text & MText objects, with a ;; ;; user-defined offset. ;; ;; ;; ;; Upon issuing the command syntax 'BT' at the AutoCAD command-line, ;; ;; the program first prompts the user to specify an offset factor ;; ;; for the text frame. This factor is multiplied by the text height ;; ;; for every selected text object to determine the offset of the ;; ;; rectangular frame from the text. At this prompt, the last used ;; ;; value is available as a default option. ;; ;; ;; ;; The program then prompts the user to make a selection of text ;; ;; and/or mtext objects. Following a valid selection, the program ;; ;; iterates over the selection and constructs a rectangular frame ;; ;; surrounding each object, offset by a distance determined by the ;; ;; given offset factor. The generated text box will inherit the ;; ;; basic properties of the enclosed text object (e.g. Layer, Linetype, ;; ;; Lineweight etc.). ;; ;; ;; ;; The program will also perform successfully with Text or MText ;; ;; defined in any construction plane, and under all UCS & view ;; ;; settings. ;; ;;----------------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2010 - www.lee-mac.com ;; ;;----------------------------------------------------------------------;; ;; Version 1.2 - 2015-02-22 ;; ;;----------------------------------------------------------------------;; (defun c:bt ( / *error* def enx idx lst off sel ) (defun *error* ( msg ) (LM:endundo (LM:acdoc)) (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) (princ (strcat "\nError: " msg)) ) (princ) ) (if (or (not (setq def (getenv "LMac\\boxtext-off"))) (not (setq def (distof def 2))) ) (setenv "LMac\\boxtext-off" (rtos (setq def 0.35) 2 2)) ) (initget 4) (if (setq off (getreal (strcat "\nSpecify offset factor <" (rtos def 2 2) ">: "))) (setenv "LMac\\boxtext-off" (rtos off 2 2)) (setq off def) ) (LM:startundo (LM:acdoc)) (if (setq sel (LM:ssget "\nSelect text or mtext <exit>: " '(((0 . "TEXT,MTEXT"))))) (repeat (setq idx (sslength sel)) (setq enx (entget (ssname sel (setq idx (1- idx)))) lst (text-box-off enx (* off (cdr (assoc 40 enx)))) ) (entmake (append '( (000 . "LWPOLYLINE") (100 . "AcDbEntity") (100 . "AcDbPolyline") (090 . 4) (070 . 1) ) (LM:defaultprops enx) (list (cons 038 (caddar lst))) (mapcar '(lambda ( x ) (cons 10 x)) lst) (list (assoc 210 enx)) ) ) ) ) (LM:endundo (LM:acdoc)) (princ) ) ;; ssget - Lee Mac ;; A wrapper for the ssget function to permit the use of a custom selection prompt ;; msg - [str] selection prompt ;; arg - [lst] list of ssget arguments (defun LM:ssget ( msg arg / sel ) (princ msg) (setvar 'nomutt 1) (setq sel (vl-catch-all-apply 'ssget arg)) (setvar 'nomutt 0) (if (not (vl-catch-all-error-p sel)) sel) ) ;; Default Properties - Lee Mac
Solved! Go to Solution.