vdigai78 Posted April 30, 2019 Posted April 30, 2019 I searched online and could not get an answer. When I look at the properties of the simple line I see that there are Start X, Y, Z and End X, Y, Z. For whatever reasons the structural software that we use for calculations needs all lines of the 3D model to be drawn in a positive direction. Due to the poor quality of the structural software modelling UI we use AutoCAD to model lines in 3D. However, it is very hard to keep in mind at all times the direction that you have to draw the lines. So I am looking for either a lisp routine or an AutoCAD app to identify the starting point of the line or a lisp routine that will draw an arrow in the direction of the line. Any other ways or suggestions on how to monitor the direction of the line are very welcome. Thank you. Quote
lrm Posted April 30, 2019 Posted April 30, 2019 Here's a simple vlisp program that places a point at the start of lines you select. (defun c:lstart(/) (command "_pdmode" "35" "") (setq osnp (getvar "osmode")) (setvar "osmode" 0) if (setq ss (ssget '((0 . "LINE")))) (progn (setq i 0) (while (setq en (ssname ss i)) (setq ed (entget en)) (setq pos (cdr (assoc 10 ed))) (command "point" pos "" ) (setq i (1+ i) ) ; end setq i ) ;end while ) ; end progn ) ;end if (setvar "osmode" osnp) (princ) ) 1 Quote
lrm Posted April 30, 2019 Posted April 30, 2019 Note, changing the 10 to 11 in the following line will add the point at the second vertex of the line. (setq pos (cdr (assoc 10 ed))) Quote
vdigai78 Posted April 30, 2019 Author Posted April 30, 2019 Irm, perfect!!! This is exactly what I am looking for !!! The only drawback is that it resets that osnap settings, but I can live with that. Thank you. Just FYI here is the other answer I got on Autodesk Forum: https://forums.autodesk.com/t5/autocad-forum/how-to-identify-the-direction-of-the-line/m-p/8762268#M978031 And here is the link to the lisp routine that is drawing arrows in the direction of the polyline: https://autocadtips1.com/2014/06/24/autolisp-polyline-direction-preview/ Quote
lrm Posted April 30, 2019 Posted April 30, 2019 If you do not want it to reset osnaps then delete the following line from the code. (setvar "osmode" osnp) Here's the full program without the resetting of osnap and with the point added to the second vertex of the line. ; places a point at the end of lines (defun c:lstart(/) (command "_pdmode" "35" "") (setq osnp (getvar "osmode")) (setvar "osmode" 0) if (setq ss (ssget '((0 . "LINE")))) (progn (setq i 0) (while (setq en (ssname ss i)) (setq ed (entget en)) (setq pos (cdr (assoc 11 ed))) (command "point" pos "" ) (setq i (1+ i) ) ; end setq i ) ;end while ) ; end progn ) ;end if ;; (setvar "osmode" osnp) ;reset osnap (princ) ) 1 Quote
vdigai78 Posted May 2, 2019 Author Posted May 2, 2019 Irm, thank you very much for your help!!! 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.