All Activity
- Past hour
-
get closest endpoint of selection
EnM4st3r replied to EnM4st3r's topic in AutoLISP, Visual LISP & DCL
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... -
Anders M joined the community
-
LanloyLisp started following get closest endpoint of selection
-
get closest endpoint of selection
LanloyLisp replied to EnM4st3r's topic in AutoLISP, Visual LISP & DCL
(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... -
Kajal Yadav joined the community
-
get closest endpoint of selection
EnM4st3r replied to EnM4st3r's topic in AutoLISP, Visual LISP & DCL
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? -
get closest endpoint of selection
EnM4st3r replied to EnM4st3r's topic in AutoLISP, Visual LISP & DCL
test.dwg Here is a example. From this point of view i cant seem to get the upper endpoint of the green line. -
Lee Mac started following get closest endpoint of selection
-
get closest endpoint of selection
Lee Mac replied to EnM4st3r's topic in AutoLISP, Visual LISP & DCL
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... -
get closest endpoint of selection
GLAVCVS replied to EnM4st3r's topic in AutoLISP, Visual LISP & DCL
Hello It is better if you attach an example drawing - Today
-
EnM4st3r started following get closest endpoint of selection
-
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...
-
You're welcome. I'm glad it's helpful
-
USER00 joined the community
-
podisokaxaxaxa joined the community
-
Ozanaza joined the community
-
Mleader with block and attributes
BIGAL replied to AlexS's topic in AutoCAD 2D Drafting, Object Properties & Interface
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. -
JIDesign joined the community
-
Mleader with block and attributes
AlexS replied to AlexS's topic in AutoCAD 2D Drafting, Object Properties & Interface
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. -
Need Help with Lisp Routine for Setting Layer Properties
GLAVCVS replied to CADChaser's topic in AutoLISP, Visual LISP & DCL
Thanks you very much- 39 replies
-
- layerproperty
- standardlayer
-
(and 1 more)
Tagged with:
- Yesterday
-
Need Help with Lisp Routine for Setting Layer Properties
BIGAL replied to CADChaser's topic in AutoLISP, Visual LISP & DCL
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 ...- 39 replies
-
- 1
-
- layerproperty
- standardlayer
-
(and 1 more)
Tagged with:
-
DCL with the options to select what commands to string together
BIGAL replied to rcb007's topic in AutoLISP, Visual LISP & DCL
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 -
Need Help with Lisp Routine for Setting Layer Properties
GLAVCVS replied to CADChaser's topic in AutoLISP, Visual LISP & DCL
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?- 39 replies
-
- layerproperty
- standardlayer
-
(and 1 more)
Tagged with:
-
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
-
Need Help with Lisp Routine for Setting Layer Properties
BIGAL replied to CADChaser's topic in AutoLISP, Visual LISP & DCL
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...- 39 replies
-
- 1
-
- layerproperty
- standardlayer
-
(and 1 more)
Tagged with:
-
Lisp to Divide a Dimension or Selection of Lines by a user provided length
BIGAL replied to CAP's topic in AutoLISP, Visual LISP & DCL
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. -
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.
-
Mleader with block and attributes
BIGAL replied to AlexS's topic in AutoCAD 2D Drafting, Object Properties & Interface
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. -
mhupp started following Hatch by point
-
Here is another way if they are just lines
-
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
-
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 ...
-
DarineAlRez joined the community
-
ronjonp started following 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...
-
Transition from a square to a circle along a arc path
cubman replied to cubman's topic in AutoCAD 3D Modelling & Rendering
Had to watch a video to see it. I'm good now. Thanks a million -
Transition from a square to a circle along a arc path
Cad64 replied to cubman's topic in AutoCAD 3D Modelling & Rendering