Luongshop Posted November 19, 2017 Share Posted November 19, 2017 (edited) Hi everyone! I have problem with my program. It run unstable. I hope everyone helps me (defun mid (p1 p2) (list (/ (+ (car p1) (car p2)) 2.0) (/ (+ (cadr p1) (cadr p2)) 2.0) ) ) ;______________________________________ (defun c:test ( / ob1 ob2 d0 i j ) (setq ob0 (ssget)) (setq d0 (getpoint)) (setq ob1 (ssget "_:L" '((0 . "LINE")))) ;(setq i (- (sslength ob1) 1)) (repeat (setq i (sslength ob1)) (setq j i) (setq d1 (cdr (assoc 10 (entget (ssname ob1 (setq i (1- i))))))) (setq d2 (cdr (assoc 11 (entget (ssname ob1 (setq j (1- j))))))) (setq mi (mid d1 d2)) (command ".copy" ob0 "" "m" d0 mi "") ) (princ) ) Edited November 22, 2017 by SLW210 Aded Code Tags. Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted November 19, 2017 Share Posted November 19, 2017 Please read this: http://www.cadtutor.net/forum/showthread.php?9184-Code-posting-guidelines Regarding your issue: Your problem is most likely caused by the 'Running Osnap' setting (OSMODE). When using command calls this setting can have an impact on the outcome of Lisp programs. See here for a possible solution ("_non"): http://www.cadtutor.net/forum/showthread.php?102187-Getpoint-doesn-t-allow-osnap&p=693767&viewfull=1#post693767 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted November 22, 2017 Share Posted November 22, 2017 You have said also you want plines so p1 p2 may not give correct mid if say your pline has more than 2 pts. I would use Vla-getpointatdist take length / 2.0 this will give mid of a line and pline. Quote Link to comment Share on other sites More sharing options...
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.