Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/19/2024 in all areas

  1. Remove brackets from arguments in delta functions (rtos (sqrt (+ (sqr (dX p1 p2)) (sqr (dY p1 p2)))))
    2 points
  2. Give this a try: (defun c:TRE (/ ss i text textList ntxt otxt filter) ;; Define the selection set filter to select only text objects (setq filter '((0 . "TEXT,MTEXT"))) ;; Select the text objects (setq ss (ssget filter)) (if ss (progn ;; Create list of entities from selection set (setq textList nil) (repeat (setq i (sslength ss)) (setq text (ssname ss (setq i (1- i)))) (setq textList (append textList (list text))) ) ;; Tolerance to y-coordinate sorting (setq tolerance 5.0) ;; Sorting text list from top to bottom left to right (setq textList (vl-sort textList (function (lambda (e1 e2) ;; check if on same y-coordinate (+-tolerance) then sort left to right otherwise sort top to bottom (if (< (abs (- (cadr (cdr (assoc 10 (entget e1)))) (cadr (cdr (assoc 10 (entget e2)))))) tolerance) (< (car (cdr (assoc 10 (entget e1)))) (car (cdr (assoc 10 (entget e2))))) (> (cadr (cdr (assoc 10 (entget e1)))) (cadr (cdr (assoc 10 (entget e2))))) ) ) ) ) ) ;; Going through each text and letting user modify (foreach text textList (setq otxt (cdr (assoc 1 (entget text))) ntxt (getstring T (strcat "Edit text: <" otxt "> -> ")) ) (if (= ntxt "")(setq ntxt otxt)) (entmod (subst (cons 1 ntxt) (assoc 1 (entget text)) (entget text))) (entupd text) ) (princ "\nText objects edited successfully.") ) ; end of progn (princ "\nNo objects found in the specified area.") ) ; end of if ss (princ) ) ; end of program
    1 point
  3. Add (princ) after your (princ (strcat ...)) expression. The defun expression is returning the result of the last evaluated expression, hence returning the value returned by your princ expression, which is the string argument supplied to it.
    1 point
  4. (defun c:foo ( / ) ;~~~~ (princ) ;<- this one ) (defun subfunc1 ( / ) ;~~~~ ) (defun subfunc2 ( / ) ;~~~~ ) (princ "\n function FOO loaded.") (princ) like this
    1 point
  5. You could try to define the second function *inside* the first function. Something like: (defun c:function1() (defun function2(position) (entmake (list '(0 . "POINT") (cons 10 position)) ) ) (setq ang 0.0 ang1 0.1) (repeat 1000 (setq x (sin (* 5.0 ang)) y (cos (* 7.0 ang)) z (* (cos ang) (sin ang)) ang (+ ang ang1) ) (function2 (list x y z)) ) ) If you load this, AutoCAD will report only "function1 loaded". Does this help you?
    1 point
  6. Linetype definitions haven't changed since Complex ones were introduced in r13 before Mtext was around. Features like Mtext has like referencing fonts instead of Text Styles and Background mask for the text have been needed for a long time. I submitted it as a Wish List item on AUGI in 2011: https://forums.augi.com/showthread.php?133959-Font-referencing-Background-Masking-in-Complex-Linetypes 1. I'd like see features like Mtext has like referencing fonts instead of Text Styles and Background mask for the text. Then I could call out a font instead of having to create a Text Style using the font just to reference a character. A and S are still the only alignment codes and only A which guarantees the ends always start and end with a dash is documented. Perhaps the more current type formating could be used with a new alignment code. 2. The ability to set the text angle without being able to center justify it has always been useless. 3. More shapes in the standard ltypeshp.shp including arcs of 30°, 45°, 60°, & 90° so we wouldn't have to create and keep track of custom shape files for most linetypes. 4. Incorporate multiline functionally into complex linetypes, multilines were poorly thought out. I did have one of my wishes granted "Strike-through formatting in MText objects": https://forums.augi.com/showthread.php?119676-Strike-through-formatting-in-MText-objects You should create a page for "Buried Features of AutoCAD" with a link for users to submit ones they've found!
    1 point
×
×
  • Create New...