Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/18/2020 in all areas

  1. just FYI You should avoid lisp that uses increment block naming because you will run into naming conflicts if you ever try to combine two drawings together. well not really conflicts if the blocks are not the same it will change to the block the drawing you are pasting into. Example. Drawing 1 has P2B1 block its a circle. Drawing 2 has P2B1 block its a rectangle. if you copy P2B1 from Drawing1 and paste it into Drawing 2 it will be a rectangle because that is what is defined in Drawing 2 as P2B1. AutoCAD does this all automatically so if you are not paying attention you will miss it. look at this for random name generating. or add the drawing name into the block name Drawing1-P2B1 Drawing2-P2B1
    1 point
  2. Use this pick an object reveals all sorts of stuff. Pick a table and a dim. ;;;===================================================================; ;;; DumpIt ; ;;;-------------------------------------------------------------------; ;;; Dump all methods and properties for selected objects ; ;;;===================================================================; (defun C:Dumpit ( / ent) (while (setq ent (entsel)) (vlax-Dump-Object (vlax-Ename->Vla-Object (car ent)) ) ) (princ) )
    1 point
  3. Dadgad can see numbers being used stops any probs with shortcut alpha keys, 47 is osmode 47. Re lengths made U D L R lisp Type l123 u45 r56.76 d34.6 etc draws ortho lines in direction up down etc.
    1 point
  4. If you open code in Vlide and check code the top line in "build" output will make a list of global variables you can copy and paste into the localise part of the defun saves a bit of time typing. Thanks to Lee-mac for that hint. an example of missing local variables. ; === Top statistic: ; Global variables: (A B K1 K2 L PT1 PT10 PT11 PT12 PT13 PT14 PT15 PT2 PT3 PT4 PT5 PT6 PT7 PT8 PT9 SZIGMA)
    1 point
  5. I have cut this out of some code I just did and its a starting point you would pick all rectangs use this method and make a list of entity name and d1 d2 Y (-1 . <Entity name: 3e66fd20>) sort the list and you should have a list of common size rectangs in sequence. (100 200 Entity name: 3e66fd20>) (100 200 Entity name: 3e66fd21>) (100 200 Entity name: 3e66fd22>) replace entsel with ssget and use a repeat and ssname to go through selection (setq plent (entsel "Pick obj")) (if (= (cdr (assoc 0 (entget (car plent)))) "LWPOLYLINE") (progn (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car plent))))) (setq pt1 (nth 0 co-ord)) (setq pt2 (nth 1 co-ord)) (setq pt3 (nth 2 co-ord)) (setq pt4 (nth 3 co-ord)) (setq d1 (distance pt1 pt2)) (setq d2 (distance pt2 pt3)) (if (< d1 d2) swap to make say shortest 1st do your thing and make a list )) sort list repeat make a block 1st rectang using d1 d2 insert at nth 0 co-ord angle is 1st -> 2nd point
    1 point
  6. Last time I had a program that worked 'sometimes' was because I had not localized my variables, and because some variable names were used in other programs, the initial values were incorrect. Steve
    1 point
  7. Have you tried ETRANSMIT to a folder? Seems to gather everything (and a bit more) and you can remove paths from xrefs and images.
    1 point
  8. 'up' is a list of the two points entailing the upper horizontal line: ((5 3 0) (1 3 0)) 'dw' is a list of the two points entailing the lower horizontal line: ((0 0 0) (7 0 0)) mapcar works as such: (mapcar <function_accepting_n_arguments> <list1> <list2> ... <listn>) And it will return a list resulting from the evaluation of the function as a result of passing its elements into the function... meaning: The first result of mapcar in the list will be by passing: The first item of list1 denoting the first argument of the function, The first item of list2 denoting the second argument of the function, The first item of listn denoting the nth argument of the function. Then the second result of mapcar in the list will be by passing: The second item of list1 denoting the first argument of the function, The second item of list2 denoting the second argument of the function, The second item of listn denoting the nth argument of the function. This process continues until whichever's lists run out first, and evaluation stops. Ultimately, the length of the returned mapcar list will be the length of the shortest list from list1 to listn, so if any one of the lists supplied is nil, mapcar returns nil That said... the function distance accepts two points, so that means following the "(mapcar 'distance" should accept two lists... which is up and dw. Writing (mapcar 'distance '((5 3 0) (1 3 0)) '((0 0 0) (7 0 0)) ) is the equivalent to: (list (distance '(5 3 0) '(0 0 0)) (distance '(1 3 0) '(7 0 0)) ) Lambda is basically a user defined function. You write it in the form of '(lambda (a b c ...) <expressions>) and then following a few more lists equaling the number of arguments in the lambda function. The above and below mean exactly the same thing: (mapcar '(lambda (a b) (distance a b) ) '((0 0 0) (7 0 0)) '((5 3 0) (1 3 0)) ) Now, depending on whether the direction of the upper and lower lines are in the same direction or not (by using the (angle) function), that's the purpose of the reverse function to make sure that the correct diagonal is returned instead. In the end, the above returns '(5.83095 6.7082)
    1 point
  9. (defun fnc (lst / dw tol unq up) (setq tol 1e-7) (if (and (= (length lst) 4) (= (length (setq unq (LM:UniqueFuzz (mapcar 'cadr lst) tol))) 2) (= (length (setq up (vl-remove-if-not '(lambda (x) (equal (cadr x) (apply 'max unq) tol ) ) lst ) ) ) 2 ) (= (length (setq dw (vl-remove-if-not '(lambda (x) (equal (cadr x) (apply 'min unq) tol ) ) lst ) ) ) 2 ) ) (append (list (apply 'distance up) (apply 'distance dw) ) (mapcar 'distance up (if (equal (apply 'angle up) (apply 'angle dw)) (reverse dw) dw)) (list (abs (apply '- unq))) ) ) ) ;; Unique with Fuzz - Lee Mac ;; Returns a list with all elements considered duplicate to ;; a given tolerance removed. (defun LM:UniqueFuzz ( l f / x r ) (while l (setq x (car l) l (vl-remove-if (function (lambda ( y ) (equal x y f))) (cdr l)) r (cons x r) ) ) (reverse r) )
    1 point
  10. Perhaps you could explain the next step as to why you explode the leader, is it that you want to move or get the co-ordinates ?
    1 point
  11. Without a drawing (AutoCAD 2010 format) containing an MLeader I can't provide a solution. As to why, it is because the textleftattachment is set to underline bottom of text, If you explode the leader or delete the text there is no associated text to underline
    1 point
  12. This is an English speaking forum. Please post your replies in English. Here is Google's translation:
    1 point
×
×
  • Create New...