Jump to content

All Activity

This stream auto-updates

  1. Past hour
  2. hello all: There are dimensions I need to do this to. I have a routine to do this It would be possible to do everything in a single selection I mean select the dimension and place the break and the line over the text I await comments and here I put the code, thank you ; Original by RonJonP, edited by P. Kenewell (defun c:ltx (/ o s) (setvar "cmdecho" 0) (command "._undo" "_be") (if (setq s (ssget ":L" '((0 . "*TEXT,DIMENSION")))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (setq o (vlax-ename->vla-object e)) (cond ((= "TEXT" (cdr (assoc 0 (entget e)))) (vla-put-textstring o (strcat "%%O" (vl-string-subst "" "" (vl-string-subst "" "%%O" (vla-get-textstring o)) ) ) ) ) ((= "MTEXT" (cdr (assoc 0 (entget e)))) (vla-put-textstring o (strcat "\\O" (vl-string-subst "" "" (vl-string-subst "" "\\O" (vla-get-textstring o)) ) ) ) ) ((= "DIMENSION" (cdr (assoc 0 (entget e)))) (if (= (vla-get-textoverride o) "") (vla-put-textoverride o "\\O<>") (vla-put-textoverride o (strcat "\\O" (vl-string-subst "" "" (vl-string-subst "" "\\O" (vla-get-textoverride o)) ) ) ) ) ) ) ) ) (command "._undo" "_end") (setvar "cmdecho" 1) (princ) )
  3. Today
  4. You didn't post this in one of the code forums. I have no idea what settings you can modify, maybe you should actually post something. What type of code are you using?
  5. I am not gonna lie, its cool!!!! Maybe I can create a separate function have this as my mtext (after some polishing and maybe a menu setting). I will spend sometime and try and remove the FFL function and just keep the text function with prefix suffix, offset, and mouse movement and post it here.
  6. Someone_Pro

    Linking viewport to what it shows

    Thank you for your reply! I was not the one who developed the code so I can only modify the sittings as they are. And it'll only let me freeze or thaw layers. I was hoping I can just freeze the VP layer to stop what's inside from printing when lunching the code. But it seems that won't be possible.
  7. eldon

    Trouble displaying drawing in Viewport

    If you were to use an A2 paper size at 1 to 50, the viewport areas should be much closer.
  8. eldon

    Trouble displaying drawing in Viewport

    The difference of scaling between metric paper sizes is the square root of two. So you would have to scale the A3 to 70.7143 for the two sheets to match. However, with the paper margins and any title block requirements, the actual scaling could alter so that the viewport areas would match.
  9. (defun c:ResetMTXT () (prompt "\nSelect multiple MTEXT entities to modify their content...") ;; Get selection of MTEXT entities (setq sel (ssget "_:S" '((0 . "MTEXT")))) ;; Filter only MTEXT objects ;; Check if there are selected entities (if sel (progn ;; Loop through all selected entities (setq count (sslength sel)) ;; Get count of selected entities (setq i 0) ;; Initialize iteration index (while (< i count) ;; Get the current entity (setq ent (ssname sel i)) ;; Get entity at index i (setq ename (entget ent)) ;; Retrieve entity properties ;; Extract the raw text value from associated code 1 (setq mtextContent (cdr (assoc 1 ename))) ;; Get the plain text content ;; Check if text contains both `;` and `}` (if (and (vl-string-search ";" mtextContent) (vl-string-search "}" mtextContent)) (progn ;; Get positions of `;` and `}` (setq startPos (+ (vl-string-search ";" mtextContent) 1)) ;; Position after `;` (setq endPos (vl-string-search "}" mtextContent)) ;; Position of `}` ;; Extract substring (include the last character by extending the length) (setq extractedContent (substr mtextContent startPos (+ (- endPos startPos) 1))) ;; Remove all occurrences of `;` (setq cleanedContent (vl-string-subst "" ";" extractedContent)) ;; Replace all occurrences of `\P` with newline characters (`\n`) (setq formattedContent cleanedContent) (while (vl-string-search "\\P" formattedContent) ;; Loop to replace all occurrences (setq formattedContent (vl-string-subst "\n" "\\P" formattedContent)) ) ;; Clear and set the new formatted content in the MTEXT entity (setq newEname (subst (cons 1 formattedContent) (assoc 1 ename) ename)) ;; Update group 1 (entmod newEname) ;; Modify the entity in the drawing (entupd ent) ;; Update the entity in the drawing ) ;; Feedback if delimiters are missing (prompt (strcat "\nMTEXT entity at index " (itoa i) " does not contain both ';' and '}' characters.")) ) ;; Increment index to proceed to the next entity (setq i (1+ i)) ) ;; Notify user that processing is complete (prompt "\nAll selected MTEXT entities processed and updated successfully.") ) ;; Error if no MTEXT entities are selected (prompt "\nNo MTEXT entities selected.") ) (princ) ;; Quiet exit ) (princ "\nCommand 'ResetMTXT' loaded. Type ResetMTXT to run it.") (princ)
  10. I have a drawing made in model space and displayed at 1:100 in an A4 Viewport Landscape layout. No problem, but when I open a second layout using an A3 paper size I assumed the drawing would automatically fit if scaled at 1:50, however, the drawing appears cropped. Please help me understand what I may be expecting or doing wrong.
  11. Those course (i.e. - project) files would only be available to actual paying students although if you were to search through the many threads re: Penn-Foster you could conceivably find individual project files students have posted copies of over the years. For example, the Oleson Village Project. What is your interest in the files?
  12. You can turn the viewport off and everything in it will not plot. Frozen layers will still plot, you need to turn them off.
  13. Emmanuel Delay

    Automatically add text to a table

    I think this is what you want. Command ATTT (vl-load-com) ;; ATTT for Add Text To Table (defun c:ATTT ( / rowstart obj texts i x x_vals x_vals_sorted) (setq rowstart (getint "\nStart Row (row 1 = the row of 000): ")) (setq obj (vlax-ename->vla-object (car (entsel "\nPick table: ")))) (princ "\nSelects the green title objects: ") (setq texts (ssget (list (cons 0 "TEXT") (cons 8 "TEXT-0.3")))) (setq x_vals (list)) (setq i 0) (repeat (sslength texts) (setq x (nth 0 (cdr (assoc 10 (entget (ssname texts i)))))) (setq x_vals (append x_vals (list x))) (setq i (+ i 1)) ) ;; sort the x-values (setq x_vals_sorted (vl-sort-i x_vals '<)) (setq i 0) (setq col 0) (repeat (sslength texts) (setq text (ssname texts (nth i x_vals_sorted))) (setq title (cdr (assoc 1 (entget text)))) (setq row (+ i rowstart)) (vla-settext obj row col title) (setq i (+ i 1)) ) (princ) )
  14. If you just want to add to end of a table it is easy as there is a function of Vla-insertrow so just do that for the extra text you want I would look at a selection set. So can do in random order or some sorted list of the selection set. Could then read the entire table and resort it if required.
  15. Emmanuel Delay

    Automatically add text to a table

    I think based on something Bigal wrote, link in the code. Command TEST (feel free to rename) - User selects the table - User picks the start row. Fill in 1 for the row of 000, Fill in 2 for the row of 001, ... (you can hardcode this (setq row 1) if you will always start with 1 - User selects the title objects, the green text objects "GENERAL NOTES 0" ... one by one ;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/user-text-to-existing-table-cells/td-p/12238012 ;;You can get tables using ssget. ;; ;;I just posted this, the 0 0 is the title, 1 1 is 1st cell in header (vl-load-com) (defun c:test ( / obj rows cols row col value_ cellvalue) (setq obj (vlax-ename->vla-object (car (entsel "\nPick table: ")))) (setq rows (vlax-get-property obj 'rows)) (setq cols (vlax-get-property obj 'columns)) ;; get value of a cell ;;(setq col (getint "\nColumn: ")) ;;(setq row (getint "\nRow: ")) ;;(setq cellvalue (vlax-variant-value (vla-GETCELLVALUE OBJ row col))) ;;(princ "\n") ;;(princ cellvalue) ;;;;;;;;;;;; (setq col 0) (setq row (getint "\nStart Row (row 1 = the row of 000): ")) (princ "\nNow select texts: ") (while (setq title_obj (entsel "\ntitle object: ")) (setq title (cdr (assoc 1 (entget (car title_obj))))) ;;So if you know where "REVISION" is row & column can check easy then use next to put values. (vla-settext obj row col title) (setq row (+ row 1)) ) ) Happy with this? We can quite easily let you select all the all the frames, and read all the Text objects on layer "TEXT-0.3", sort from left to right, ... then auto fill in the table If you want
  16. I have looked everywhere for coursework cad files and haven't found anything. any help would be appreciated It tells you to go to 'X' file, but it doesn't exist.
  17. Hello, Can anyone help me with my dilemma. I'm doing AutoCAD automation and I want a schedule to not shows at time but show at other times. The schedule is shown through a viewport. I have tried making a costume viewport layer for it and freezing it. But freezing the layer of the vp does not seem to stop what inside the vp from printing. So is there an option to link the viewport to what it shows so if I freeze the vp layer it won't print what it shows.
  18. Yesterday
  19. Hi All, This is just to let you know that we have recently had a problem with the validation of new user registrations. This meant that some people will not have been able to register for the forum. This must have been frustrating and I apologise for any inconvenience this may have caused. The problem with the anti-spam controls has now been fully resolved and all visitors are now able to register. Thanks for your continued support, David
      • 1
      • Thanks
  20. How to keep attribute's text horizontal (rotation =0) by dynamic blocks with alignement parameter ? i see a lot of info for keeping text horizontal by block rotation but not for block alignement.
  21. Hi every one I need a lisp that adds the texts I select, to a pre defined table in Autocad. In the attached file, I need to select texts in the "DRAWING TITLE" part, and add them to the first column of the table. It would be great if the lisp, itself, can automatically select all of the mentioned texts and add them to the table. But if not, I can manually select the texts, and the lisp adds them to the table. Add Text to Table.dwg
  22. Last week
  23. @BIGAL, sorry for the late reply. Here's the property: \pxqj;all work and no play makes jack a dull boy; all work and no play makes jack a dull boy; all work and no play makes jack a dull boy; all work and no play makes jack a dull boy; all work and no play makes jack a dull boy; all work and no play makes jack a dull boy; all work and no play makes jack a dull boy; all work and no play makes jack a dull boy; all work and no play makes jack a dull boy; all work and no play makes jack a dull boy; See screen shot of the properties that shows this too along with how the mleader is left justified and not using justified paragraph. The editor is correct, but as soon as I exit, it displays as above.
  24. This fake is worth more than two cents. The code works the way I wanted it to. Thanks! But I don't understand why I should drive carefully.
  25. Lee Mac

    Counting arrayrect elements

    No, I mean the data returned by my (LM:arraydata) function - you just assumed you should use the length of the list, without actually checking what the list contains.
  26. GLAVCVS

    Counting arrayrect elements

    P.S.: This is just my two cents — though to be honest, it’s probably counterfeit
  27. GLAVCVS

    Counting arrayrect elements

    This is the first time I’ve ever done an “autopsy” on an object like this. I’ve carefully extracted what seemed to me to be the information I was looking for. So I must say: DRIVE CAREFULLY AND RESPECT ALL STOP SIGNS.
  28. GLAVCVS

    Counting arrayrect elements

    (defun c:CountElemArrayrect (/ ss n pt ent le dameFFCC) (defun dameFFCC (ent / items rows cont cols filas) (foreach l (entget (cdr (assoc 330 (entget (cdr (assoc 330 (entget ent))))))) (cond (items (if (= (setq cont (+ (if cont cont 0) (if (= (car l) 90) 1 0))) 3) (setq cols (cdr l) items nil cont nil))) (rows (if (= (setq cont (+ (if cont cont 0) (if (= (car l) 90) 1 0))) 3) (setq filas (cdr l) rows nil cont nil))) ((= (car l) 1) (if (= (cdr l) "Items") (setq items T) (if (= (cdr l) "Rows") (setq rows T)) ) ) ) ) (if (and filas cols) (* filas cols)) ) (princ "Select a arrayrect: ") ;;; (setq ss (ssget '((0 . "ARRAY"))) ;;; n 0) (if (and (setq ent (car (entsel))) (= (cdr (assoc 0 (setq le (entget ent)))) "INSERT") (= "ACDBASSOCDEPENDENCY" (cdr (assoc 0 (entget (cdr (assoc 330 le))))))) (progn (setq n (dameFFCC ent)) ;;; (vla-get-Count ;;; (vlax-ename->vla-object (ssname ss 0)))) (princ (strcat "The number of elements in the array: " (itoa n))) (princ "Specify the insertion point of the text: ") (setq pt (getpoint)) (if pt (entmakex (list (cons 0 "TEXT") (cons 10 pt) (cons 1 (itoa n)) (cons 40 25) ; text height (cons 7 (getvar "TEXTSTYLE")) ) ) ) ) ) (princ) )
  29. number of array elements.dwg
  1. Load more activity
×
×
  • Create New...