Emmanuel Delay Posted January 8 Posted January 8 II got Autocad 2024 now. nentsel selection of a a polyline used to return the line on which you clicked. Now it seems to return the whole polyline. So nentsel is just entsel. What happenend? Is this a new Auocad 2024 bug (I'm not calling this a feature, feel free to disagree)? Any obvious solution? Quote
lastknownuser Posted January 8 Posted January 8 Don't have 2024, but did you check if the polyline is 3D? It doesn't work for regular pline if I'm not mistaken Quote
lastknownuser Posted January 8 Posted January 8 10 minutes ago, Emmanuel Delay said: It's not 3D polylines https://docs.autodesk.com/ACD/2011/ENU/filesALR/WS1a9193826455f5ff1a32d8d10ebc6b7ccc-699d.htm "When the selected object is not complex (that is, not a 3D polyline or block), nentsel returns the same information as entsel" Quote
Steven P Posted January 8 Posted January 8 Just checking, on my installation (2022), nentsel and entsel on a LW Polyline returns the same, nentsel and entsel return different results on a 3d polyline Quote
Emmanuel Delay Posted January 8 Author Posted January 8 I guess I'll have to write my own nentsel for polylines. Quote
Emmanuel Delay Posted January 9 Author Posted January 9 (edited) Something like this. Extra properties to be added as needed. (vl-load-com) (defun drawLine (p1 p2) (entmakex (list (cons 0 "LINE") (cons 10 p1) (cons 11 p2)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; http://www.lee-mac.com/round.html ;; Round Up - Lee Mac ;; Rounds 'n' up to the nearest 'm' (defun LM:roundup ( n m ) ((lambda ( r ) (cond ((equal 0.0 r 1e-8) n) ((< n 0) (- n r)) ((+ n (- m r))))) (rem n m)) ) ;; Round Down - Lee Mac ;; Rounds 'n' down to the nearest 'm' (defun LM:rounddown ( n m ) ((lambda ( r ) (cond ((equal 0.0 r 1e-8) n) ((< n 0) (- n r m)) ((- n r)))) (rem n m)) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; This function allows the user to select a segment of polyline. ;; The function returns the segment as though it were a line. As if the polyline was exploded. (defun nentselpl ( / res sel type sel_pt pl par start_ end_) (setq sel (entsel "\nSelect ployline: ")) (setq pl (car sel)) (setq type (cdr (assoc 0 (entget pl)))) (if (wcmatch type "*POLYLINE") (progn (setq sel_pt (cadr sel)) (setq sel_pt (vlax-curve-getClosestPointTo (vlax-ename->vla-object pl) sel_pt)) ;; parameter -> this tells you the index of the segment. And where on the segment the point is (setq par (vlax-curve-getparamatpoint pl sel_pt)) ;; (vlax-ename->vla-object pl) ;; start point of the segment (setq start_ (vlax-curve-getPointAtParam (vlax-ename->vla-object pl) (LM:rounddown par 1.0))) (setq end_ (vlax-curve-getPointAtParam (vlax-ename->vla-object pl) (LM:roundup par 1.0))) (setq res (list (cons 10 start_) (cons 11 end_) (cons 8 (cdr (assoc 8 (entget pl)))) ;; layer ;; ... add extra properties if you wish )) ) nil ) res ) ;; TEST function (defun c:nentselpl ( / sel) (setq sel (nentselpl)) (princ sel) (drawLine (cdr (assoc 10 sel)) (cdr (assoc 11 sel)) ) (princ) ) Edited January 9 by Emmanuel Delay 2 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.