Jump to content

How to Make AutoCAD to Identify Starting Point of the Line


Recommended Posts

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.

Link to comment
Share on other sites

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)
)

 

  • Like 1
Link to comment
Share on other sites

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/

Link to comment
Share on other sites

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)
)

 

  • Like 1
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...