edit some lsp please

edit some lsp please

Anonymous
Not applicable
849 Views
2 Replies
Message 1 of 3

edit some lsp please

Anonymous
Not applicable
hello always thank you all. I searched internet and got this lsp 
I have a fix and I get some help. attached jpg file
thank you
;;;Copyright 1990, PENNEX GROUP, Inc.
;;;This routine will draw a radius elbow on a square cornered duct.
;;;At this time it is still a little slow because the object snap
;;;is set to 'near' to be sure points were picked on the duct lines.
;;;edited by R. Wilson Avatech Solutions 10/23/01
(defun endpt1 (ent1)     ;finds first endpt of a line
  (cdr (assoc 10 (entget ent1)))
)
(defun endpt2 (ent1)     ;finds second endpt of a line
  (cdr (assoc 11 (entget ent1)))
)
(defun c:test (/ INA OUTA INB OUTB END1A END2A WIDA RADIN RADOUT)
  ;(modes '("cmdecho" "osmode"))
  ;(setvar "cmdecho" 0)
  ;(setq olderr *error*)     ; save old *error* handler
  ;(setq *error* newerr)     ; set new *error* handler
  (setvar "OSMODE" 512)
  (setq INA (getpoint "\nPick inside of duct A: "))
  (setq OUTA (getpoint "\nPick outside of duct A: "))
  (setq INB (getpoint "\nPick inside of duct B: "))
  (setq OUTB (getpoint "\nPick outside of duct B: "))
  (command "LINE" INA "PERPEND" OUTA "") ;draws perpendicular line
  (setq END1A (ENDPT1 (entlast)))
  (setq END2A (ENDPT2 (entlast)))
  (setq WIDA (distance END1A END2A)) ;gets width of duct
  (setq RADIN (* 0.5 WIDA))
  (setq RADOUT (* 1.5 WIDA))
  (command "ERASE" "L" "")
;(command "_.fillet" "")
  (command "_.fillet" "R" RADIN)       ;sets "_.fillet" radius
  (command "_.fillet" (osnap INA "nea") (osnap INB "nea"))  ;draws inner "_.fillet"
  (command "_.fillet" "R" RADOUT)       ;sets "_.fillet" radius
  (command "_.fillet" (osnap OUTA "nea") (osnap OUTB "nea"));draws outer "_.fillet"
  (command "LINE" "ENDPOINT" INA "ENDPOINT" OUTA "") ;draws cap line
  (command "LINE" "ENDPOINT" INB "ENDPOINT" OUTB "") ;draws cap line
  (COMMAND "OSMODE" 0)
 ; (moder)
  ;(setq *error* olderr)     ; Restore old *error* handler
  (princ)
)
;|≪Visual LISPⓒ Format Options≫
(78 2 40 2 nil "end of " 75 9 0 0 0 T T nil T)
;*** DO NOT add text below the comment! ***|;
; an example of fillet 2 lines
 
 
0 Likes
Accepted solutions (1)
850 Views
2 Replies
Replies (2)
Message 2 of 3

Ajilal.Vijayan
Advisor
Advisor
Accepted solution

try with this code

;;;Copyright 1990, PENNEX GROUP, Inc.
;;;This routine will draw a radius elbow on a square cornered duct.
;;;At this time it is still a little slow because the object snap
;;;is set to 'near' to be sure points were picked on the duct lines.
;;;edited by R. Wilson Avatech Solutions 10/23/01
(defun endpt1 (ent1)     ;finds first endpt of a line
  (cdr (assoc 10 (entget ent1)))
)
(defun endpt2 (ent1)     ;finds second endpt of a line
  (cdr (assoc 11 (entget ent1)))
)
(defun c:test (/ INA OUTA INB OUTB END1A END2A WIDA RADIN RADOUT CENTA CENTB)
  ;(modes '("cmdecho" "osmode"))
  ;(setvar "cmdecho" 0)
  ;(setq olderr *error*)     ; save old *error* handler
  ;(setq *error* newerr)     ; set new *error* handler
  (setvar "OSMODE" 512)
  (setq INA (getpoint "\nPick inside of duct A: "))
  (setq CENTA (getpoint "\nPick Center of duct A: "))
  (setq OUTA (getpoint "\nPick outside of duct A: "))
  (setq INB (getpoint "\nPick inside of duct B: "))
  (setq CENTB (getpoint "\nPick Center of duct B: "))
  (setq OUTB (getpoint "\nPick outside of duct B: "))
  (command "LINE" INA "PERPEND" OUTA "") ;draws perpendicular line
  (setq END1A (ENDPT1 (entlast)))
  (setq END2A (ENDPT2 (entlast)))
  (setq WIDA (distance END1A END2A)) ;gets width of duct
  (setq RADIN (* 0.5 WIDA))
  (setq RADOUT (* 1.5 WIDA))
  (command "ERASE" "L" "")
;(command "_.fillet" "")
  (command "_.fillet" "R" RADIN)       ;sets "_.fillet" radius
  (command "_.fillet" (osnap INA "nea") (osnap INB "nea"))  ;draws inner "_.fillet"
  (command "_.fillet" "R" WIDA)       ;sets "_.fillet" radius
  (command "_.fillet" (osnap CENTA "nea") (osnap CENTB "nea"))  ;draws center "_.fillet"
  (command "_.fillet" "R" RADOUT)       ;sets "_.fillet" radius
  (command "_.fillet" (osnap OUTA "nea") (osnap OUTB "nea"));draws outer "_.fillet"
  (command "LINE" "ENDPOINT" INA "ENDPOINT" OUTA "") ;draws cap line
  (command "LINE" "ENDPOINT" INB "ENDPOINT" OUTB "") ;draws cap line
  (COMMAND "OSMODE" 0)
 ; (moder)
  ;(setq *error* olderr)     ; Restore old *error* handler
  (princ)
)
0 Likes
Message 3 of 3

Anonymous
Not applicable

thank you. 

0 Likes