Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun getProps(/ linking bigRectLen bigRectHeight smallRectHeight smallRectLen)
- (setq linking (getpoint "Enter linking for detail: "))
- (initget 7)
- (setq
- bigRectLen (getreal "Enter length of big rectangle: ") ;800
- bigRectHeight (getreal "Enter height of big rectangle: ") ; 300
- smallRectLen (getreal "Enter length of small rectangle: ") ; 600
- smallRectHeight (getreal "Enter height of small rectangle: ") ; 300
- substrateWidth (getreal "Enter width of substrate line: ") ;10
- param ( list linking bigRectLen bigRectHeight smallRectLen smallRectHeight substrateWidth )
- )
- )
- (defun createDetail(param)
- (setq
- linkingPoint (nth 0 param)
- bigRectLen (nth 1 param)
- bigRectHeight (nth 2 param)
- smallRectLen (nth 3 param)
- smallRectHeight (nth 4 param)
- substrateWidth (nth 5 param)
- )
- (setq
- linkingPointX (nth 0 linkingPoint) ; 1000
- linkingPointY (nth 1 linkingPoint) ; 1000
- substrate (* bigRectLen 1.2)
- )
- (setq
- bigRectX ( list (- linkingPointX (/ bigRectLen 2)) linkingPointY ) ; 800> (600; 1000)
- bigRectY ( list (+ linkingPointX (/ bigRectLen 2)) (- linkingPointY bigRectHeight) ) ; 300> (1400; 700)
- smallRectX ( list (- linkingPointX (/ smallRectLen 2)) (+ linkingPointY smallRectHeight) ) ; 600> (700; 1300)
- smallRectY ( list (+ linkingPointX (/ smallRectLen 2)) linkingPointY ) ; 300> (1300; 1000)
- bigRectCrossX ( list linkingPointX linkingPointY ) ; 800> (600; 1000)
- bigRectCrossY ( list linkingPointX (- linkingPointY bigRectHeight) ) ; 800> (600; 1000)
- substrateX ( list (- linkingPointX (/ substrate 2)) (- linkingPointY bigRectHeight) ); (700
- substrateY ( list (+ linkingPointX (/ substrate 2)) (- linkingPointY bigRectHeight) );
- )
- (command "rectangle" bigRectX bigRectY)
- (command "rectangle" smallRectX smallRectY)
- (command "line" bigRectCrossX bigRectCrossY "")
- (command "pline" substrateX substrateY "w" substrateWidth substrateWidth "close")
- )
- (defun start()
- (setq again 1)
- (while (= again 1)
- (setq props (getProps))
- (createDetail props )
- (setq result (calc (cdr props)))
- (alert (strcat "The detail weight equal: " (rtos result)) )
- (setq again (getint "Type 1 if you want to draw again: "))
- )
- )
- (defun calc(param)
- (setq
- bigRectLen (nth 0 param)
- bigRectHeight (nth 1 param)
- smallRectLen (nth 2 param)
- smallRectHeight (nth 3 param)
- substrate (nth 4 param)
- thicknessBigRect (getreal "Enter thickness of the big rectangle: ")
- thicknessSmallRect (getreal "Enter thickness of the small rectangle: ")
- )
- (setq
- V1 (/ (* bigRectLen bigRectHeight thicknessBigRect) 1000) ; V = S * T (объем = площадь * толщину) ; S = L * W(площадь = длина * высоту)
- V2 (/ (* smallRectLen smallRectHeight thicknessSmallRect) 1000) ;
- V3 (/ (* (* bigRectLen 1.2) substrate thicknessBigRect) 1000)
- m (* (+ V1 V2 V3) 7.85);m = V * p(масса = обьем * плотность)
- )
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement