프로그램
캐드 분류

리습 길이합 LM 수정부탁드립니다.

컨텐츠 정보

  • 97 조회
  • 1 댓글
  • 0 추천
  • 0 비추천
  • 목록

본문

  기존의 LM리습을 매우 잘 사용하고 있습니다.
  기존의  LM리습이 소수점 2자리까지 계산이 되어서 소숫점 1자리에서 반올림이 되게 수정하여
  사용하고 있었으나, 
  갑자기 소숫점 1자리에서 올림으로 계산해야 하는 상황이 발생하여, 나름 수정해 볼려고 열심히 
  해 보았으나 , 능력이 안되네요 ㅠ_ㅠ
   소수점 1자리에서 무조건 올림이 되어서 합산할려면 어떻게 해야 하나요 
   리습 수정 부탁드립니다 ^^
   리습파일 첨부가 안되네요. 본문에다 넣을께요 ㅠㅠ
(defun c:Lm (/ ss sslist i index linelist linenumlist ent old10 old11 dist lnum count temp total total1 subtotal txt pt)
                                                                                            ;—->total1 추가함
  (princ "n Eltity Length Sum")
  (setvar "cmdecho" 0)
  (setq ss (ssget (list (cons 0 "LINE,CIRCLE,ARC,POLYLINE,LWPOLYLINE,ELLIPSE,SPLINE"))))
  (if ss
    (progn
      (setq index 0)
      (setq linelist nil)
      (setq linenumlist nil)
      (repeat (sslength ss)
        (setq ent (ssname ss index))
        (command-s "lengthen" ent "" "" "")
        (setq dist (GETVAR "PERIMETER"))
        (if (apply 'or (mapcar '(lambda (x) (equal dist x 1)) linelist))
          (progn
            (setq temp 0)
            (setq lnum nil)
            (foreach x linelist
              (if (equal dist x 1)
                (setq lnum temp)
              )
              (setq temp (1+ temp))
            )
            (setq count 0)
            (setq temp nil)
            (foreach x linenumlist
              (if (= count lnum)
                (setq temp (append temp (list (+ x 1))))
                (setq temp (append temp (list x)))
              )
              (setq count (1+ count))
            )
            (setq linenumlist temp)
          )
          (progn
            (setq linelist (append linelist (list dist)))
            (setq linenumlist (append linenumlist (list 1)))
          )
        )
        (setq index (1+ index))
      )
      (setq txt "")
      (setq count 0)
      (setq total 0)
      (setq subtotal 0)
      (repeat (length linelist)
        (if (= count 0)
          (if (> (nth count linenumlist) 1)
            ;;;;(setq txt (strcat "nL = " (rtos (/ (nth count linelist) 1.0) 2 0) "*" (rtos (nth count linenumlist) 2 0) "개"))
            ;;;;(setq txt  (strcat "nL = " (rtos (/ (nth count linelist) 1.0) 2 0)))
            (setq txt (strcat "nL = " (rtos (/ (nth count linelist) 1000.0) 2 0) "*" (rtos (nth count linenumlist) 2 0) "개"))
            (setq txt  (strcat "nL = " (rtos (/ (nth count linelist) 1000.0) 2 0)))
          )
          (if (> (nth count linenumlist) 1)
            ;;;;(setq txt (strcat txt " + " (rtos (/ (nth count linelist) 1.0) 2 0) "*" (rtos (nth count linenumlist) 2 0) "개"))
            ;;;;(setq txt (strcat txt " + " (rtos (/ (nth count linelist) 1.0) 2 0)))
            (setq txt (strcat txt " + " (rtos (/ (nth count linelist) 1000.0) 2 0) "*" (rtos (nth count linenumlist) 2 0) "개"))
            (setq txt (strcat txt " + " (rtos (/ (nth count linelist) 1000.0) 2 0)))
          )
        )
        (setq subtotal (* (/ (nth count linelist) 1) (nth count linenumlist)))
        (setq total (+ subtotal total))
        (setq total1 (/ total 1000));————->추가함
        (setq count (1+ count))
      )
      ;;;;(setq txt (strcat txt " = " (rtos total 2 0) "m"))
      (setq txt (strcat txt " = " (rtos total1 2 0) "m"));——->total에서 total1 변경함
      (setq txt (strcat txt " : 객체수 " (rtos (length linelist) 2 +0) " 개"))
      (princ txt)
(if (not (setq tth (getreal (strcat "n현재 TextSize : <" (rtos(getvar "textsize") 2 1) "> 입니다. 원하는 Text 크기를 입력하세요 : "))))
    (setq tth (getvar "textsize"))
    (setvar "textsize" tth) 
  )
      (setq pt (getpoint "n 텍스트 삽입점 : "))
      (if pt (command "text" pt "" "" txt))
    )
  )
  (princ)
)

관련자료

댓글 1 / 1 페이지
전체 6,907 / 1 페이지
번호
제목
이름
알림 0