Advertisement
Guest User

Untitled

a guest
Dec 28th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (defun getProps(/ linking bigRectLen bigRectHeight smallRectHeight smallRectLen)
  2.   (setq linking (getpoint "Enter linking for detail: "))
  3.   (initget 7)
  4.   (setq
  5.      bigRectLen (getreal "Enter length of big rectangle: ") ;800
  6.      bigRectHeight (getreal "Enter height of big rectangle: ")  ; 300
  7.      smallRectLen (getreal "Enter length of small rectangle: ")  ; 600
  8.      smallRectHeight (getreal "Enter height of small rectangle: ") ; 300
  9.      substrateWidth (getreal "Enter width of substrate line: ") ;10
  10.      param ( list linking bigRectLen bigRectHeight smallRectLen smallRectHeight substrateWidth )  
  11.   )
  12. )
  13.  
  14. (defun createDetail(param)
  15.   (setq
  16.     linkingPoint (nth 0 param)
  17.     bigRectLen (nth 1 param)
  18.     bigRectHeight (nth 2 param)
  19.     smallRectLen (nth 3 param)
  20.     smallRectHeight (nth 4 param)
  21.     substrateWidth (nth 5 param)
  22.   )
  23.   (setq
  24.     linkingPointX (nth 0 linkingPoint) ; 1000
  25.     linkingPointY (nth 1 linkingPoint) ; 1000
  26.     substrate (* bigRectLen 1.2)
  27.   )
  28.   (setq
  29.     bigRectX ( list (- linkingPointX (/ bigRectLen 2)) linkingPointY ) ; 800> (600; 1000)
  30.     bigRectY ( list (+ linkingPointX (/ bigRectLen 2)) (- linkingPointY bigRectHeight) ) ; 300> (1400; 700)
  31.     smallRectX ( list (- linkingPointX (/ smallRectLen 2)) (+ linkingPointY smallRectHeight) ) ; 600> (700; 1300)
  32.     smallRectY ( list (+ linkingPointX (/ smallRectLen 2)) linkingPointY ) ; 300> (1300; 1000)
  33.     bigRectCrossX ( list linkingPointX linkingPointY ) ; 800> (600; 1000)
  34.     bigRectCrossY ( list linkingPointX (- linkingPointY bigRectHeight) ) ; 800> (600; 1000)
  35.     substrateX ( list (- linkingPointX (/ substrate 2)) (- linkingPointY bigRectHeight) ); (700
  36.     substrateY ( list (+ linkingPointX (/ substrate 2)) (- linkingPointY bigRectHeight) );
  37.   )
  38.  
  39.   (command "rectangle" bigRectX bigRectY)
  40.   (command "rectangle" smallRectX smallRectY)
  41.   (command "line" bigRectCrossX bigRectCrossY "")
  42.   (command "pline" substrateX substrateY "w" substrateWidth substrateWidth "close")
  43.  
  44. )
  45.  
  46. (defun start()
  47.   (setq again 1)
  48.   (while (= again 1)
  49.     (setq props (getProps))
  50.     (createDetail props )
  51.     (setq result (calc (cdr props)))
  52.     (alert (strcat "The detail weight equal: " (rtos result)) )
  53.     (setq again (getint "Type 1 if you want to draw again: "))
  54.   )
  55. )
  56.  
  57. (defun calc(param)
  58.   (setq
  59.     bigRectLen (nth 0 param)
  60.     bigRectHeight (nth 1 param)
  61.     smallRectLen (nth 2 param)
  62.     smallRectHeight (nth 3 param)
  63.     substrate (nth 4 param)
  64.     thicknessBigRect (getreal "Enter thickness of the big rectangle: ")
  65.     thicknessSmallRect (getreal "Enter thickness of the small rectangle: ")
  66.   )
  67.   (setq
  68.     V1 (/ (* bigRectLen bigRectHeight thicknessBigRect) 1000) ; V = S * T (объем = площадь * толщину) ; S = L * W(площадь = длина * высоту)
  69.     V2 (/ (* smallRectLen smallRectHeight thicknessSmallRect) 1000) ;
  70.     V3 (/ (* (* bigRectLen 1.2) substrate thicknessBigRect) 1000)
  71.     m (* (+ V1 V2 V3) 7.85);m = V * p(масса = обьем * плотность)
  72.   )
  73. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement