Getting Direction Bearing in Lisp from a Line



How do I access this direction bearing information?

Comments

  • If you just want a quick tell me, use LIST and select line. Same with other objects.
  • Anthony Apostolaros
    edited June 2023
    The (vla-get-angle) function returns it in radians. You'll have to convert it to degrees minutes seconds. There's probably a lisp function somewhere that does that. The (angtos) function, with 1 as the first optional argument, is supposed to convert radians to a text version of DMS format.

    The (vlax-dump-object) function returns all of an object's VBA/ActiveX properties, which can all be used in the same way as the Angle property.

    (defun c:DumpPM ()
    (setq Ent1 (car (entsel)))
    (setq VLname (vlax-ename->vla-object Ent1))
    (vlax-dump-object VLname T)
    )
  • GregS
    edited June 2023
    I'm a little late to the party, but angtos with option 4 works...

    (angtos ANG 4) would return surveyor bearings for a number (ANG) in radians, as a string. Got to watch the basis of direction, though. Radians have 0 oriented "east" and run counterclockwise, so (angtos 0.0 4) returns "E" for EAST.

    (angtos (/ PI 4) 4) returns "N 45d0'0\" E"