Jump to content

Lisp option


ROBP

Recommended Posts

I have been reading all of the postings for quite sometime now and enjoy being a member of this great site and the expertise of all the contributing users.

 

Although i did not come across any postings of a lisp that will reload after the input data was accomplish in the DCL panel and the generate button or selection of a point in model space selected to generate the item

 

Does such a command line is ever possible or not? it would be great not to have it closed if ever another item is needed from a dcl selection box and to have to retype the lisp command in the cad command line and realoded the so called lisp in order to be able to generate another item.

Link to comment
Share on other sites

  • Replies 26
  • Created
  • Last Reply

Top Posters In This Topic

  • ROBP

    15

  • ymg3

    7

  • Lt Dan's legs

    4

  • rkent

    1

Popular Days

Top Posters In This Topic

ROBP,

 

Not sure I understand completely your query but:

 

Keeping the dcl panel open is not possible I'm afraid.

 

However if your selection is done within the action tile

returning to the DCL can be done, if you save all the

values for the tiles.

 

ymg

Link to comment
Share on other sites

ROBP,

 

Not sure I understand completely your query but:

 

Keeping the dcl panel open is not possible I'm afraid.

 

However if your selection is done within the action tile

returning to the DCL can be done, if you save all the

values for the tiles.

 

ymg

 

 

Can the dcl reopen after input data is done and the generated item is done automatically and not have to type in the lisp again in the cad command line?

Link to comment
Share on other sites

Can the dcl reopen after input data is done and the generated item is done automatically and not have to type in the lisp again in the cad command line?

 

For example I have tried the DH_V0.4 from this site posting and is great but i have to recall the lisp if i need another second type of head in the drawing so it would be a time saving if the dcl would reopen after the user is not finished with the selection and not to have to recall the lisp again until user is finished with selections and generated off the items needed.

 

Hope the above will help the purpose of the question.

 

Best

R

Link to comment
Share on other sites

I'm just guessing...

 

(defun c:test ( / dcl rb:write flag dcl_location ent )
(defun rb:write ( filename textlist write / fname line lst )
 (setq fname (open filename (if write "w" "a")))
 (foreach x textlist
   (write-line x fname)
 )
 (setq fname (close fname))
 (if (findfile filename)
   t nil
 )
)
(if (not (findfile (setq dcl_location "c:\\temp\\temp.dcl")))
 (rb:write dcl_location
   '("main"
      ": dialog {"
      "    label = \"testing\";"
      "    : boxed_column {"
      "        : text {"
      "            label = \"<object type>\";"
      "            key = \"txt\";"
      "        }"
      "        : button {"
      "            label = \"pick object\";"
      "            key = \"button\";"
      "        }"
      "    } cancel_button;"
      "}") t
  )
)
 (defun load-dcl ( / dcl )
   (setq dcl (load_dialog dcl_location))
   (if (new_dialog "main" dcl)
     (progn
       (and ent
         (set_tile "txt" 
           (cdr (assoc 0 (entget ent)))
         )
       )
       (action_tile "button" "(done_dialog 2)")
       (setq flag (start_dialog))
       (unload_dialog dcl)
       (and (eq 2 flag)
         (setq ent (car (entsel "\nSpecify object to select: ")))
         (load-dcl)
       )
     ) (alert "fail")
   )
 )
 (load-dcl)
)

Link to comment
Share on other sites

This works. im just guessing at what you want. I just dont know of I understand it correctly

 

I just want the DCL and lisp to reopen after selecting and generating another head type after i am finished the first one you might want to look for one of mine i did post earlier this year (develop) if i could add the command line to both of them it would be a great achievement

Link to comment
Share on other sites

lt Dan's legs,

 

Your example does it until you cancel.

 

Depending on the programs need, you coul have to

initialize some values to whatever they were before

exiting to get your inputs.

 

ymg

Link to comment
Share on other sites

I'm just guessing...

 

(defun c:test ( / dcl rb:write flag dcl_location ent )
(defun rb:write ( filename textlist write / fname line lst )
 (setq fname (open filename (if write "w" "a")))
 (foreach x textlist
   (write-line x fname)
 )
 (setq fname (close fname))
 (if (findfile filename)
   t nil
 )
)
(if (not (findfile (setq dcl_location "c:\\temp\\temp.dcl")))
 (rb:write dcl_location
   '("main"
      ": dialog {"
      "    label = \"testing\";"
      "    : boxed_column {"
      "        : text {"
      "            label = \"<object type>\";"
      "            key = \"txt\";"
      "        }"
      "        : button {"
      "            label = \"pick object\";"
      "            key = \"button\";"
      "        }"
      "    } cancel_button;"
      "}") t
  )
)
 (defun load-dcl ( / dcl )
   (setq dcl (load_dialog dcl_location))
   (if (new_dialog "main" dcl)
     (progn
       (and ent
         (set_tile "txt" 
           (cdr (assoc 0 (entget ent)))
         )
       )
       (action_tile "button" "(done_dialog 2)")
       (setq flag (start_dialog))
       (unload_dialog dcl)
       (and (eq 2 flag)
         (setq ent (car (entsel "\nSpecify object to select: ")))
         (load-dcl)
       )
     ) (alert "fail")
   )
 )
 (load-dcl)
)

 

 

If was to take the DH_V0.4 lisp from this site for example how do i get to reopen after selection and the item is generated to get the dcl to reopen after the item is generated and generate another one without ahev to retype the lisp again int the cad command line.

 

Further more can the commend you propose be added to the (develop) one i have posted ion this site .

 

If you have time to look at dev and verify if it can achieve it would be great.

You can always add yourself as a contributor and add your name to it. and post it for all others to use.

 

Best,

Robert

Link to comment
Share on other sites

(defun c:test ( / dcl rb:write flag dcl_location ent *error* )
 (defun *error* ( m )
   (and (wcmatch (strcase m) "*CANCEL*")
     (load-dcl)
   )
 )
(defun rb:write ( filename textlist write / fname line lst )
 (setq fname (open filename (if write "w" "a")))
 (foreach x textlist
   (write-line x fname)
 )
 (setq fname (close fname))
 (if (findfile filename)
   t nil
 )
)
(if (not (findfile (setq dcl_location "c:\\temp\\temp.dcl")))
 (rb:write dcl_location
   '("main"
      ": dialog {"
      "    label = \"testing\";"
      "    : boxed_column {"
      "        : text {"
      "            label = \"<object type>\";"
      "            key = \"txt\";"
      "        }"
      "        : button {"
      "            label = \"pick object\";"
      "            key = \"button\";"
      "        }"
      "    } cancel_button;"
      "}") t
  )
)
 (defun load-dcl ( / dcl )
   (setq dcl (load_dialog dcl_location))
   (if (new_dialog "main" dcl)
     (progn
       (and ent
         (set_tile "txt" 
           (cdr (assoc 0 (entget ent)))
         )
       )
       (action_tile "button" "(done_dialog 2)")
       (setq flag (start_dialog))
       (unload_dialog dcl)
       (and (eq 2 flag)
         (setq ent (car (entsel "\nSpecify object to select: ")))
         (load-dcl)
       )
     ) (alert "fail")
   )
 )
 (load-dcl)
)

 

 

This reloads if you escape. Can you post the lsp you're trying to modify?

Link to comment
Share on other sites

ROBP,

 

Not sure I understand completely your query but:

 

Keeping the dcl panel open is not possible I'm afraid.

 

However if your selection is done within the action tile

returning to the DCL can be done, if you save all the

values for the tiles.

 

ymg

 

Ymg you can contribute too if you like add your name to dev also

end result is to revise it and output a lisp with the dcl to reopen and add a close button that can be selected after en user is finished generating the items needed without having to retype the lisp command line in cad in order to generate another item.

Link to comment
Share on other sites

The instruction found in the DH04 DCL tell you to hit the right mouse button to bring the dialog box back up, change settings or exit from there.

Link to comment
Share on other sites


;--------------------------------------------------------

(defun unghi (m n l)
(setq x (/ (- (+ (* m m) (* n n)) (* l l)) (* 2 m n))
ung (- (/ pi 2) (atan (/ x (sqrt (- 1 (* x x)))))))
)

;--------------------------------------------------------

(defun SaveVars ()
(setq myChoice (get_tile "mychoice"))
)

;--------------------------------------------------------

(defun SaveVarsCylsb ()
(setq d (atof (get_tile "Dia")))
(setq h (atof (get_tile "Hght")))
(setq alft (atof (get_tile "Alfat")))
(setq alfb (atof (get_tile "Alfab")))
(setq nr (atoi (get_tile "Ndiv")))
)

;--------------------------------------------------------

(defun SaveVarsHelix ()
(setq d1 (atof (get_tile "dmare")))
(setq d2 (atof (get_tile "dmic")))
(setq s (atof (get_tile "pas")))
)

;--------------------------------------------------------

(defun SaveVarsIcc ()
(setq a (atof (get_tile "A_lg")))
(setq b (atof (get_tile "B_lg")))
(setq h (atof (get_tile "H_hg")))
(setq d1 (atof (get_tile "Dmare")))
(setq d2 (atof (get_tile "Dmic")))
(setq dy (atof (get_tile "D_ecc")))
(setq alfg (atof (get_tile "Alfag")))
(setq nr (atoi (get_tile "Ndiv")))
)

;--------------------------------------------------------

(defun SaveVarsCconeDH ()
(setq d1 (atof (get_tile "Dmare")))
(setq d2 (atof (get_tile "Dmic")))
(setq h (atof (get_tile "Hght")))
)

;--------------------------------------------------------

(defun SaveVarsCconeDA ()
(setq d1 (atof (get_tile "Dmare")))
(setq d2 (atof (get_tile "Dmic")))
(setq alfa (atof (get_tile "Alfa")))
)

;--------------------------------------------------------

(defun SaveVarsEcone ()
(setq d1 (atof (get_tile "Dmare")))
(setq d2 (atof (get_tile "Dmic")))
(setq ht (atof (get_tile "Hght")))
(setq dx (atof (get_tile "Ecc")))
(setq nr (atoi (get_tile "Ndiv")))
)

;--------------------------------------------------------

(defun SaveVarsConesb ()
(setq h (atof (get_tile "Hght")))
(setq ht (atof (get_tile "HTot")))
(setq alfa (atof (get_tile "Alfa")))
(setq betat (atof (get_tile "Betat")))
(setq betab (atof (get_tile "Betab")))
(setq nr (atoi (get_tile "Ndiv")))
)

;--------------------------------------------------------

(defun SaveVarsCflcone ()
(setq d1i (atof (get_tile "Dimare")))
(setq d2i (atof (get_tile "Dimic")))
(setq kri (atof (get_tile "KRadi")))
(setq sf (atof (get_tile "StrFL")))
(setq thk (atof (get_tile "Thick")))
(setq alfa (atof (get_tile "Alpha")))
)

;--------------------------------------------------------

(defun SaveVarsLegCone ()
(setq dt (atof (get_tile "DTank")))
(setq rk (atof (get_tile "RKnuck")))
(setq alfa (atof (get_tile "Alpha")))
(setq tp (atof (get_tile "ThkPad")))
(setq d (atof (get_tile "DPipe")))
(setq e (atof (get_tile "Ecc")))
(setq teta (atof (get_tile "Theta")))
(setq ht (atof (get_tile "HTot")))
(setq h (atof (get_tile "HOverTg")))
(setq nr (atoi (get_tile "NDiv")))
)

;--------------------------------------------------------

(defun SaveVarsLegFD ()
(setq dt (atof (get_tile "DTank")))
(setq rk (atof (get_tile "RKnuck")))
(setq rd (atof (get_tile "RDish")))
(setq tp (atof (get_tile "ThkPad")))
(setq d (atof (get_tile "DPipe")))
(setq e (atof (get_tile "Ecc")))
(setq teta (atof (get_tile "Theta")))
(setq ht (atof (get_tile "HTot")))
(setq h (atof (get_tile "HOverTg")))
(setq nr (atoi (get_tile "NDiv")))
)

;--------------------------------------------------------

(defun SaveVarsLegEllipt ()
(setq dt (atof (get_tile "DTank")))
(setq tp (atof (get_tile "ThkPad")))
(setq d (atof (get_tile "DPipe")))
(setq e (atof (get_tile "Ecc")))
(setq teta (atof (get_tile "Theta")))
(setq ht (atof (get_tile "HTot")))
(setq h (atof (get_tile "HOverTg")))
(setq nr (atoi (get_tile "NDiv")))
)

;--------------------------------------------------------

(defun SaveVarsRdRctg ()
(setq d (atof (get_tile "Diam")))
(setq a (atof (get_tile "DimA")))
(setq b (atof (get_tile "DimB")))
(setq h (atof (get_tile "Hght")))
(setq dx (atof (get_tile "EccX")))
(setq dy (atof (get_tile "EccY")))
(setq alfg (atof (get_tile "Alpha")))
)

;--------------------------------------------------------

(defun DwgCylsb ()
(if (or (<= d 0) (<= h 0) (<= alft -90) (>= alft 90) (<= alfb -90) (>= alfb 90) (<= nr 10))
(alertcylsb)
(progn
(setq osmd (getvar "osmode"))
(setvar "osmode" 16384)
(setvar "pdmode" 0)
(setvar "plinewid" 0.0)
(setq pt0 (getpoint "Base Point:")
x0 (car pt0)
y0 (cadr pt0)
alfat (abs (/ (* alft pi) 180))
alfab (abs (/ (* alfb pi) 180))
r (/ d 2)
tgat (/ (sin alfat) (cos alfat))
tgab (/ (sin alfab) (cos alfab))
yt0 (* r tgat)
yb0 (* r tgab)
ht (- (/ h 2) yt0)
hb (- (/ h 2) yb0)
cont 0)
(if (= alft 0) (setq sgnat 1) (setq sgnat (/ alft (abs alft))))
(if (= alfb 0) (setq sgnab 1) (setq sgnab (/ alfb (abs alfb))))
(while (<= cont nr)
(setq teta (/ (* cont 2 pi) nr)
xtbi (+ x0 (* r teta))
xi (* r (cos teta))
dxti (+ r (* sgnat xi))
yti (+ ht (* dxti tgat))
dxbi (- r (* sgnab xi))
ybi (+ hb (* dxbi tgab))
y1 (+ y0 yti)
y2 (- y0 ybi)
pt1 (list xtbi y1)
pt2 (list xtbi y2)
cont (1+ cont))
(if (> cont 1) (command "line" pt3 pt1 pt2 pt4 "") (command "line" pt1 pt2 ""))
(setq pt3 pt1
pt4 pt2))
(setvar "osmode" osmd)
(princ)))
)

;--------------------------------------------------------

(defun DwgHelix ()
(if (or (<= d1 d2) (<= d2 0) (<= s 0))
(alerthelix)
(progn
(setq osmd (getvar "osmode"))
(setvar "osmode" 16384)
(setvar "pdmode" 0)
(setvar "plinewid" 0.0)
(setq pt0 (getpoint "Base Point:")

h (/ (- d1 d2) 2)
lint (sqrt (+ (* s s) (* pi pi d2 d2)))
lext (sqrt (+ (* s s) (* pi pi d1 d1)))
dext (/ (* 2 h lext) (- lext lint))
dint (- dext (* 2 h))
rext (/ dext 2)
rint (/ dint 2)
alfap2 (- pi (/ lext dext))
pt0 (polar pt0 0.0 rext)
pe1 (polar pt0 alfap2 rext)
pe2 (polar pt0 (- (* 2 pi) alfap2) rext)
pi1 (polar pt0 alfap2 rint)
pi2 (polar pt0 (- (* 2 pi) alfap2) rint)
pt3 (polar pt0 pi rext)
pt4 (polar pt0 pi rint))
(command "arc" pe1 pt3 pe2)
(command "arc" pi1 pt4 pi2)
(command "pline" pi1 pe1 "")
(command "pline" pi2 pe2 "")
(setvar "osmode" osmd)
(princ)))
)

;--------------------------------------------------------

(defun DwgIcc ()
(if (or (<= a h) (<= b 0) (<= h 0) (< d1 d2) (<= d2 0) (< dy (/ (- d2 d1) 2)) (> dy (/ (- d1 d2) 2)) (<= alfg 0) (>= alfg 180) (<= nr 10))
(alerticc)
(progn
(setq osmd (getvar "osmode"))
(setvar "osmode" 16384)
(setvar "pdmode" 0)
(setvar "plinewid" 0.0)
(setq pt0 (getpoint "Base Point:")
alfa (/ (* alfg pi) 180)
x10 (car pt0)
y0 (cadr pt0)
x11 (+ x10 (* d1 pi))
x20 (+ x10 (* 1.25 d1 pi))
x21 (+ x20 (* d2 pi))
p0 (list x10 y0)
p1 (list x11 y0)
p2 (list x11 (+ y0 a))
p3 (list x10 (+ y0 a))
p4 (list x20 y0)
p5 (list x21 y0)
cont 0)
(command "pline" p0 p1 p2 p3 "c")
(command "line" p4 p5 "")
(while (<= cont nr)
(setq teta (/ (* cont 2 pi) nr)
m (/ (* d2 (cos teta)) 2)
n (/ (* d2 (sin teta)) 2)
y (- dy n)
xc (* b (sin alfa))
x (- xc (* m (cos alfa)))
x1 (sqrt (- (/ (expt d1 2) 4) (expt y 2)))
x2 (- x x1)
l2 (/ x2 (sin alfa))
w2 (+ (/ (* teta d2) 2) x20)
pt20 (list w2 y0)
pt2 (list w2 (+ y0 l2))
zc (+ h (* b (cos alfa)))
z2 (+ zc (* m (sin alfa)))
z1 (- z2 (* l2 (cos alfa)))
beta (atan x1 y)
w1 (* (+ beta (/ pi 2)) (/ d1 2))
pt1 (list (+ x10 w1) (+ y0 z1))
cont (1+ cont))
(if (> cont 1) (command "line" pt1a pt1 ""))
(if (> cont 1) (command "line" pt2a pt2 pt20 "") (command "line" pt2 pt20 ""))
(setq pt1a pt1
pt2a pt2))
(setvar "osmode" osmd)
(princ)))
)

;--------------------------------------------------------

(defun DwgCconeDH ()
(if (or (<= d1 d2) (< d2 0) (<= h 0))
(alertcconedh)
(progn
(setq osmd (getvar "osmode"))
(setvar "osmode" 16384)
(setvar "pdmode" 0)
(setvar "plinewid" 0.0)
(setq pt0 (getpoint "Base Point:")
tgalfa (/ (* 2 h) (- d1 d2))
rad (sqrt (+ 1 (* tgalfa tgalfa)))
rext (/ (* d1 rad) 2)
rint (/ (* d2 rad) 2)
gammap2 (* pi (- 1 (/ 1 rad)))
pt0 (polar pt0 0.0 rext)
pe1 (polar pt0 gammap2 rext)
pe2 (polar pt0 (- (* 2 pi) gammap2) rext)
pi1 (polar pt0 gammap2 rint)
pi2 (polar pt0 (- (* 2 pi) gammap2) rint)
pt3 (polar pt0 pi rext)
pt4 (polar pt0 pi rint))
(command "arc" pe1 pt3 pe2)
(if (/= d2 0) (command "arc" pi1 pt4 pi2))
(if (/= d2 0) (command "pline" pi1 pe1 ""))
(if (/= d2 0) (command "pline" pi2 pe2 "") (command "pline" pe1 pt0 pe2 ""))
(setvar "osmode" osmd)
(princ)))
)

;--------------------------------------------------------

(defun DwgCconeDA ()
(if (or (<= d1 d2) (< d2 0) (<= alfa 0) (>= alfa 90))
(alertcconeda)
(progn
(setq osmd (getvar "osmode"))
(setvar "osmode" 16384)
(setvar "pdmode" 0)
(setvar "plinewid" 0.0)
(setq pt0 (getpoint "Base Point:")
alfa (/ (* alfa pi) 180)
tgalfa (/ (sin alfa) (cos alfa))
rad (sqrt (+ 1 (* tgalfa tgalfa)))
rext (/ (* d1 rad) 2)
rint (/ (* d2 rad) 2)
gammap2 (* pi (- 1 (/ 1 rad)))
pt0 (polar pt0 0.0 rext)
pe1 (polar pt0 gammap2 rext)
pe2 (polar pt0 (- (* 2 pi) gammap2) rext)
pi1 (polar pt0 gammap2 rint)
pi2 (polar pt0 (- (* 2 pi) gammap2) rint)
pt3 (polar pt0 pi rext)
pt4 (polar pt0 pi rint))
(command "arc" pe1 pt3 pe2)
(if (/= d2 0) (command "arc" pi1 pt4 pi2))
(if (/= d2 0) (command "pline" pi1 pe1 ""))
(if (/= d2 0) (command "pline" pi2 pe2 "") (command "pline" pe1 pt0 pe2 ""))
(setvar "osmode" osmd)
(princ)))
)

;--------------------------------------------------------

(defun DwgEcone ()
(if (or (<= d1 d2) (< d2 0) (<= ht 0) (<= nr 5))
(alertecone)
(progn
(setq osmd (getvar "osmode"))
(setvar "osmode" 16384)
(setvar "pdmode" 0)
(setvar "plinewid" 0.0)
(setq pt0 (getpoint "Base Point:")
r1 (/ d1 2)
r2 (/ d2 2)
h (/ (* d1 ht) (- d1 d2))
dx1 (/ (* h dx) ht)
dx2 (- dx1 dx)
dtheta (/ pi nr)
z1 h
z2 (- h ht)
theta 0
beta 0
x1 (- dx1 (* r1 (cos theta)))
x2 (- dx2 (* r2 (cos theta)))
y1 (* r1 (sin theta))
y2 (* r2 (sin theta))
l02a (sqrt (+ (* x2 x2) (* y2 y2) (* z2 z2)))
l21a (sqrt (+ (* (- x1 x2) (- x1 x2)) (* (- y1 y2) (- y1 y2)) (* (- z1 z2) (- z1 z2))))
l01a (+ l02a l21a)
pt0 (polar pt0 pi l02a)
pt2 (polar pt0 beta l02a)
pt1 (polar pt2 beta l21a)
pt4 pt2
pt4p pt2
pt3 pt1
pt3p pt1
cont 1)
(command "line" pt2 pt1 "")
(while (<= cont nr)
(setq theta (* cont dtheta)
lseg (/ (* pi r1) nr)
x1 (- dx1 (* r1 (cos theta)))
x2 (- dx2 (* r2 (cos theta)))
y1 (* r1 (sin theta))
y2 (* r2 (sin theta))
l02 (sqrt (+ (* x2 x2) (* y2 y2) (* z2 z2)))
l21 (sqrt (+ (* (- x1 x2) (- x1 x2)) (* (- y1 y2) (- y1 y2)) (* (- z1 z2) (- z1 z2))))
l01 (+ l02 l21))
(unghi l01 l01a lseg)
(setq dbeta ung
beta (+ beta dbeta)
pt2 (polar pt0 beta l02)
pt1 (polar pt2 beta l21)
pt2p (polar pt0 (* -1 beta) l02)
pt1p (polar pt2p (* -1 beta) l21)
cont (1+ cont))
(command "line" pt4 pt2 pt1 pt3 "")
(command "line" pt4p pt2p pt1p pt3p "")
(setq pt3 pt1
pt4 pt2
pt3p pt1p
pt4p pt2p
l01a l01))
(setvar "osmode" osmd)
(princ)))
)

;--------------------------------------------------------

(defun DwgConesb ()
(if (or (<= h 0) (< ht h) (<= alfa 0) (>= alfa 90) (<= betat (* -1 alfa)) (>= betat alfa) (< betab 0) (>= betab alfa) (< nr 12))
(alertconesb)
(progn
(setq osmd (getvar "osmode"))
(setvar "osmode" 16384)
(setvar "pdmode" 0)
(setvar "plinewid" 0.0)
(setq pt0 (getpoint "Base Point:")
x0 (car pt0)
y0 (cadr pt0)
alfa (/ (* alfa pi) 180)
betat (/ (* betat pi) 180))
(if (= betat 0) (setq signbetat 1) (setq signbetat (/ (abs betat) betat)))
(setq betab (/ (* betab pi) 180)
tgalfa (/ (sin alfa) (cos alfa))
tgbetat (/ (sin betat) (cos betat))
tgbetab (/ (sin betab) (cos betab))
rt (/ (- ht h) (- tgalfa (abs tgbetat)))
rb (/ ht (- tgalfa tgbetab))
gama (/ (* 2 pi) (sqrt (+ 1 (* tgalfa tgalfa))))
fi (- (* 2 pi) gama)
gama2 (/ gama 2)
fi2 (/ fi 2)
dgama2 (/ gama2 nr)
dteta (/ pi nr)
hgb (* rb tgalfa)
hgt (* rt tgalfa)
htb (- hgb (* rb tgbetab))
htt (- hgt (* rt tgbetat signbetat))
rib0 (/ rb (cos alfa))
rit0 (- (/ rt (cos alfa)) (/ (* (- signbetat 1) rt (sin betat)) (sin (+ pi (* -1 alfa) betat))))
ang fi2
xp0bp (+ x0 (* rib0 (cos ang)))
yp0bp (+ y0 (* rib0 (sin ang)))
xp0tp (+ x0 (* rit0 (cos ang)))
yp0tp (+ y0 (* rit0 (sin ang)))
yp0bm (- y0 (* rib0 (sin ang)))
yp0tm (- y0 (* rit0 (sin ang)))
p0bp (list xp0bp yp0bp)
p0tp (list xp0tp yp0tp)
p0bm (list xp0bp yp0bm)
p0tm (list xp0tp yp0tm)
teta 0
cont 1)
(command "line" p0tp p0bp "")
(command "line" p0tm p0bm "")
(while (<= cont nr)
(setq teta (+ teta dteta)
ang (+ ang dgama2)
x1b (* (* rb -1) (cos teta))
x1t (* (* rt -1) (cos teta))
xib (/ htb (+ tgbetab (/ hgb x1b))))
(if (= h ht) (setq xit 0) (setq xit (/ htt (+ tgbetat (/ hgt x1t)))))
(setq yib (* xib tgbetab)
yit (* xit tgbetat)
hib (- htb yib)
hit (- htt yit)
rib (/ hib (sin alfa))
rit (/ hit (sin alfa))
xp1bp (+ x0 (* rib (cos ang)))
yp1bp (+ y0 (* rib (sin ang)))
xp1tp (+ x0 (* rit (cos ang)))
yp1tp (+ y0 (* rit (sin ang)))
yp1bm (- y0 (* rib (sin ang)))
yp1tm (- y0 (* rit (sin ang)))
p1bp (list xp1bp yp1bp)
p1tp (list xp1tp yp1tp)
p1bm (list xp1bp yp1bm)
p1tm (list xp1tp yp1tm))
(command "line" p0bp p1bp "")
(command "line" p0bm p1bm "")
(command "line" p0tp p1tp "")
(command "line" p0tm p1tm "")
(setq p0bp (list xp1bp yp1bp)
p0tp (list xp1tp yp1tp)
p0bm (list xp1bp yp1bm)
p0tm (list xp1tp yp1tm)
cont (1+ cont)))
(setvar "osmode" osmd)
(princ)))
)

;--------------------------------------------------------

(defun DwgCflcone ()
(if (or (<= d1i d2i) (< d2i 0) (< kri 0) (< sf 0) (< thk 0) (<= alfa 0) (>= alfa 90))
(alertcflcone)
(progn
(setq osmd (getvar "osmode"))
(setvar "osmode" 16384)
(setvar "pdmode" 0)
(setvar "plinewid" 0.0)
(setq pt0 (getpoint "Base Point:")
alfa (/ (* alfa pi) 180)
r1i (/ d1i 2)
dm (+ d1i thk)
rm (/ dm 2)
krm (+ kri (/ thk 2))
beta (- (/ pi 2) alfa)
xk (* krm (- 1 (cos beta)))
rc (- rm xk)
dc (* 2 rc)
lk (* krm beta)
lkf (+ lk sf)
gc1 (/ rc (cos alfa))
g (+ gc1 lkf)
d1 (* 2 g (cos alfa))
d2 (+ d2i (* thk (sin alfa)))
tgalfa (/ (sin alfa) (cos alfa))
rad (sqrt (+ 1 (* tgalfa tgalfa)))
rext (/ (* d1 rad) 2)
rint (/ (* d2 rad) 2)
gammap2 (* pi (- 1 (/ 1 rad)))
pt0 (polar pt0 0.0 rext)
pe1 (polar pt0 gammap2 rext)
pe2 (polar pt0 (- (* 2 pi) gammap2) rext)
pi1 (polar pt0 gammap2 rint)
pi2 (polar pt0 (- (* 2 pi) gammap2) rint)
pt3 (polar pt0 pi rext)
pt4 (polar pt0 pi rint))
(command "arc" pe1 pt3 pe2)
(if (/= d2 0) (command "arc" pi1 pt4 pi2))
(if (/= d2 0) (command "pline" pi1 pe1 ""))
(if (/= d2 0) (command "pline" pi2 pe2 "") (command "pline" pe1 pt0 pe2 ""))
(setvar "osmode" osmd)
(princ)))
)

;--------------------------------------------------------

(defun DwgIntLegCone ()
(if (or (<= dt d) (<= d 0) (< rk 0) (>= e (/ d 2)) (< teta 0) (>= teta 80) (< tp 0) (<= ht 0) (< alfa 0) (>= alfa 90) (< nr 5))
(alertlegcone)
(progn
(setq osmd (getvar "osmode"))
(setvar "osmode" 16384)
(setvar "pdmode" 0)
(setvar "plinewid" 0.0)
(setq pt0 (getpoint "Base Point:")
dt (+ dt (* 2 tp))
rk (+ rk tp)
e (- e tp)
rt (/ dt 2)
r (/ d 2)
alfa (/ (* alfa pi) 180)
teta (/ (* teta pi) 180)
xt (* rk (- 1 (sin alfa)))
cosbeta (/ (+ (* 2 rt e) (* e e) (* r r)) (* 2 (+ rt e) r))
tgbeta (if (/= cosbeta 0) (sqrt (/ (- 1 (* cosbeta cosbeta)) (* cosbeta cosbeta))) 0)
beta (if (> cosbeta 0) (atan tgbeta) (if (< cosbeta 0) (- pi (atan tgbeta)) pi))
dbeta (/ beta nr)
delta (- pi beta)
ddelta (/ delta nr)
dx (* r dbeta)
dxx (* r ddelta)
xx0 (* r (- 1 (cos delta)))
yymax (* xx0 (/ (sin teta) (cos teta)))
x0 (car pt0)
y0 (cadr pt0)
Ltot (* 2 pi r)
Ldecup (* 2 beta r)
L1 (/ (- Ltot Ldecup) 2)
x00 x0
y00 (- y0 h)
yref y00
xxref x0
yyref y0
x1 (- x0 L1)
y1 (- y0 yymax)
x2 x1
y2 (- y0 ht)
x3 (+ x1 Ltot)
y3 y2
x4 x3
y4 y1
x5 (+ x0 Ldecup)
y5 y0
x6 x5
y6 y00
xmid (+ x1 (/ Ltot 2))
pt00 (list x00 y00)
ptt0 (list x0 y0)
pt1 (list x1 y1)
pt2 (list x2 y2)
pt3 (list x3 y3)
pt4 (list x4 y4)
pt5 (list x5 y5)
pt6 (list x6 y6)
cont 1)
(command "line" pt00 pt0 "")
(command "line" pt5 pt6 "")
(command "pline" pt1 pt2 pt3 pt4 "")
(while (<= cont nr)
(setq betai (- beta (* cont dbeta))
xp (- (* r (cos betai)) e)
yp (* r (sin betai))
x (- rt (sqrt (+ (* (- rt xp) (- rt xp)) (* yp yp))))
y (if (<= x xt) (sqrt (- (* 2 rk x) (* x x))) (/ (+ rk (* (- x rk) (sin alfa))) (cos alfa)))
xi (+ x00 dx)
yi (- yref y)
pti (list xi yi)
xf0 (+ xmid (- xmid x00))
yf0 y00
xfi (+ xmid (- xmid xi))
yfi yi
ptf0 (list xf0 yf0)
ptfi (list xfi yfi)
deltai (- delta (* cont ddelta))
xli (- xx0 (* r (- 1 (cos deltai))))
yli (* xli (/ (sin teta) (cos teta)))
xxi (- xxref (* dxx cont))
yyi (- yyref yli)
ptti (list xxi yyi)
xxf0 (+ xmid (- xmid x0))
yyf0 y0
xxfi (+ xmid (- xmid xxi))
yyfi yyi
pttf0 (list xxf0 yyf0)
pttfi (list xxfi yyfi))
(command "line" pt00 pti "")
(command "line" ptf0 ptfi "")
(command "line" ptt0 ptti "")
(command "line" pttf0 pttfi "")
(setq x00 xi
y00 yi
pt00 (list x00 y00)
x0 xxi
y0 yyi
ptt0 (list x0 y0)
cont (+ 1 cont)))
(setvar "osmode" osmd)
(princ)))
)

;--------------------------------------------------------

(defun DwgIntLegFD ()
(if (or (<= dt d) (<= d 0) (<= rd rk) (< rk 0) (>= e (/ d 2)) (< teta 0) (>= teta 80) (< tp 0) (<= ht 0) (< nr 5))
(alertlegfd)
(progn
(setq osmd (getvar "osmode"))
(setvar "osmode" 16384)
(setvar "pdmode" 0)
(setvar "plinewid" 0.0)
(setq pt0 (getpoint "Base Point:")
dt (+ dt (* 2 tp))
rd (+ rd tp)
rk (+ rk tp)
e (- e tp)
rt (/ dt 2)
r (/ d 2)
teta (/ (* teta pi) 180)
sinalfa (/ (- rt rk) (- rd rk))
tgalfa (/ sinalfa (sqrt (- 1 (* sinalfa sinalfa))))
alfa (atan tgalfa)
xt (* rk (- 1 (sin alfa)))
m (sqrt (- (- (* rd rd) (* 2 rd rk)) (- (* rt rt) (* 2 rt rk))))
cosbeta (/ (+ (* 2 rt e) (* e e) (* r r)) (* 2 (+ rt e) r))
tgbeta (if (/= cosbeta 0) (sqrt (/ (- 1 (* cosbeta cosbeta)) (* cosbeta cosbeta))) 0)
beta (if (> cosbeta 0) (atan tgbeta) (if (< cosbeta 0) (- pi (atan tgbeta)) pi))
dbeta (/ beta nr)
delta (- pi beta)
ddelta (/ delta nr)
dx (* r dbeta)
dxx (* r ddelta)
xx0 (* r (- 1 (cos delta)))
yymax (* xx0 (/ (sin teta) (cos teta)))
x0 (car pt0)
y0 (cadr pt0)
Ltot (* 2 pi r)
Ldecup (* 2 beta r)
L1 (/ (- Ltot Ldecup) 2)
x00 x0
y00 (- y0 h)
yref y00
xxref x0
yyref y0
x1 (- x0 L1)
y1 (- y0 yymax)
x2 x1
y2 (- y0 ht)
x3 (+ x1 Ltot)
y3 y2
x4 x3
y4 y1
x5 (+ x0 Ldecup)
y5 y0
x6 x5
y6 y00
xmid (+ x1 (/ Ltot 2))
pt00 (list x00 y00)
ptt0 (list x0 y0)
pt1 (list x1 y1)
pt2 (list x2 y2)
pt3 (list x3 y3)
pt4 (list x4 y4)
pt5 (list x5 y5)
pt6 (list x6 y6)
cont 1)
(command "line" pt00 pt0 "")
(command "line" pt5 pt6 "")
(command "pline" pt1 pt2 pt3 pt4 "")
(while (<= cont nr)
(setq betai (- beta (* cont dbeta))
xp (- (* r (cos betai)) e)
yp (* r (sin betai))
x (- rt (sqrt (+ (* (- rt xp) (- rt xp)) (* yp yp))))
mt (sqrt (- (* rd rd) (* (- rt x) (- rt x))))
y (if (<= x xt) (sqrt (- (* 2 rk x) (* x x))) (- mt m))
xi (+ x00 dx)
yi (- yref y)
pti (list xi yi)
xf0 (+ xmid (- xmid x00))
yf0 y00
xfi (+ xmid (- xmid xi))
yfi yi
ptf0 (list xf0 yf0)
ptfi (list xfi yfi)
deltai (- delta (* cont ddelta))
xli (- xx0 (* r (- 1 (cos deltai))))
yli (* xli (/ (sin teta) (cos teta)))
xxi (- xxref (* dxx cont))
yyi (- yyref yli)
ptti (list xxi yyi)
xxf0 (+ xmid (- xmid x0))
yyf0 y0
xxfi (+ xmid (- xmid xxi))
yyfi yyi
pttf0 (list xxf0 yyf0)
pttfi (list xxfi yyfi))
(command "line" pt00 pti "")
(command "line" ptf0 ptfi "")
(command "line" ptt0 ptti "")
(command "line" pttf0 pttfi "")
(setq x00 xi
y00 yi
pt00 (list x00 y00)
x0 xxi
y0 yyi
ptt0 (list x0 y0)
cont (+ 1 cont)))
(setvar "osmode" osmd)
(princ)))
)

;--------------------------------------------------------

(defun DwgIntLegEllipt ()
(if (or (<= dt d) (<= d 0) (>= e (/ d 2)) (< teta 0) (>= teta 80) (< tp 0) (<= ht 0) (< nr 5))
(alertlegellipt)
(progn
(setq osmd (getvar "osmode"))
(setvar "osmode" 16384)
(setvar "pdmode" 0)
(setvar "plinewid" 0.0)
(setq pt0 (getpoint "Base Point:")
a (+ (/ dt 2) tp)
b (+ (/ dt 4) tp)
dt (+ dt (* 2 tp))
e (- e tp)
rt (/ dt 2)
r (/ d 2)
teta (/ (* teta pi) 180)
cosbeta (/ (+ (* 2 rt e) (* e e) (* r r)) (* 2 (+ rt e) r))
tgbeta (if (/= cosbeta 0) (sqrt (/ (- 1 (* cosbeta cosbeta)) (* cosbeta cosbeta))) 0)
beta (if (> cosbeta 0) (atan tgbeta) (if (< cosbeta 0) (- pi (atan tgbeta)) pi))
dbeta (/ beta nr)
delta (- pi beta)
ddelta (/ delta nr)
dx (* r dbeta)
dxx (* r ddelta)
xx0 (* r (- 1 (cos delta)))
yymax (* xx0 (/ (sin teta) (cos teta)))
x0 (car pt0)
y0 (cadr pt0)
Ltot (* 2 pi r)
Ldecup (* 2 beta r)
L1 (/ (- Ltot Ldecup) 2)
x00 x0
y00 (- y0 h)
yref y00
xxref x0
yyref y0
x1 (- x0 L1)
y1 (- y0 yymax)
x2 x1
y2 (- y0 ht)
x3 (+ x1 Ltot)
y3 y2
x4 x3
y4 y1
x5 (+ x0 Ldecup)
y5 y0
x6 x5
y6 y00
xmid (+ x1 (/ Ltot 2))
pt00 (list x00 y00)
ptt0 (list x0 y0)
pt1 (list x1 y1)
pt2 (list x2 y2)
pt3 (list x3 y3)
pt4 (list x4 y4)
pt5 (list x5 y5)
pt6 (list x6 y6)
cont 1)
(command "line" pt00 pt0 "")
(command "line" pt5 pt6 "")
(command "pline" pt1 pt2 pt3 pt4 "")
(while (<= cont nr)
(setq betai (- beta (* cont dbeta))
xp (- (* r (cos betai)) e)
yp (* r (sin betai))
x (- rt (sqrt (+ (* (- rt xp) (- rt xp)) (* yp yp))))
y (/ (* b (sqrt (- (* 2 a x) (* x x)))) a)
xi (+ x00 dx)
yi (- yref y)
pti (list xi yi)
xf0 (+ xmid (- xmid x00))
yf0 y00
xfi (+ xmid (- xmid xi))
yfi yi
ptf0 (list xf0 yf0)
ptfi (list xfi yfi)
deltai (- delta (* cont ddelta))
xli (- xx0 (* r (- 1 (cos deltai))))
yli (* xli (/ (sin teta) (cos teta)))
xxi (- xxref (* dxx cont))
yyi (- yyref yli)
ptti (list xxi yyi)
xxf0 (+ xmid (- xmid x0))
yyf0 y0
xxfi (+ xmid (- xmid xxi))
yyfi yyi
pttf0 (list xxf0 yyf0)
pttfi (list xxfi yyfi))
(command "line" pt00 pti "")
(command "line" ptf0 ptfi "")
(command "line" ptt0 ptti "")
(command "line" pttf0 pttfi "")
(setq x00 xi
y00 yi
pt00 (list x00 y00)
x0 xxi
y0 yyi
ptt0 (list x0 y0)
cont (+ 1 cont)))
(setvar "osmode" osmd)
(princ)))
)

;--------------------------------------------------------

(defun DwgRdRctg ()
(if (or (<= d 0) (<= a 0) (<= b 0) (<= h 0) (< alfg 0) (>= alfg 90))
(alertrdrctg)
(progn
(setq osmd (getvar "osmode"))
(setvar "osmode" 16384)
(setvar "pdmode" 0)
(setvar "plinewid" 0.0)
(setq pt0 (getpoint "Base Point:")
alfa (/ (* pi alfg) 180)
r (/ d 2)
x1 (+ dx (* 0.5 a (cos alfa)))
y1 (+ dy (* 0.5 b))
z1 (- h (* 0.5 a (sin alfa)))
x2 (- dx (* 0.5 a (cos alfa)))
y2 (+ dy (* 0.5 b))
z2 (+ h (* 0.5 a (sin alfa)))
x3 (- dx (* 0.5 a (cos alfa)))
y3 (- dy (* 0.5 b))
z3 (+ h (* 0.5 a (sin alfa)))
x4 (+ dx (* 0.5 a (cos alfa)))
y4 (- dy (* 0.5 b))
z4 (- h (* 0.5 a (sin alfa)))
p1 (list x1 y1 z1)
p2 (list x2 y2 z2)
p3 (list x3 y3 z3)
p4 (list x4 y4 z4)
pa (list (* r (cos (/ (* 0 pi) 180))) (* r (sin (/ (* 0 pi) 180))) 0.0)
pb (list (* r (cos (/ (* 15 pi) 180))) (* r (sin (/ (* 15 pi) 180))) 0.0)
pc (list (* r (cos (/ (* 30 pi) 180))) (* r (sin (/ (* 30 pi) 180))) 0.0)
pd (list (* r (cos (/ (* 45 pi) 180))) (* r (sin (/ (* 45 pi) 180))) 0.0)
pe (list (* r (cos (/ (* 60 pi) 180))) (* r (sin (/ (* 60 pi) 180))) 0.0)
pf (list (* r (cos (/ (* 75 pi) 180))) (* r (sin (/ (* 75 pi) 180))) 0.0)
pg (list (* r (cos (/ (* 90 pi) 180))) (* r (sin (/ (* 90 pi) 180))) 0.0)
ph (list (* r (cos (/ (* 105 pi) 180))) (* r (sin (/ (* 105 pi) 180))) 0.0)
pj (list (* r (cos (/ (* 120 pi) 180))) (* r (sin (/ (* 120 pi) 180))) 0.0)
pk (list (* r (cos (/ (* 135 pi) 180))) (* r (sin (/ (* 135 pi) 180))) 0.0)
pl (list (* r (cos (/ (* 150 pi) 180))) (* r (sin (/ (* 150 pi) 180))) 0.0)
pm (list (* r (cos (/ (* 165 pi) 180))) (* r (sin (/ (* 165 pi) 180))) 0.0)
pn (list (* r (cos (/ (* 180 pi) 180))) (* r (sin (/ (* 180 pi) 180))) 0.0)
po (list (* r (cos (/ (* 195 pi) 180))) (* r (sin (/ (* 195 pi) 180))) 0.0)
pp (list (* r (cos (/ (* 210 pi) 180))) (* r (sin (/ (* 210 pi) 180))) 0.0)
pq (list (* r (cos (/ (* 225 pi) 180))) (* r (sin (/ (* 225 pi) 180))) 0.0)
pr (list (* r (cos (/ (* 240 pi) 180))) (* r (sin (/ (* 240 pi) 180))) 0.0)
ps (list (* r (cos (/ (* 255 pi) 180))) (* r (sin (/ (* 255 pi) 180))) 0.0)
pt (list (* r (cos (/ (* 270 pi) 180))) (* r (sin (/ (* 270 pi) 180))) 0.0)
pu (list (* r (cos (/ (* 285 pi) 180))) (* r (sin (/ (* 285 pi) 180))) 0.0)
pv (list (* r (cos (/ (* 300 pi) 180))) (* r (sin (/ (* 300 pi) 180))) 0.0)
px (list (* r (cos (/ (* 315 pi) 180))) (* r (sin (/ (* 315 pi) 180))) 0.0)
py (list (* r (cos (/ (* 330 pi) 180))) (* r (sin (/ (* 330 pi) 180))) 0.0)
pz (list (* r (cos (/ (* 345 pi) 180))) (* r (sin (/ (* 345 pi) 180))) 0.0)
lsgm (/ (* pi d) 24)
l12 a
l23 b
l34 a
l14 b
l1a (distance p1 pa)
l1b (distance p1 pb)
l1c (distance p1 pc)
l1d (distance p1 pd)
l1e (distance p1 pe)
l1f (distance p1 pf)
l1g (distance p1 pg)
l2g (distance p2 pg)
l2h (distance p2 ph)
l2j (distance p2 pj)
l2k (distance p2 pk)
l2l (distance p2 pl)
l2m (distance p2 pm)
l2n (distance p2 pn)
l3n (distance p3 pn)
l3o (distance p3 po)
l3p (distance p3 pp)
l3q (distance p3 pq)
l3r (distance p3 pr)
l3s (distance p3 ps)
l3t (distance p3 pt)
l4t (distance p4 pt)
l4u (distance p4 pu)
l4v (distance p4 pv)
l4x (distance p4 px)
l4y (distance p4 py)
l4z (distance p4 pz)
l4a (distance p4 pa))
(unghi l4a l14 l1a)
(setq u14a ung)
(unghi l14 l1a l4a)
(setq u41a ung)
(unghi l1g l12 l2g)
(setq u21g ung)
(unghi l12 l2g l1g)
(setq u12g ung)
(unghi l2n l23 l3n)
(setq u32n ung)
(unghi l23 l3n l2n)
(setq u23n ung)
(unghi l3t l34 l4t)
(setq u43t ung)
(unghi l34 l4t l3t)
(setq u34t ung)
(unghi l1a l1b lsgm)
(setq u1b ung)
(unghi l1b l1c lsgm)
(setq u1c ung)
(unghi l1c l1d lsgm)
(setq u1d ung)
(unghi l1d l1e lsgm)
(setq u1e ung)
(unghi l1e l1f lsgm)
(setq u1f ung)
(unghi l1f l1g lsgm)
(setq u1g ung)
(unghi l2g l2h lsgm)
(setq u2h ung)
(unghi l2h l2j lsgm)
(setq u2j ung)
(unghi l2j l2k lsgm)
(setq u2k ung)
(unghi l2k l2l lsgm)
(setq u2l ung)
(unghi l2l l2m lsgm)
(setq u2m ung)
(unghi l2m l2n lsgm)
(setq u2n ung)
(unghi l3n l3o lsgm)
(setq u3o ung)
(unghi l3o l3p lsgm)
(setq u3p ung)
(unghi l3p l3q lsgm)
(setq u3q ung)
(unghi l3q l3r lsgm)
(setq u3r ung)
(unghi l3r l3s lsgm)
(setq u3s ung)
(unghi l3s l3t lsgm)
(setq u3t ung)
(unghi l4t l4u lsgm)
(setq u4u ung)
(unghi l4u l4v lsgm)
(setq u4v ung)
(unghi l4v l4x lsgm)
(setq u4x ung)
(unghi l4x l4y lsgm)
(setq u4y ung)
(unghi l4y l4z lsgm)
(setq u4z ung)
(unghi l4z l4a lsgm)
(setq u4a ung)
(setq pt1 (polar pt0 0.0 l14)
pta0 (polar pt0 u14a l4a)
ucr (- pi (+ u41a u1b))
ptb (polar pt1 ucr l1b)
ucr (- ucr u1c)
ptc (polar pt1 ucr l1c)
ucr (- ucr u1d)
ptd (polar pt1 ucr l1d)
ucr (- ucr u1e)
pte (polar pt1 ucr l1e)
ucr (- ucr u1f)
ptf (polar pt1 ucr l1f)
ucr (- ucr u1g)
ptg (polar pt1 ucr l1g)
ucr (- ucr u21g)
pt2 (polar pt1 ucr l12)
ucr (- (+ pi ucr) (+ u12g u2h))
pth (polar pt2 ucr l2h)
ucr (- ucr u2j)
ptj (polar pt2 ucr l2j)
ucr (- ucr u2k)
ptk (polar pt2 ucr l2k)
ucr (- ucr u2l)
ptl (polar pt2 ucr l2l)
ucr (- ucr u2m)
ptm (polar pt2 ucr l2m)
ucr (- ucr u2n)
ptn (polar pt2 ucr l2n)
ucr (- ucr u32n)
pt3 (polar pt2 ucr l23)
ucr (- (+ pi ucr) (+ u23n u3o))
pto (polar pt3 ucr l3o)
ucr (- ucr u3p)
ptp (polar pt3 ucr l3p)
ucr (- ucr u3q)
ptq (polar pt3 ucr l3q)
ucr (- ucr u3r)
ptr (polar pt3 ucr l3r)
ucr (- ucr u3s)
pts (polar pt3 ucr l3s)
ucr (- ucr u3t)
ptt (polar pt3 ucr l3t)
ucr (- ucr u43t)
pt4 (polar pt3 ucr l34)
ucr (- (+ pi ucr) (+ u34t u4u))
ptu (polar pt4 ucr l4u)
ucr (- ucr u4v)
ptv (polar pt4 ucr l4v)
ucr (- ucr u4x)
ptx (polar pt4 ucr l4x)
ucr (- ucr u4y)
pty (polar pt4 ucr l4y)
ucr (- ucr u4z)
ptz (polar pt4 ucr l4z)
ucr (- ucr u4a)
pta (polar pt4 ucr l4a))
(command "pline" pt0 pta0 pt1 ptg pt2 ptn pt3 ptt pt4 pt3 pt2 pt1 "c")
(command "pline" pta0 ptb ptc ptd pte ptf ptg pth ptj ptk ptl ptm ptn pto ptp ptq ptr pts ptt ptu ptv ptx pty ptz pta "")
(command "line" ptb pt1 ptc "")
(command "line" ptd pt1 pte "")
(command "line" pt1 ptf "")
(command "line" pth pt2 ptj "")
(command "line" ptk pt2 ptl "")
(command "line" pt2 ptm "")
(command "line" pto pt3 ptp "")
(command "line" ptq pt3 ptr "")
(command "line" pt3 pts "")
(command "line" ptu pt4 ptv "")
(command "line" ptx pt4 pty "")
(command "line" ptz pt4 pta "")
(setvar "osmode" osmd)
(princ)))
)

;--------------------------------------------------------

(defun alertcylsb ()
(if (<= d 0) (alert " D > 0 !!!"))
(if (<= h 0) (alert " H > 0 !!!"))
(if (<= alft -90) (alert " ALPHAt > -90 !!!"))
(if (>= alft 90) (alert " ALPHAt < 90 !!!"))
(if (<= alfb -90) (alert " ALPHAb > -90 !!!"))
(if (>= alfb 90) (alert " ALPHAb < 90 !!!"))
(if (<= nr 10) (alert " NR > 10 !!!"))
(cylsb)
)

;--------------------------------------------------------

(defun alerthelix ()
(if (<= d1 d2) (alert " D1 > D2 !!! "))
(if (<= d2 0) (alert " D2 > 0 !!! "))
(if (<= s 0) (alert " S > 0 !!! "))
(helix)
)

;--------------------------------------------------------

(defun alerticc ()
(if (<= a h) (alert " A > H !!! "))
(if (<= b 0) (alert " B > 0 !!! "))
(if (<= h 0) (alert " H > 0 !!! "))
(if (< d1 d2) (alert " D1 >= D2 !!! "))
(if (<= d2 0) (alert " D2 > 0 !!! "))
(if (< dy (/ (- d2 d1) 2)) (alert " DY >= -(D1-D2)/2 !!! "))
(if (> dy (/ (- d1 d2) 2)) (alert " DY <= (D1-D2)/2 !!! "))
(if (<= alfg 0) (alert " ALPHA > 0 !!! "))
(if (>= alfg 180) (alert " ALPHA < 180 !!! "))
(if (<= nr 10) (alert " NR > 10 !!!"))
(intcylcyl)
)

;--------------------------------------------------------

(defun alertcconedh ()
(if (<= d1 d2) (alert " D1 > D2 !!! "))
(if (< d2 0) (alert " D2 >= 0 !!! "))
(if (<= h 0) (alert " H > 0 !!! "))
(cconedh)
)

;--------------------------------------------------------

(defun alertcconeda ()
(if (<= d1 d2) (alert " D1 > D2 !!! "))
(if (< d2 0) (alert " D2 >= 0 !!! "))
(if (<= alfa 0) (alert " ALPHA > 0 !!!"))
(if (>= alfa 90) (alert " ALPHA < 90 !!!"))
(cconeda)
)

;--------------------------------------------------------

(defun alertecone ()
(if (<= d1 d2) (alert " D1 > D2 !!! "))
(if (< d2 0) (alert " D2 >= 0 !!! "))
(if (<= ht 0) (alert " H > 0 !!! "))
(if (<= nr 5) (alert " NR > 5 !!! "))
(ecccone)
)

;--------------------------------------------------------

(defun alertconesb ()
(if (<= h 0) (alert " H > 0 !!!"))
(if (< ht h) (alert " Htot >= H !!!"))
(if (<= alfa 0) (alert " ALPHA > 0 !!!"))
(if (>= alfa 90) (alert " ALPHA < 90 !!!"))
(if (<= betat (* -1 alfa)) (alert " BETAt > -ALPHA !!!"))
(if (>= betat alfa) (alert " BETAt < ALPHA !!!"))
(if (< betab 0) (alert " BETAb >= 0 !!!"))
(if (>= betab alfa) (alert " BETAb < ALPHA !!!"))
(if (< nr 12) (alert " NR >= 12 !!!"))
(conesb)
)

;--------------------------------------------------------

(defun alertcflcone ()
(if (<= d1i d2i) (alert " D1i > D2i !!! "))
(if (< d2i 0) (alert " D2i >= 0 !!! "))
(if (< kri 0) (alert " KRi >= 0 !!! "))
(if (< sf 0) (alert " SF >= 0 !!! "))
(if (< thk 0) (alert " t >= 0 !!! "))
(if (<= alfa 0) (alert " ALPHA > 0 !!!"))
(if (>= alfa 90) (alert " ALPHA < 90 !!!"))
(concflcone)
)

;--------------------------------------------------------

(defun alertlegcone ()
(if (<= dt d) (alert " D > d !!! "))
(if (<= d 0) (alert " d > 0 !!! "))
(if (< rk 0) (alert " rk >= 0 !!! "))
(if (>= e (/ d 2)) (alert " e < d/2 !!! "))
(if (< teta 0) (alert " Theta >= 0 !!! "))
(if (>= teta 80) (alert " Theta < 80 !!! "))
(if (< tp 0) (alert " t >= 0 !!! "))
(if (<= ht 0) (alert " HT > 0 !!! "))
(if (< alfa 0) (alert " ALPHA >= 0 !!! "))
(if (>= alfa 90) (alert " ALPHA < 90 !!! "))
(if (< nr 5) (alert " NR >= 5 !!! "))
(intlegcone)
)

;--------------------------------------------------------

(defun alertlegfd ()
(if (<= dt d) (alert " D > d !!! "))
(if (<= d 0) (alert " d > 0 !!! "))
(if (<= rd rk) (alert " Rd > rk !!! "))
(if (< rk 0) (alert " rk >= 0 !!! "))
(if (>= e (/ d 2)) (alert " e < d/2 !!! "))
(if (< teta 0) (alert " Theta >= 0 !!! "))
(if (>= teta 80) (alert " Theta < 80 !!! "))
(if (< tp 0) (alert " t >= 0 !!! "))
(if (<= ht 0) (alert " HT > 0 !!! "))
(if (< nr 5) (alert " NR >= 5 !!! "))
(intlegfd)
)

;--------------------------------------------------------

(defun alertlegellipt ()
(if (<= dt d) (alert " D > d !!! "))
(if (<= d 0) (alert " d > 0 !!! "))
(if (>= e (/ d 2)) (alert " e < d/2 !!! "))
(if (< teta 0) (alert " Theta >= 0 !!! "))
(if (>= teta 80) (alert " Theta < 80 !!! "))
(if (< tp 0) (alert " t >= 0 !!! "))
(if (<= ht 0) (alert " HT > 0 !!! "))
(if (< nr 5) (alert " NR >= 5 !!! "))
(intlegellipt)
)

;--------------------------------------------------------

(defun alertrdrctg ()
(if (<= d 0) (alert " D > 0 !!! "))
(if (<= a 0) (alert " A > 0 !!! "))
(if (<= b 0) (alert " B > 0 !!! "))
(if (<= h 0) (alert " H > 0 !!! "))
(if (< alfg 0) (alert " ALPHA >= 0 !!! "))
(if (>= alfg 90) (alert " ALPHA < 90 !!! "))
(redrdrctg)
)

;--------------------------------------------------------

(defun cylsb ()
(setq dcl_id (load_dialog (strcat prgpath "DEVELOP.dcl")))
(if (not (new_dialog "CYLSB" dcl_id)) (exit))
(setq x (dimx_tile "image")
y (dimy_tile "image"))
(start_image "image")
(fill_image 0 0 x y 0)
(slide_image 0 0 x y (strcat prgpath "cylsb"))
(end_image)
(action_tile "cancel" "(setq ddiag 1) (done_dialog)")
(action_tile "accept" "(setq ddiag 2) (SaveVarsCylsb) (done_dialog)")
(start_dialog)
(unload_dialog dcl_id)
(if (= ddiag 1) (princ))
(if (= ddiag 2) (DwgCylsb))
)

;--------------------------------------------------------

(defun helix ()
(setq dcl_id (load_dialog (strcat prgpath "DEVELOP.dcl")))
(if (not (new_dialog "HLX" dcl_id)) (exit))
(setq x (dimx_tile "image")
y (dimy_tile "image"))
(start_image "image")
(fill_image 0 0 x y 0)
(slide_image 0 0 x y (strcat prgpath "hlx"))
(end_image)
(action_tile "cancel" "(setq ddiag 1) (done_dialog)")
(action_tile "accept" "(setq ddiag 2) (SaveVarsHelix) (done_dialog)")
(start_dialog)
(unload_dialog dcl_id)
(if (= ddiag 1) (princ))
(if (= ddiag 2) (DwgHelix))
)

;--------------------------------------------------------

(defun intcylcyl ()
(setq dcl_id (load_dialog (strcat prgpath "DEVELOP.dcl")))
(if (not (new_dialog "ICC" dcl_id)) (exit))
(setq x (dimx_tile "image")
y (dimy_tile "image"))
(start_image "image")
(fill_image 0 0 x y 0)
(slide_image 0 0 x y (strcat prgpath "icc"))
(end_image)
(action_tile "cancel" "(setq ddiag 1) (done_dialog)")
(action_tile "accept" "(setq ddiag 2) (SaveVarsIcc) (done_dialog)")
(start_dialog)
(unload_dialog dcl_id)
(if (= ddiag 1) (princ))
(if (= ddiag 2) (DwgIcc))
)

;--------------------------------------------------------

