What's wrong with the routine ? (autolisp)

Discussion in 'AutoCAD' started by MaRiO, Oct 21, 2003.

  1. MaRiO

    MaRiO Guest

    Problem description:
    I write the routine that sets a point in a certain distance from the
    origin of a choosen line (variable linia). The distance of this point
    along the line is considered to be dependent upon number of division
    (variable n) of the line's length. But as long as I have interested
    point calculated and try to set it, it always fails and sets the point
    at the origin instead. What's wrong ?

    Code:
    (defun c:brln ()
    (setq stare_cmdecho (getvar "cmdecho"))
    (setvar "cmdecho" 0)
    (setq linia (entsel "\nWybierz linie do podzialu na n czesci...")) ;
    Choose a line
    (setq n (getint "\nPodaj ilosc podzialow na n czesci...")); Set number
    of division
    (setq ename (car linia))
    (setq en (entget ename))
    (setq P1 (cdr (assoc 10 en)))
    (setq P2 (cdr (assoc 11 en)))
    (setq delta (/ (distance P1 P2) n)) ; For future usage
    (setq PN (polar P1 (angle P1 P2) (/ (distance P1 P2) n)))
    (command "point" PN)
    (setvar "cmdecho" stare_cmdecho)
    (princ)
    )
     
    MaRiO, Oct 21, 2003
    #1
  2. MaRiO

    Philippe Guest

    Hi,
    Mind the "osmode" variable. Should be set to 0 before you use the command
    "LINE".
    Philippe

    MaRiO a écrit :
     
    Philippe, Oct 21, 2003
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.