Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/03/2022 in all areas

  1. This will do it, using regular selection like you would using the MOVE or COPY command. If the two lines are already in a group, that makes it even better because then you can just select the group in one click, but you said you've got a large number of lines, so I highly doubt you have them... Command will keep continuing until you select nothing (or 'Esc'): (defun c:foo ( / ip m p1 p2 p3 p4 ss) (defun m (a b) (mapcar '/ (mapcar '+ a b) '(2.0 2.0 2.0))) (while (setq ss (ssget '( (-4 . "<OR") (0 . "LINE") (-4 . "<AND") (0 . "LWPOLYLINE") (90 . 2) (-4 . "<NOT") (-4 . "!=") (42 . 0.0) (-4 . "NOT>") (-4 . "AND>") (-4 . "OR>") ) ) ) (if (/= (sslength ss) 2) (princ "\nSelect only two straight lines to proceed.") (progn (setq p1 (vlax-curve-getstartpoint (ssname ss 0)) p2 (vlax-curve-getendpoint (ssname ss 0)) p3 (vlax-curve-getstartpoint (ssname ss 1)) p4 (vlax-curve-getendpoint (ssname ss 1)) ) (cond ( (setq ip (inters p1 p2 p3 p4 nil)) (if (> (distance ip p1) (distance ip p2)) (mapcar 'set '(p1 p2) (list p2 p1))) (if (> (distance ip p3) (distance ip p4)) (mapcar 'set '(p3 p4) (list p4 p3))) ) ( (not (equal (angle p1 p2) (angle p3 p4) 1e-6)) (mapcar 'set '(p3 p4) (list p4 p3)) ) ) (entmake (list '(0 . "LINE") (cons 10 (m p1 p3)) (cons 11 (m p2 p4)))) ) ) ) (princ) )
    2 points
  2. Did you look at what I posted 12 years ago, this has sliders as well for input. The Total is "text".
    1 point
  3. What I was trying to do originally was offer the user of my dialog box two options for picking a point; either selecting the point onscreen, or typing the coordinates into two edit boxes. However, if the user chose the point onscreen, I wanted to update the edit boxes with the coordinates of the point they chose. I got that to work (yay!) and I used a very similar approach to solve this problem. I had to use one small cheat (in order to calculate the sum, you have to check a toggle box) but I don't think this would be too much trouble for your user. The most important thing I learned since my original post was how to use set_tile and how to use a while loop to "refresh" a dialog box for calculations. This tutorial was great for the latter! https://www.afralisp.net/dialog-control-language/tutorials/hiding-dialog-boxes-revisited-part-2.php Attached are the two .lsp files I wrote along with the dcl and a picture of the dialog box. I'm very beginner to autolisp and DCL, so this is undoubtedly not the most elegant solution, but I think it woks pretty well! testytesty.dcl testytesty.lsp check.lsp
    1 point
×
×
  • Create New...