Jump to content

All Activity

This stream auto-updates

  1. Past hour
  2. Is it possible not to specify break points, but just to do it to the right of the text?
  3. Just sharing a simple script I just wrote, I don't have a question When drawing the hidden lines of stairs steps (the overlap of the lower step hidden under the step above) I thought: I would like to select all the steps; multi offset them; the offset lines should be selected and gripped, so that I can set them in a different layer (a layer with LType Hidden) ... But feel free to comment, improve, ... ;; Multi Offset. New objects get selected and gripped. ;; For example to make the hidden stairs steps... Select all (defun c:moff ( / sel ss pt3 i off_dst obj elast pickset1) (setq off_dst (getdist "\nOffset Distanct: ")) (setq pt3 (getpoint "\nOffset point: ")) (setq pickset1 (ssadd)) (princ "\nSelect objects: ") (setq ss (ssget)) (setq i 0) (repeat (sslength ss) (setq obj (ssname ss i)) (command "offset" off_dst obj pt3 "") (setq elast (entlast)) ;; (ssadd elast pickset1) (setq i (+ i 1)) ) ;; now grip the pickset (the newly made objects) (sssetfirst nil pickset1) )
  4. Today
  5. GLAVCVS

    dimjogline plus in dimension ... help

    I think I forgot something important: when there are multiple selections, it's necessary to show the user which object will be modified in each case. Below, I've included the complete code with a zoom utility to show the user the next object to modify. ; Original by RonJonP, edited by P. Kenewell and GLAVCVS (defun c:ltx (/ o s pt i p1 p2 le) (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 (not (tblsearch "APPID" "ACAD_DSTYLE_DIMJAG_POSITION")) (regapp "ACAD_DSTYLE_DIMJAG_POSITION") ) (command "_zoom" "_w" (setq i (cdr (assoc 10 (setq le (entget e))))) (polar i (angle (setq p2 (cdr (assoc 14 le))) (setq p1 (cdr (assoc 13 le)))) (distance p1 p2))) (if (setq pt (getpoint "\rJOG: Pick a point on the DIMENSION line")) (entmod (append (entget e) (list (list -3 (list "ACAD_DSTYLE_DIMJAG_POSITION" '(1070 . 387) '(1070 . 3) '(1070 . 389) (cons 1010 pt)))))) ) (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) )
  6. GLAVCVS

    dimjogline plus in dimension ... help

    To indicate the 'jog' position 1 to 1, insert this code after the clause ((= "DIMENSION"... (entget e) )))) (if (not (tblsearch "APPID" "ACAD_DSTYLE_DIMJAG_POSITION")) (regapp "ACAD_DSTYLE_DIMJAG_POSITION") ) (if (setq pt (getpoint "\nJOG: Pick a point on the DIMENSION line")) (entmod (append (entget e) (list (list -3 (list "ACAD_DSTYLE_DIMJAG_POSITION" '(1070 . 387) '(1070 . 3) '(1070 . 389) (cons 1010 pt)))))) )
  7. GLAVCVS

    dimjogline plus in dimension ... help

    Hi Do you want to place the 'jog', indicating its location in each case, or in a predetermined location?
  8. Yesterday
  9. CyberAngel

    Text box auto resize

    I downloaded the code and ran it. No problem here. I made sure to change the Defined Width property and to add a mask and a frame. That way the change is obvious once it happens. Is it possible you're using it on text and not mtext? Because the function excludes anything that's not mtext.
  10. shokoufeh

    Automatically add text to a table

    Great. It worked. Thanks
  11. ghuuuu

    Text box auto resize

    I think Lee Mac is onto something, I just can't make it work just like IndianaJackson said, nothing happened. Did anyone manage to make it work?
  12. Also you can return the vla-object list with foreach by wrapping it in mapcar. eliminating having to use (setq o (vlax-ename->vla-object e)). Pulling the vla-object name before the cond means your checking the variable rather then check the entity up to 3 times. ; Original by RonJonP, edited by P. Kenewell, updated by Mhupp (defun c:ltx (/ D O S) (vl-load-com) (setq D (vla-get-activedocument (vlax-get-acad-object))) (vla-startundomark D) (if (setq s (ssget ":L" '((0 . "*TEXT,DIMENSION")))) (foreach o (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))) (setq typ (vla-get-ObjectName o)) (cond ((= typ "AcDbText") (vla-put-textstring o (strcat "%%O" (vl-string-subst "" "" (vl-string-subst "" "%%O" (vla-get-textstring o))))) ) ((= typ "AcDbMText") ... ) ((= typ "AcDbDimension") ... ) ) ) ) (vla-endundomark D) (princ) ) -edit also useing the (vla-startundomark allows you to have things selected before you run the command.
  13. Last week
  14. Good old fashioned google 1st found this not sure if helpful. https://help.autodesk.com/view/ACDMAC/2025/ENU/?guid=GUID-E0859F66-985A-4A20-BCB4-1B57D24DC100
  15. BIGAL

    Trouble displaying drawing in Viewport

    @eldon has certainly given you the correct answer. Our title blocks were an A1 sheet but we plotted hard copy & PDF most times to be a A3 sheet. The was produced by setting the scale factor in "PLOT" to 1=2 so a 1:250 viewport would be 1:500 in an A3, so objects could be scaled. So we never mixed and matched the title blocks size. Only used one size so you probably need to think about that. If you stick with A3 you can probably have 2 viewports per layout at 1:100.
  16. 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) )
  17. 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?
  18. 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.
  19. 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.
  20. 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.
  21. 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.
  22. (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)
  23. 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.
  24. 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?
  25. You can turn the viewport off and everything in it will not plot. Frozen layers will still plot, you need to turn them off.
  26. 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) )
  27. 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.
  28. 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
  29. 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.
  1. Load more activity
×
×
  • Create New...