Jump to content

All Activity

This stream auto-updates

  1. Today
  2. Change if to while. (if (setq s (ssget ""_+.:E:S" '((0 . "*TEXT,DIMENSION")))) .. runs once ) (while (setq s (ssget "_+.:E:S" '((0 . "*TEXT,DIMENSION")))) ... repeats while you have an entity selected. have to right click or enter to exit loop )
  3. leonucadomi

    dimjogline plus in dimension ... help

    I have already managed to change the selection to individual and cancel the zoom but to repeat the routine I use repeat 100 (....) I don't know any other way
  4. Its incomplete code and only uses vla-object names showing best practice for using cond. Use the original code setting e type outside the cond to check instead of using enget for each cond check. with dimensions you use entget three times, mtext two times. its probably only saving ms of time. ; Original by RonJonP, edited by P. Kenewell and GLAVCVS (defun c:ltx (/ o s pt i p1 p2 le typ) (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 typ (cdr (assoc 0 (entget e)))) (setq o (vlax-ename->vla-object e)) (cond ((= "TEXT" typ) ... ) Every time you are using enget its returning something like this. ( (0 . "MTEXT") ; saving this bit (5 . "1F2") (330 . <owner>) (100 . "AcDbEntity") (67 . 0) (8 . "TextLayer") (100 . "AcDbMText") (10 100.0 200.0 0.0) (40 . 2.5) (41 . 50.0) (71 . 1) (72 . 5) (1 . "This is a multiline text") (7 . "Standard") (210 0.0 0.0 1.0) (11 100.0 200.0 0.0) (42 . 1.0) (43 . 1.0) (50 . 0.0) (73 . 1) (44 . 0.0) (45 . 0.0) (90 . 0) (91 . 1) (92 . 0) (93 . 0) (94 . 0) (95 . 0) )
  5. leonucadomi

    dimjogline plus in dimension ... help

    This is what I need, I just would like it to be for selecting a single selection (entsel) and not zoom, Just select a dimension and a point for the jogline and repeat the routine.
  6. leonucadomi

    dimjogline plus in dimension ... help

    a default location near any arrow
  7. leonucadomi

    dimjogline plus in dimension ... help

    something is wrong
  8. Is it possible not to specify breakpoints, but just make a break to the right of the text?
  9. 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) )
      • 1
      • Like
  10. 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) )
  11. 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)))))) )
  12. 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?
  13. Yesterday
  14. 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.
  15. shokoufeh

    Automatically add text to a table

    Great. It worked. Thanks
  16. 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?
  17. 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.
  18. Last week
  19. 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
  20. 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.
  21. 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) )
  22. 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?
  23. 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.
  24. 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.
  25. 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.
  26. 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.
  27. (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)
  28. 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.
  1. Load more activity
×
×
  • Create New...