russell84 Posted August 18, 2008 Posted August 18, 2008 if i have a start point and a end point of a line stored how do i get the rotation angle of that line within lisp?? Quote
buddygillespie Posted August 18, 2008 Posted August 18, 2008 I've not done any lisp for a long while but here is some VBA code that will record the angle of a line. Open or create a drawing with a line in it then open your VBA editor (Alt F11) and create a new module and add the following sub LineTest to the module and run it. Public Sub LineTest() Dim oAcEntity As AcadEntity Dim oAcLine As AcadLine 'search all entities for a line object For Each oAcEntity In ThisDrawing.ModelSpace 'find the 1st line object in the current drawing If oAcEntity.ObjectName = "AcDbLine" Then 'record the line Set oAcLine = oAcEntity Exit For End If Next 'declare a variable to hole the line angle Dim ThisLineAngle As Double 'convert radians to degrees ThisLineAngle = oAcLine.Angle * 180# / 3.14159265 'print the value Debug.Print ThisLineAngle End Sub Hope this works for you. I'm sure someone will send you a lisp reply... Quote
lpseifert Posted August 18, 2008 Posted August 18, 2008 if i have a start point and a end point of a line stored how do i get the rotation angle of that line within lisp?? (angle pt1 pt2) where pt1 and pt2 are star and end points in (x y z) list form. This will give you the angle in radians relative to the current UCS. Quote
russell84 Posted August 18, 2008 Author Posted August 18, 2008 yes thanks kindly - i dont have the help guide here at home..cheers for that i ended up using (setq a (list (car startpt)(cadr startpt))) (setq b (list (car endpt)(cadr endpt))) (setq ANG (angle a b)) Cheers mate Quote
TimSpangler Posted August 18, 2008 Posted August 18, 2008 yes thanks kindly - i dont have the help guide here at home..cheers for that i ended up using (setq a (list (car startpt)(cadr startpt))) (setq b (list (car endpt)(cadr endpt))) (setq ANG (angle a b)) Cheers mate If a and b are nothing more than place holders then do this instead: (setq ANG (list (car startpt)(cadr startpt)) (list (car endpt)(cadr endpt)) ) If you are using them later then the way you have it is fine. $.02 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.