Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What's wrong with the routine ? (autolisp)

Status
Not open for further replies.

marpus

Technical User
Oct 21, 2003
1
PL
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)
)
 
I would guess you have a running osnap on that causes it to "snap" to the endpoint. You could insert lines;
(setq UserSnap (getvar "osmode"))
(setvar "osmode" 0)
before the line (command .....)
and afterward add
(setvar "osmode" UserSnap)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top