Jump to content

All Activity

This stream auto-updates

  1. Past hour
  2. EnM4st3r

    get closest endpoint of selection

    Nice. It only placed them visually tough, not on the exact endpoints. I changed it a little, seems to work now. (defun c:foo (/ ss selPt obj pt1 pt2) (while (not ss) (setq ss (ssget "_+.:E:S" '((0 . "LINE")))) ) (setq selPt (trans (cadr (nth 3 (car (ssnamex ss 0)))) 0 2)) ; get point of selection (setq obj (vlax-ename->vla-object (ssname ss 0))) (setq pt1 (vlax-curve-getStartPoint obj)) (setq pt2 (vlax-curve-getEndPoint obj)) ;; Determine closer endpoint (if (< (distance selPt (reverse (cdr (reverse (trans pt2 0...
  3. LanloyLisp

    get closest endpoint of selection

    (defun c:foo (/ ss selPt obj startPt endPt pt1) (while (not ss) (setq ss (ssget "_+.:E:S" '((0 . "LINE")))) ) (setq selPt (trans (cadr (nth 3 (car (ssnamex ss 0)))) 0 2)) ; get point of selection (setq obj (vlax-ename->vla-object (ssname ss 0))) (setq startPt (reverse (cdr (reverse (trans (vlax-curve-getStartPoint obj) 0 2))))) (setq endPt (reverse (cdr (reverse (trans (vlax-curve-getEndPoint obj) 0 2))))) ;; Determine closer endpoint (if (< (distance selPt startPt) (distance selPt endPt)) (setq pt1 startPt) (setq pt1...
  4. EnM4st3r

    get closest endpoint of selection

    I also tried entsel, but the problem remained esentially the same. Entsel seems to ignore the Z value and always sets it to 0.0 Also what is the ocs for in your code?
  5. EnM4st3r

    get closest endpoint of selection

    test.dwg Here is a example. From this point of view i cant seem to get the upper endpoint of the green line.
  6. Lee Mac

    get closest endpoint of selection

    I would suggest using the point returned by entsel corresponding to the center of the pickbox aperture, expressed in UCS, e.g.: (defun c:foo ( / cpt enx ocs pt1 pt2 sel ) (if (and (setq sel (entsel)) (= "LINE" (cdr (assoc 0 (setq enx (entget (car sel)))))) ) (progn (setq ocs (trans '(0 0 1) 1 0 t) cpt (trans (cadr sel) 1 0) pt1 (cdr (assoc 10 enx)) pt2 (cdr (assoc 11 enx)) ) (if (< (distance pt2 cpt) (distance pt1 cpt)) (setq pt1 pt2) ) (entmake (list '(000 . "CIRCLE") '(040 . 1) '(062 . 1) (cons 010 (trans pt1 0 ocs)) (cons...
  7. GLAVCVS

    get closest endpoint of selection

    Hello It is better if you attach an example drawing
  8. Today
  9. Hi, im trying to get the closest endpoint of a 3D Line from a single Selection. I tried to retrieve the location using ssnamex, wich is working in 2d, but not in 3d from a 3d view. the Z location somehow always gets messed up in the selection so its not reliable. Any Ideas? Here is the code im using (defun c:foo (/ ss selPt obj startPt endPt pt1) (while (not ss) (setq ss (ssget "_+.:E:S" '((0 . "LINE")))) ) (setq selPt (cadr (nth 3 (car (ssnamex ss 0))))) ; get point of selection (setq obj (vlax-ename->vla-object...
  10. Saxlle

    Offset or copy

    You're welcome. I'm glad it's helpful
  11. I am a bit stuck works for me testing on your Sample.dwg. Did you test with that dwg ? If it works then post other dwg.
  12. Thanks Bigal, I saved it as a LSP file and used Appload to load and run it. It didn't do much ? Prompted to select the leader then came up with the error. Sorry.
  13. Yesterday
  14. This is where I started there is info out there but a bit hard to find. The zip has lisp and vba example it is just in one file for my convenience as I cut and paste from it. https://www.cadtutor.net/forum/topic/79565-autocad-use-libreoffice-instead-of-excel/page/3/ Get and Put data into Libreoffice Calc — BricsCAD Forum https://forum.bricsys.com/discussion/38699/get-and-put-data-into-libreoffice-calc?utm_source=community-search&utm_medium=organic-search&utm_term=libre ...
  15. This would be my front end can have up to about 20 choices, see multi toggles. Just having a think how make a command from a string etc maybe a Eval or read. This worked. (setq str (list "circle" "0,0" "10")) (foreach val str (command val)) You do a foreach of the ans and look is it a "1" meaning you have selected that item. So run that command. Multi toggles.lsp
  16. Hi Bigal Yes: I have LibreOffice on this PC. I have never used it from AutoCAD. What you say is interesting. I am curious to experiment with this. Where can I find documentation?
  17. Updated to use visual lisp to make boundaries and add to ss2. then run overkill on ss2 to leave unique boundaries. should run faster. Just had a thought. Will generate all points upfront. then as it creates boundaries delete any points inside. should insure only one boundary is created rather then having to run overkill. Mulitiple Boundary Selection0.2.LSP
  18. Just a comment if you want to read Excel direct can open the correct Excel file. Just edit filename & sheetname (setq myBook (vl-catch-all-apply 'vla-open (list (vlax-get-property myXL "WorkBooks") fileName))) (setq mySheet (vl-catch-all-apply 'vlax-get-property (list (vlax-get-property myBook "Sheets") "Item" sheetName))) (vlax-invoke-method mySheet "Activate") You can add say T5 & T6 values also to the standards list. @GLAVCVS you mentioned no Excel do you use Libre Calc ? Have a get...
  19. Just be aware that I did not check direction of line so if drawn right to left the label will go under rather than on top. Could check for that though. Happy to help.
  20. You really need to look harder at the solutions provided and get an understanding of what they are doing. A quick fix. (setq co-ordsxy (vl-sort co-ordsxy '(lambda (x y) (< (caddr x)(caddr y))))) (alert (strcat "Z min is " (rtos (caddr (car co-ordsxy )) 2 3 ))) If you swap < for > you will get max value.
  21. Did you save the code as a .lsp file ? Then use appload or drag & drop using explorer. The message is odd as it looks like it does not get past the first user request.
  22. mhupp

    Hatch by point

    Here is another way if they are just lines
  23. GLAVCVS

    Hatch by point

    Of course: you will have to change, in the code, "SOLID" with the name of any other hatch pattern you want to use. And if you want it to only select the points of a specific layer, change the '*' that appears in '...(8 . "*")' to the name of the desired layer, '(8 . " NameLayer1")', for example
  24. GLAVCVS

    Hatch by point

    Well. I guess it doesn't matter. I said this because the 'boundary' command or its analogue 'bpoly' suffer when the drawing is complex. Here is another one that might be useful to you. (defun c:creaSombrs (/ conj ent lstent n pto entUlt entUlt1) (setq n 0 entUlt (entlast) ) (princ "\nSelect points centroids... ") (if (setq conj (ssget '((0 . "POINT") (8 . "*")))) (while (setq ent (ssname conj n)) (bpoly (setq pto (cdr (assoc 10 (setq lstent (entget ent)))))) (if (NOT (equal (setq entUlt1 (entlast)) entUlt)) (progn ...
  25. ronjonp

    Hatch by point

    @nedko9404 Welcome to CadTutor! Here's a start .. a sample drawing would help: (defun c:foo (/ _addhatch _boundary b spc s) (defun _addhatch (spc bnd lyr / h) (if (setq h (vlax-invoke spc 'addhatch achatchobject "Solid" :vlax-true)) (progn (vlax-invoke h 'appendouterloop (list bnd)) (vla-put-layer h lyr) (vla-evaluate h) (vla-update h) h ) ) ) (defun _boundary (p / e) (setq e (entlast)) (bpoly p) (if (not (equal e (entlast))) (entlast) ) ) (cond ((setq s (ssget '((0 . "POINT")))) (setq spc...
  26. Had to watch a video to see it. I'm good now. Thanks a million
  27. I'm using 2023 and I have the Path option.
  1. Load more activity
×
×
  • Create New...