프로그램
캐드 분류

LM길이의 합계리습 수정요청

컨텐츠 정보

  • 105 조회
  • 0 추천
  • 0 비추천
  • 목록

본문




(defun c:Lm (/ ss sslist i index linelist linenumlist ent old10 old11 dist lnum count temp total total1 subtotal txt pt)

  (vl-load-com)                                                                                            ;—->total1 추가함

  (princ "n Eltity Length Sum")

  (setvar "cmdecho" 0)



  (setq ss (ssget (list (cons 0 "LINE,CIRCLE,ARC,POLYLINE,LWPOLYLINE,ELLIPSE,SPLINE"))))

  (setq zzz (sslength ss))

  (if ss

    (progn

      (setq index 0)

      (setq linelist nil)

      (setq linenumlist nil)

      (repeat (sslength ss)

        (setq ent (ssname ss index))

        (command "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 2) "*" (rtos (nth count linenumlist) 2 0) "개"))

            ;;;;(setq txt  (strcat "nL = " (rtos (/ (nth count linelist) 1.0) 2 2)))



            (setq txt (strcat "nL = " (rtos (/ (nth count linelist) 1000.0) 2 2) "*" (rtos (nth count linenumlist) 2 0) "개"))

            (setq txt  (strcat "nL = " (rtos (/ (nth count linelist) 1000.0) 2 2)))

          )

          (if (> (nth count linenumlist) 1)



            ;;;;(setq txt (strcat txt " + " (rtos (/ (nth count linelist) 1.0) 2 2) "*" (rtos (nth count linenumlist) 2 0) "개"))

            ;;;;(setq txt (strcat txt " + " (rtos (/ (nth count linelist) 1.0) 2 2)))



            (setq txt (strcat txt " + " (rtos (/ (nth count linelist) 1000.0) 2 2) "*" (rtos (nth count linenumlist) 2 0) "개"))

            (setq txt (strcat txt " + " (rtos (/ (nth count linelist) 1000.0) 2 2)))

          )

        )

        (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 2) "m"))

      (setq $height (getreal "n높이값이 월매여~~ ? : ")) ;===>추가 

      (setq $area (* $height total1))

      (setq txt (strcat txt " = " (rtos total1 2 2) "M x " (rtos $height 2 2) "M = " (rtos $area 2 2)  " M^2″))  ;——->total에서 total1 변경함

      (setq txt (strcat txt " : 객체수 " (rtos zzz 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)

)

 

위와같은 리습을 높이 입력시 x 되어 면적 값이 출력 되는것이아니라

선길이 합계는 그대로 두고 ""높이를 입력하시오"" 문구가 나오면 6+7+8 이런식으로 입력하면 앞뒤로()괄호가 생성된후 결과식은 선길이 합 ex : 2+3+4+5+(6+7+8)  이런식으로 나왔으면 좋겠습니다. lm누르면 상기와 같이나오고 lm1 누르면 2+3+4+5+(6+7+8)= 합계 가능할까요?
파일첨부 하고싶은데 왜 안되는지 모르겠네요 ㅠㅠ 초짜라 이해 부탁드립니다.

관련자료

댓글 0
등록된 댓글이 없습니다.
여분필드1 여분필드2 여분필드3
전체 7,152 / 1 페이지
번호
제목
이름
알림 0