Jump to content

All Activity

This stream auto-updates

  1. Past hour
  2. Hello. I have a multileader entity. I want to add additional leaders to my multileader. acadObj is the ActiveX object of my multileader. This is how I made it work for me: (setq muu_lead_vert_new_indx (vla-AddLeader acadObj)) (setq muu_lead_vertices_new (vlax-make-safearray vlax-vbdouble '(0 . 8))) (vlax-safearray-fill muu_lead_vertices_new (list pt1 pt2 pt3)) (vla-AddLeaderLine acadObj muu_lead_vert_new_indx muu_lead_vertices_new) It pretty much does the trick, but not as neat as I want it. If I add multiple leaders, and then I want to work with the new leaders... I search for new leaders via: (vlax-invoke acadObj 'getleaderlineindexes 0) (vlax-invoke acadObj 'getleaderlineindexes 1) but 1st command returns '(0), and the second one returns '(1), even if I already have 5 or 8 or 10 leaders on my multileader. An ugly way around that I found, is the following: (setq sbe_ml_indxlist (vl-sort (append (vlax-invoke acadObj 'getleaderlineindexes 0) (vlax-invoke acadObj 'getleaderlineindexes 1)) '<)) (and (/= (length sbe_ml_indxlist) (vla-get-LeaderCount acadObj)) (foreach memb '(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20) (and (not (vl-catch-all-error-p (vl-catch-all-apply '(lambda (x) (vla-GetLeaderIndex acadObj x)) (list memb)))) (setq sbe_ml_indxlist (append sbe_ml_indxlist (list memb)))))) The idea is: I make a list of leader indexes (first 2 lines). In my code I have more lines prior to it... with some verifications... but the idea is that sbe_ml_indxlist in first 2 lines should get all existing leader line indexes. Next 4 lines, check: If leader indexes added via vla-AddLeaderLine do not end in the list composed by getleaderlineindexes, I check 1 by 1, if a leader with index X exists, it adds that index to the list of existing indexes. There are still many problems... I don't want to get into too much detail... because my post is not about "solving 20 problems"... which result from damaging the multileader entity... My post is about: "please tell me the right way to add leaders to existing multileader" Some of extra-problems with multileader on which I did run vla-AddLeader, just fyi: 1. One time I had a multileader with 10+ leaders, but vla-get-leadercount showed 8 leaders. After I copied the multileader, the new one was returning 7 from vla-get-leadercount. 2. If I add leaders via (command "_.mleaderedit" entname "A" $ pause), than the ones added to the left of multileader are seen via getLeaderLineIndexes but the ones added to the right are not seen. 3. Once I had a case that getLeaderLineIndexes did not return 0-index leader... but (getLeaderIndex acadObj 0) showed that such a leader exists, but I can't recreate it.
  3. Today
  4. Yesterday
  5. leonucadomi

    dimjogline plus in dimension ... help

    I love this, it's excellent, thank you
  6. leonucadomi

    dimjogline plus in dimension ... help

  7. Nikon

    Multi offset - drawing stairs

    I would add: ; Original by Emmanuel Delay + additions (defun c:MuOffLay ( / ss pt3 i off_dst obj elast pickset1 old_dst str_prompt) ;; creating a new layer (if (not (tblsearch "LAYER" "OffsetLines")) (command "_-layer" "_make" "OffsetLines" "_color" "1" "OffsetLines" "") ) ;; memorizing the distance (setq old_dst (getenv "MULTIOFF_LASTDST")) (if old_dst (progn (setq str_prompt (strcat " Offset Distance <" old_dst ">: ")) (setq off_dst (getreal str_prompt)) (if (not off_dst) (setq off_dst (atof old_dst)) ) ) (setq off_dst (getdist " Offset Distance: ")) ) (setenv "MULTIOFF_LASTDST" (rtos off_dst 2 3)) (setq pt3 (getpoint " Offset point: ")) (setq pickset1 (ssadd)) (princ " Select objects: ") (setq ss (ssget)) (setq i 0) (while (< i (sslength ss)) (setq obj (ssname ss i)) (command "_.offset" off_dst obj pt3 "") (setq elast (entlast)) (command "_.chprop" elast "" "_la" "OffsetLines" "_color" "1" "") (ssadd elast pickset1) (setq i (1+ i)) ) (sssetfirst nil pickset1) (princ) )
  8. GLAVCVS

    dimjogline plus in dimension ... help

    And this is the small variation that best fits what @leonucadomi is asking for, I think. With the peculiarity that the "jog" will be placed where the selection is made with the pickbox. ; Original by RonJonP, edited by P. Kenewell and GLAVCVS (defun c:ltx (/ e o s le to l) (setvar "cmdecho" 0) (command "._undo" "_be") (while (and (setq e (car (setq l (entsel "\rSelect a TEXT, MTEXT or DIMENSION...")))) (wcmatch (cdr (assoc 0 (setq le (entget e)))) "*TEXT,DIMENSION")) (setq o (vlax-ename->vla-object e)) (cond ((= "TEXT" (setq to (cdr (assoc 0 le)))) (vla-put-textstring o (strcat "%%O" (vl-string-subst "" "" (vl-string-subst "" "%%O" (vla-get-textstring o)) ) ) ) ) ((= "MTEXT" to) (vla-put-textstring o (strcat "\\O" (vl-string-subst "" "" (vl-string-subst "" "\\O" (vla-get-textstring o)) ) ) ) ) ((= "DIMENSION" to) (if (not (tblsearch "APPID" "ACAD_DSTYLE_DIMJAG_POSITION")) (regapp "ACAD_DSTYLE_DIMJAG_POSITION") ) (entmod (append le (list (list -3 (list "ACAD_DSTYLE_DIMJAG_POSITION" '(1070 . 387) '(1070 . 3) '(1070 . 389) (cons 1010 (cadr l))))))) (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) )
  9. GLAVCVS

    dimjogline plus in dimension ... help

    This will do what you want by selecting multiple objects in the selection set. ; Original by RonJonP, edited by P. Kenewell and GLAVCVS (defun c:ltx (/ o s le to p1 p2 pIns) (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" (setq to (cdr (assoc 0 (setq le (entget e)))))) (vla-put-textstring o (strcat "%%O" (vl-string-subst "" "" (vl-string-subst "" "%%O" (vla-get-textstring o)) ) ) ) ) ((= "MTEXT" to) (vla-put-textstring o (strcat "\\O" (vl-string-subst "" "" (vl-string-subst "" "\\O" (vla-get-textstring o)) ) ) ) ) ((= "DIMENSION" to) (if (not (tblsearch "APPID" "ACAD_DSTYLE_DIMJAG_POSITION")) (regapp "ACAD_DSTYLE_DIMJAG_POSITION") ) (setq p1 (cdr (assoc 13 le)) p2 (cdr (assoc 14 le)) pIns (polar (cdr (assoc 10 le)) (angle p2 p1) (* (distance p1 p2) 0.8)) x (entmod (append (entget e) (list (list -3 (list "ACAD_DSTYLE_DIMJAG_POSITION" '(1070 . 387) '(1070 . 3) '(1070 . 389) (cons 1010 pIns)))))) ) (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) )
  10. 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 )
  11. 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
  12. 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) )
  13. 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.
  14. leonucadomi

    dimjogline plus in dimension ... help

    a default location near any arrow
  15. leonucadomi

    dimjogline plus in dimension ... help

    something is wrong
  16. Is it possible not to specify breakpoints, but just make a break to the right of the text?
  17. 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) )
  18. 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) )
  19. 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)))))) )
  20. 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?
  21. Last week
  22. 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.
  23. shokoufeh

    Automatically add text to a table

    Great. It worked. Thanks
  24. 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?
  25. 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.
  26. 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
  27. 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.
  28. 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) )
  1. Load more activity
×
×
  • Create New...