Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/27/2025 in all areas

  1. You should use the bitwise equals operator ("&="), as I have explained above.
    1 point
  2. Have you explored Polar Tracking and set up to Relative to last segment? Once you find out about it, you will wonder how you managed without it!
    1 point
  3. DXF group 70 always holds a bit-coded integer value (i.e. an integer for which each bit (power of 2) encodes a setting); given this, you should use the bitwise relational operators ("&" and "&=") when filtering bit coded values. Here: The "&" operator is equivalent to the AutoLISP expression (/= 0 (logand bit filter)) and means all of the filter bits must be set. The "&=" operator is equivalent to the AutoLISP expression (= filter (logand bit filter)) and means any of the filter bits can be set. For your example, you state: This implies that you want to select either closed polylines, or polylines with linetype generation enabled, or both - and so the filter would be: (ssget "_X" '((0 . "LWPOLYLINE") (-4 . "&") (70 . 129))) If instead, you mean to select only closed polylines, you should use: (ssget "_X" '((0 . "LWPOLYLINE") (-4 . "&=") (70 . 1)))
    1 point
  4. If you want to select LWPOLYLINE entities that are closed (not DXF70 = 0/128), I'd suggest something like this... (ssget (list (cons 0 "LWPOLYLINE") (cons 90 4) (cons 8 "Layout_Frame") (cons -4 "<or") (cons 70 1) (cons 70 129) (cons -4 "or>"))) Or just little simplyfied... (ssget (list (cons 0 "LWPOLYLINE") (cons 90 4) (cons 8 "Layout_Frame") (cons -4 "&=") (cons 70 1)))
    1 point
  5. I'll check out those links. Everything still seems to be working fine here. I hope this thread will help others who have the same problem. Thanks, everyone.
    1 point
  6. You can paste the 'ordena' function below the rest of the code.
    1 point
  7. Try to do it with the explanations I've given you. That will help you understand the changes somewhat. If there's anything in the explanation you don't understand, don't hesitate to ask.
    1 point
  8. You can call this function after creating the two ssets with '(ordena col1 col2)'. Then you should undo the 5 lines of code under ';; Defining the step...' And in 'repeat', replace '(sslength col1)' with '(length l1)' Additionally, you would also need to replace '(ssname col1 i)' with '(cadr (nth i l1))' and '(ssname col2 i)' with '(cadr (nth i l2))' Finally, if you want p3 to be exactly the same Y coordinate as the text in column 2, you can replace your current code '(setq p3 (+ (cadr basept)...)' with '(setq p3 (list (car basept) (car (nth i l2)) 0.0))' With all this, your code should work.
    1 point
  9. More compact (defun ordena (cj1 cj2 / e l n m c) (setq l1 nil l2 nil) (foreach cj (list cj1 cj2) (setq l (cons (vl-sort (while (setq e (ssname cj (setq n (if n (1+ n) 0)))) (setq c (cons (list (caddr (assoc 10 (entget e))) e) c)) ) '(lambda (a b) (> (car a) (car b))) ) l ) c nil n nil ) ) (setq l1 (car l) l2 (cadr l)) )
    1 point
  10. If the order will always be the same, and the number of elements will also be the same (because the code ensures this), then all you need to do is convert the two sets into two lists ordered by their Y coordinates, from highest to lowest. This could be done like this: (defun ordena (cj1 cj2 / e l n m) (setq l1 nil l2 nil) (setq l1 (vl-sort (while (setq e (ssname cj1 (setq n (if n (1+ n) 0)))) (setq l (cons (list (caddr (assoc 10 (entget e))) e) l)) ) '(lambda (a b) (> (car a) (car b))) ) l nil ) (setq l2 (vl-sort (while (setq e (ssname cj2 (setq m (if m (1+ m) 0)))) (setq l (cons (list (caddr (assoc 10 (entget e))) e) l)) ) '(lambda (a b) (> (car a) (car b))) ) ) ) In these lists each element is another list of 2 elements, where the first is the Z coordinate of the text and the second, its entity name.
    1 point
  11. Comparing rows of text is not a problem it can be done very easy have done many times but this confuses me. How do you pick the two numbers to compare, if it's in order on right examples then must be done in a pick pick manner if its as per "correctly" on right then yes its easy. This one Or this one
    1 point
  12. I haven't looked at the example - weekend and CAD is off, but how many rows do you have to calculate and on how many drawings? Reason I ask is I often find that the rule a LISP operates with are often not perfect and don't accommodate every situation - If the operation I need to do is not excessive then I refer to do it be select row text 1, row 1 text 2 and then place the result, repeat with row 2, and so on Things to also consider is an overkill on the texts to assess to remove duplicates, check that any mtexts are 1 line texts, text 1 or 2 are strings and not numbers, texts are not text or mtext (attributes, blocks, rtexts (they happen), mtexts don't cover both columns, texts don't cover both columns... and many more things that can stop the routine from completing or making a miss match from one column to the next.
    1 point
  13. My best guess, running AutoCAD 2015 on Windows 10, IIRC AutoCAD 2016 after a service pack was the first AutoCAD for Windows 10. So, possibly either a Windows 10 update and/or an AutoCAD crash created the issue. At work (and sometimes at home) I use Visual Studio Code with AutoCAD extension. Getting Started with Visual Studio Code (AutoLISP/VS Code) | Autodesk AutoCAD AutoLISP Extension - Visual Studio Marketplace
    1 point
  14. Just a comment, I use Notepad++ for coding, I mention this as, you can close notepad++ without saving and it opens up to where you were last, you can download an extra module and it allows you to run your lisp code from Notepad++, Acad only, not working with Bricscad, has lisp code detection bracket checking built in, checks brackets dcl code. Yes when I get real stuck with a bug copy code into Vlide or Blade.
    1 point
×
×
  • Create New...