MODIFY CODE

MODIFY CODE

Anonymous
Not applicable
967 Views
7 Replies
Message 1 of 8

MODIFY CODE

Anonymous
Not applicable

Hi all,

I have one lisp & i want to modify this, i just need to place 12mm line instead of circles.

Please see following code which i have.

 

(defun c:slot (/ a d e i l n pa p p0 p1)
;; SRJ » 2019-11-12
(cond ((and (setq e (car (entsel "\nPick a line: ")))
(setq p0 (vlax-curve-getstartpoint e))
(setq p1 (vlax-curve-getendpoint e))
(setq d (- (distance p0 p1) 200))
(setq i (/ d (setq n (fix (1+ (/ d 400.))))))
)
(setq p0 (polar p0 (setq a (angle p0 p1)) 100))
(repeat (1+ n)
(setq
l (cons
(list (entmakex (list '(0 . "CIRCLE") '(8 . "SLOTS") (cons 10 p0) '(40 . 1.875))) p0)
l
)
)
(setq p0 (polar p0 a i))
)
(setq pa (+ a (/ pi 2)))
(while (setq p (getpoint "\nPick a point until offset is correct: "))
(setq pa (+ pa pi))
(foreach x l
(entmod (append (entget (car x)) (list (cons 10 (polar (cadr x) pa 10)))))
(entupd (car x))
)
)
)
)
(princ)
)
(vl-load-com)

0 Likes
Accepted solutions (1)
968 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable

(defun c:slot (/ a d e i l n pa p p0 p1) ;; SRJ » 2019-11-12 (cond ((and (setq e (car (entsel "\nPick a line: "))) (setq p0 (vlax-curve-getstartpoint e)) (setq p1 (vlax-curve-getendpoint e)) (setq d (- (distance p0 p1) 200)) (setq i (/ d (setq n (fix (1+ (/ d 400.)))))) ) (setq p0 (polar p0 (setq a (angle p0 p1)) 100)) (repeat (1+ n) (setq l (cons (list (entmakex (list '(0 . "CIRCLE") '(8 . "SLOTS") (cons 10 p0) '(40 . 1.875))) p0) l ) ) (setq p0 (polar p0 a i)) ) (setq pa (+ a (/ pi 2))) (while (setq p (getpoint "\nPick a point until offset is correct: ")) (setq pa (+ pa pi)) (foreach x l (entmod (append (entget (car x)) (list (cons 10 (polar (cadr x) pa 10))))) (entupd (car x)) ) ) ) ) (princ) ) (vl-load-com)

0 Likes
Message 3 of 8

devitg
Advisor
Advisor

please upload your sample.dwg where to apply it 

Message 4 of 8

Anonymous
Not applicable

PLEASE SEE ATTACHED CAD

0 Likes
Message 5 of 8

ronjonp
Mentor
Mentor
Accepted solution
(defun c:slot (/ a d e i l n pa p p0 p1)
;; SRJ » 2019-11-12
....

Not cool ...

Message 6 of 8

Anonymous
Not applicable

THANK YOU SIR

0 Likes
Message 7 of 8

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

.... i just need to place 12mm line instead of circles. ....


[I don't see how Message 5 is a solution....]

 

That shouldn't be difficult, but what is the geometric relationship between the selected Line and the 12mm Lines to be added?  Should the added ones start on  the selected one and extend 12mm perpendicular from it?  Should they be centered  where the Circles are [10 drawing units off the selected Line], and maybe perpendicular or maybe parallel to the selected one?  Something else?

Kent Cooper, AIA
0 Likes
Message 8 of 8

ronjonp
Mentor
Mentor

@Kent1Cooper wrote:

@Anonymous wrote:

.... i just need to place 12mm line instead of circles. ....


[I don't see how Message 5 is a solution....]

...


Agreed .. not a solution ... but it does point out a problem.

0 Likes