(defun conccone ()
(setq dcl_id (load_dialog (strcat prgpath "DEVELOP.dcl")))
(if (not (new_dialog "CCONE" dcl_id)) (exit))
(action_tile "cancel" "(setq ddiag 1) (done_dialog)")
(action_tile "accept" "(setq ddiag 2) (SaveVars) (done_dialog)")
(start_dialog)
(unload_dialog dcl_id)
(if (= ddiag 1) (princ))
(if (= ddiag 2)
(cond
((= myChoice "but1") (cconedh))
((= myChoice "but2") (cconeda))
)
)
)

;--------------------------------------------------------

(defun cconedh ()
(setq dcl_id (load_dialog (strcat prgpath "DEVELOP.dcl")))
(if (not (new_dialog "CCONEDH" dcl_id)) (exit))
(setq x (dimx_tile "image")
y (dimy_tile "image"))
(start_image "image")
(fill_image 0 0 x y 0)
(slide_image 0 0 x y (strcat prgpath "cnc_cone_dh"))
(end_image)
(action_tile "cancel" "(setq ddiag 1) (done_dialog)")
(action_tile "accept" "(setq ddiag 2) (SaveVarsCconeDH) (done_dialog)")
(start_dialog)
(unload_dialog dcl_id)
(if (= ddiag 1) (princ))
(if (= ddiag 2) (DwgCconeDH))
)

;--------------------------------------------------------

(defun cconeda ()
(setq dcl_id (load_dialog (strcat prgpath "DEVELOP.dcl")))
(if (not (new_dialog "CCONEDA" dcl_id)) (exit))
(setq x (dimx_tile "image")
y (dimy_tile "image"))
(start_image "image")
(fill_image 0 0 x y 0)
(slide_image 0 0 x y (strcat prgpath "cnc_cone_da"))
(end_image)
(action_tile "cancel" "(setq ddiag 1) (done_dialog)")
(action_tile "accept" "(setq ddiag 2) (SaveVarsCconeDA) (done_dialog)")
(start_dialog)
(unload_dialog dcl_id)
(if (= ddiag 1) (princ))
(if (= ddiag 2) (DwgCconeDA))
)

;--------------------------------------------------------

(defun ecccone ()
(setq dcl_id (load_dialog (strcat prgpath "DEVELOP.dcl")))
(if (not (new_dialog "ECONE" dcl_id)) (exit))
(setq x (dimx_tile "image")
y (dimy_tile "image"))
(start_image "image")
(fill_image 0 0 x y 0)
(slide_image 0 0 x y (strcat prgpath "ecc_cone"))
(end_image)
(action_tile "cancel" "(setq ddiag 1) (done_dialog)")
(action_tile "accept" "(setq ddiag 2) (SaveVarsEcone) (done_dialog)")
(start_dialog)
(unload_dialog dcl_id)
(if (= ddiag 1) (princ))
(if (= ddiag 2) (DwgEcone))
)

;--------------------------------------------------------

(defun conesb ()
(setq dcl_id (load_dialog (strcat prgpath "DEVELOP.dcl")))
(if (not (new_dialog "CONESB" dcl_id)) (exit))
(setq x (dimx_tile "image")
y (dimy_tile "image"))
(start_image "image")
(fill_image 0 0 x y 0)
(slide_image 0 0 x y (strcat prgpath "cone_sb"))
(end_image)
(action_tile "cancel" "(setq ddiag 1) (done_dialog)")
(action_tile "accept" "(setq ddiag 2) (SaveVarsConesb) (done_dialog)")
(start_dialog)
(unload_dialog dcl_id)
(if (= ddiag 1) (princ))
(if (= ddiag 2) (DwgConesb))
)

;--------------------------------------------------------

(defun concflcone ()
(setq dcl_id (load_dialog (strcat prgpath "DEVELOP.dcl")))
(if (not (new_dialog "CFLCONE" dcl_id)) (exit))
(setq x (dimx_tile "image")
y (dimy_tile "image"))
(start_image "image")
(fill_image 0 0 x y 0)
(slide_image 0 0 x y (strcat prgpath "cnc_fl_cone"))
(end_image)
(action_tile "cancel" "(setq ddiag 1) (done_dialog)")
(action_tile "accept" "(setq ddiag 2) (SaveVarsCflcone) (done_dialog)")
(start_dialog)
(unload_dialog dcl_id)
(if (= ddiag 1) (princ))
(if (= ddiag 2) (DwgCflcone))
)

;--------------------------------------------------------

(defun intlegcone ()
(setq dcl_id (load_dialog (strcat prgpath "DEVELOP.dcl")))
(if (not (new_dialog "LEGCONE" dcl_id)) (exit))
(setq x (dimx_tile "image")
y (dimy_tile "image"))
(start_image "image")
(fill_image 0 0 x y 0)
(slide_image 0 0 x y (strcat prgpath "leg_cone"))
(end_image)
(action_tile "cancel" "(setq ddiag 1) (done_dialog)")
(action_tile "accept" "(setq ddiag 2) (SaveVarsLegCone) (done_dialog)")
(start_dialog)
(unload_dialog dcl_id)
(if (= ddiag 1) (princ))
(if (= ddiag 2) (DwgIntLegCone))
)

;--------------------------------------------------------

(defun intlegfd ()
(setq dcl_id (load_dialog (strcat prgpath "DEVELOP.dcl")))
(if (not (new_dialog "LEGFD" dcl_id)) (exit))
(setq x (dimx_tile "image")
y (dimy_tile "image"))
(start_image "image")
(fill_image 0 0 x y 0)
(slide_image 0 0 x y (strcat prgpath "leg_fd"))
(end_image)
(action_tile "cancel" "(setq ddiag 1) (done_dialog)")
(action_tile "accept" "(setq ddiag 2) (SaveVarsLegFD) (done_dialog)")
(start_dialog)
(unload_dialog dcl_id)
(if (= ddiag 1) (princ))
(if (= ddiag 2) (DwgIntLegFD))
)

;--------------------------------------------------------

(defun intlegellipt ()
(setq dcl_id (load_dialog (strcat prgpath "DEVELOP.dcl")))
(if (not (new_dialog "LEGELLIPT" dcl_id)) (exit))
(setq x (dimx_tile "image")
y (dimy_tile "image"))
(start_image "image")
(fill_image 0 0 x y 0)
(slide_image 0 0 x y (strcat prgpath "leg_ellipt"))
(end_image)
(action_tile "cancel" "(setq ddiag 1) (done_dialog)")
(action_tile "accept" "(setq ddiag 2) (SaveVarsLegEllipt) (done_dialog)")
(start_dialog)
(unload_dialog dcl_id)
(if (= ddiag 1) (princ))
(if (= ddiag 2) (DwgIntLegEllipt))
)

;--------------------------------------------------------

(defun redrdrctg ()
(setq dcl_id (load_dialog (strcat prgpath "DEVELOP.dcl")))
(if (not (new_dialog "RNDRCTG" dcl_id)) (exit))
(setq x (dimx_tile "image")
y (dimy_tile "image"))
(start_image "image")
(fill_image 0 0 x y 0)
(slide_image 0 0 x y (strcat prgpath "rd_rctg"))
(end_image)
(action_tile "cancel" "(setq ddiag 1) (done_dialog)")
(action_tile "accept" "(setq ddiag 2) (SaveVarsRdRctg) (done_dialog)")
(start_dialog)
(unload_dialog dcl_id)
(if (= ddiag 1) (princ))
(if (= ddiag 2) (DwgRdRctg))
)

;--------------------------------------------------------

(defun CEV ()
(setq prgpath "C:/USERS/Robert Perron/DESKTOP/DEVELOP/")
(setq dcl_id (load_dialog (strcat prgpath "DEVELOP.dcl")))
(if (not (new_dialog "DVLP" dcl_id)) (exit))
(action_tile "cancel" "(setq ddiag 1) (done_dialog)")
(action_tile "accept" "(setq ddiag 2) (SaveVars) (done_dialog)")
(start_dialog)
(unload_dialog dcl_id)
(if (= ddiag 1) (princ))
(if (= ddiag 2)
(cond
((= myChoice "but1") (cylsb))
((= myChoice "but2") (helix))
((= myChoice "but3") (conccone))
((= myChoice "but4") (ecccone))
((= myChoice "but5") (conesb))
((= myChoice "but6") (concflcone))
((= myChoice "but7") ())
((= myChoice "but8") ())
((= myChoice "but9") ())
((= myChoice "but10") ())
((= myChoice "but11") (intcylcyl))
((= myChoice "but12") ())
((= myChoice "but13") ())
((= myChoice "but14") (intlegcone))
((= myChoice "but15") (intlegfd))
((= myChoice "but16") (intlegellipt))
((= myChoice "but17") (redrdrctg))
)
)
)
[/Code]

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...