明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 6340|回复: 11

求改画侧螺纹孔的源码

[复制链接]
发表于 2012-3-3 20:46:17 | 显示全部楼层 |阅读模式
1明经币
本帖最后由 669423907 于 2012-3-3 20:48 编辑

不知在去年什么时候下的画侧螺纹孔源码,源码很累赘,自己看了好都没改成,希望大师们帮忙精简一下,在此先谢过了!
1:不要改变基点
2:只留虚线层和中心线层

;螺纹侧视图
(DEFUN C:kl()
(IF (= CENTER1 NIL)
(PROGN
      (setq olderr *error*
        *error* clerr)
(setq la (getvar"clayer"))
;(setvar "clayer""2虚线")
      (setq osnap (getvar "osmode"))
      (setq scmde (getvar "CMDECHO"))
      (setq clay (getvar "CLAYER"))
      (setq sblip (getvar "BLIPMODE"))
      (setq sgrid (getvar "GRIDMODE"))
      (setq shl (getvar "HIGHLIGHT"))
      (setq sucsf (getvar "UCSFOLLOW"))
      (setvar "CMDECHO" 0)
      (command "_.UNDO" "_GROUP")
      (command "_.UCS" "" )
      (setvar "GRIDMODE" 0)
      (setvar "UCSFOLLOW" 0)
(IF (= AAAA NIL)
   (PROGN
    (IF (= MX0 NIL) (SETQ MX0 8.0))
    (PRINT )(PRINC "请输入螺纹侧视图外径<")(PRINC MX0)(PRINC ">:")
    (SETQ MX (GETREAL ))
    (IF (= MX NIL) (SETQ MX MX0))
    (SETQ MX (/ MX 2))
    )
  )
    (SETQ K 1)
    (WHILE (< K 5)
    (IF (= NI 1) (PROGN (PRINT )(PRINC "无效的点!!! 请重输:"))
    (PROGN (PRINT )(PRINC "侧视图基准点位置:"))
    );IF
    (SETQ CENTER1 (GETPOINT ))
    (IF (/= CENTER1 NIL) (SETQ K 10))
    (SETQ NI 1)
    );WHILE
    (SETQ NI NIL K NIL)
  (setvar "osmode" 0)
  );PROGN
  );IF
  (SETQ MX1 (* MX 0.85))
  (IF (= LENG NIL) (SETQ LENG 12))
  (PRINT )(PRINC "请输入螺纹侧视图长度<")(PRINC LENG)(PRINC ">:")
  (SETQ LENGTH0 (GETDIST CENTER1 ))
  (SETQ POINTMOUSE (CADR(GRREAD 12)))
  (IF (= LENGTH0 NIL) (SETQ LENGTH0 LENG))
  (setq ts (tblsearch "LAYER" "CENTER"))
  (if (null ts)
    (PROGN
       (prompt "\nCreating new layer - CENTER. ")
       (command "_.LAYER" "_M" "CENTER" "L" "CENTER" "" "C" "1" "" "")
     );PROGN
    (progn
      (if (= (logand 1 (cdr (assoc 70 ts))) 1)
        (progn
          (prompt "\n CENTER 层被冻结吗. ")
          (initget "Yes No")
          (setq xx (getkword "\n解冻吗? <N>: "))
          (if (= xx "Yes")
            (command "_.LAYER" "_T" "CENTER" "")
          )
        )
      )
    )
  )
  (setq ts (tblsearch "LAYER" "2虚线"))
  (if (null ts)
    (PROGN
     (prompt "\nCreating new layer - 2虚线. ")
;     (command "_.LAYER" "_M" "DIM" "L" "CONTINUOUS" "" "C" "3" "" "")
     );PROGN
    (progn
      (if (= (logand 1 (cdr (assoc 70 ts))) 1)
        (progn
          (prompt "\n 2虚线 层被冻结吗. ")
          (initget "Yes No")
          (setq xx (getkword "\n解冻吗? <N>: "))
          (if (= xx "Yes")
            (command "_.LAYER" "_T" "2虚线" "")
          )
        )
      )
    )
  )
  (setq ts (tblsearch "LAYER" "2虚线"));PRESS
  (if (null ts)
    (PROGN
    (prompt "\nCreating new layer - 2虚线. ");PRESS
    (command "_.LAYER" "_M" "2虚线" "" ""); "L" "CONTINUOUS" "" "C" "4"
    );PROGN
    (progn
      (if (= (logand 1 (cdr (assoc 70 ts))) 1)
        (progn
          (prompt "\n 2虚线 层被冻结吗. ")
          (initget "Yes No")
          (setq xx (getkword "\n解冻吗? <N>: "))
          (if (= xx "Yes")
            (command "_.LAYER" "_T" "2虚线" "")
          )
        )
      )
    )
  )

  (SETQ CENTER1X (CAR CENTER1))
  (SETQ CENTER1Y (CADR CENTER1))
; (SETQ CENTER2 (LIST (+ CENTER1X (+ LENGTH0 (+ 2 (* 0.5 MX)))) CENTER1Y))
;  (COMMAND "LINE" CENTER1 CENTER2 "")
;  (COMMAND "CHANGE" "L" "" "P" "LA" "CENTER" "")
  (SETQ POINTMOUSEX (CAR POINTMOUSE))
  (SETQ POINTMOUSEY (CADR POINTMOUSE))
  (IF (AND (> (ABS (- POINTMOUSEX CENTER1X)) (ABS (- POINTMOUSEY CENTER1Y))) (< CENTER1X POINTMOUSEX))
  (PROGN
  (SETQ CENTER2 (LIST (+ CENTER1X (+ LENGTH0 (+ 2 (* 0.5 MX)))) CENTER1Y))
  (SETQ POINT1 (LIST CENTER1X (- CENTER1Y MX)))
  (SETQ POINT2 (LIST (+ CENTER1X LENGTH0) (- CENTER1Y MX)))
  (SETQ POINT3 (LIST (+ CENTER1X LENGTH0) (+ CENTER1Y MX)))
  (SETQ POINT4 (LIST CENTER1X (+ CENTER1Y MX)))
  (SETQ POINT5 (LIST CENTER1X (- CENTER1Y MX1)))
  (SETQ POINT6 (LIST (+ CENTER1X (+ LENGTH0 1) ) (- CENTER1Y MX1)))
  (SETQ POINT7 (LIST (+ CENTER1X (+ LENGTH0 1) ) (+ CENTER1Y MX1)))
  (SETQ POINT8 (LIST CENTER1X (+ CENTER1Y MX1)))
  (SETQ POINT9 (LIST (+ CENTER1X (+ LENGTH0 (+ 1 (* (/ (SIN 0.523599) (COS 0.523599)) MX1)))) CENTER1Y) )
  );PROGN
  );IF
  (IF (AND (> (ABS (- POINTMOUSEX CENTER1X)) (ABS (- POINTMOUSEY CENTER1Y))) (> CENTER1X POINTMOUSEX))
  (PROGN
  (SETQ CENTER2 (LIST (- CENTER1X (+ LENGTH0 (+ (* 0.5 MX) 2))) CENTER1Y))
  (SETQ POINT1 (LIST CENTER1X (- CENTER1Y MX)))
  (SETQ POINT2 (LIST (- CENTER1X LENGTH0) (- CENTER1Y MX)))
  (SETQ POINT3 (LIST (- CENTER1X LENGTH0) (+ CENTER1Y MX)))
  (SETQ POINT4 (LIST CENTER1X (+ CENTER1Y MX)))
  (SETQ POINT5 (LIST CENTER1X (- CENTER1Y MX1)))
  (SETQ POINT6 (LIST (- CENTER1X (+ LENGTH0 1) ) (- CENTER1Y MX1)))
  (SETQ POINT7 (LIST (- CENTER1X (+ LENGTH0 1) ) (+ CENTER1Y MX1)))
  (SETQ POINT8 (LIST CENTER1X (+ CENTER1Y MX1)))
  (SETQ POINT9 (LIST (- CENTER1X (+ LENGTH0 (+ 1 (* (/ (SIN 0.523599) (COS 0.523599)) MX1)))) CENTER1Y) )
  );PROGN
  );IF
  (IF (AND (> (ABS (- POINTMOUSEY CENTER1Y)) (ABS (- POINTMOUSEX CENTER1X))) (> CENTER1Y POINTMOUSEY))
  (PROGN
  (SETQ CENTER2 (LIST CENTER1X  (- CENTER1Y (+ LENGTH0 (+ (* 0.5 MX) 2)))))
  (SETQ POINT1 (LIST (- CENTER1X MX) CENTER1Y ))
  (SETQ POINT2 (LIST (- CENTER1X MX) (- CENTER1Y LENGTH0)))
  (SETQ POINT3 (LIST (+ CENTER1X MX) (- CENTER1Y LENGTH0)))
  (SETQ POINT4 (LIST (+ CENTER1X MX) CENTER1Y ))
  (SETQ POINT5 (LIST (- CENTER1X MX1) CENTER1Y ))
  (SETQ POINT6 (LIST (- CENTER1X MX1) (- CENTER1Y (+ LENGTH0 1))))
  (SETQ POINT7 (LIST (+ CENTER1X MX1) (- CENTER1Y (+ LENGTH0 1))))
  (SETQ POINT8 (LIST (+ CENTER1X MX1) CENTER1Y ))
  (SETQ POINT9 (LIST CENTER1X (- CENTER1Y (+ LENGTH0 (+ 1 (* (/ (SIN 0.523599) (COS 0.523599)) MX1))))))
  )
  );IF
  (IF (AND (> (ABS (- POINTMOUSEY CENTER1Y)) (ABS (- POINTMOUSEX CENTER1X))) (< CENTER1Y POINTMOUSEY))
  (PROGN
  (SETQ CENTER2 (LIST CENTER1X  (+ CENTER1Y (+ LENGTH0 (+ (* 0.5 MX) 2)))))
  (SETQ POINT1 (LIST (+ CENTER1X MX) CENTER1Y ))
  (SETQ POINT2 (LIST (+ CENTER1X MX) (+ CENTER1Y LENGTH0)))
  (SETQ POINT3 (LIST (- CENTER1X MX) (+ CENTER1Y LENGTH0)))
  (SETQ POINT4 (LIST (- CENTER1X MX) CENTER1Y ))
  (SETQ POINT5 (LIST (+ CENTER1X MX1) CENTER1Y ))
  (SETQ POINT6 (LIST (+ CENTER1X MX1) (+ CENTER1Y (+ LENGTH0 1))))
  (SETQ POINT7 (LIST (- CENTER1X MX1) (+ CENTER1Y (+ LENGTH0 1))))
  (SETQ POINT8 (LIST (- CENTER1X MX1) CENTER1Y ))
  (SETQ POINT9 (LIST CENTER1X (+ CENTER1Y (+ LENGTH0 (+ 1 (* (/ (SIN 0.523599) (COS 0.523599)) MX1))))))
  )
  );IF

  (COMMAND "LINE" CENTER1 CENTER2 "")
  (COMMAND "CHANGE" "L" "" "P" "LA" "CENTER" "")
  (COMMAND "LINE" POINT1 POINT2 "")
  (command "change"(entlast) "" "p" "lt" "hidden" "lts" 2 "c"4 "")
  (COMMAND "LINE" POINT3 POINT4 "")
  (command "change"(entlast) "" "p" "lt" "hidden" "lts" 2 "c"4 "")
  (COMMAND "LINE" POINT2 POINT3 "")
  
  (COMMAND "LINE" POINT5 POINT6 "")
  
  (COMMAND "LINE" POINT6 POINT7 "")
  
  (COMMAND "LINE" POINT7 POINT8 "")
  
  (COMMAND "LINE" POINT6 POINT9 "")
  
  (COMMAND "LINE" POINT9 POINT7 "")

  (SETQ CENTER1 NIL)
  (SETQ MX0 (* 2 MX))
  (SETQ LENG LENGTH0)
  (SETQ CENTER0 NIL CENTER1 NIL CENTER0X NIL CENTER0Y NIL  )
  (SETQ POINT1 NIL POINT2 NIL POINT3 NIL POINT4 NIL POINT5 NIL)
  (SETQ POINT6 NIL POINT7 NIL POINT8 NIL POINT9 NIL)  
(setvar "BLIPMODE" sblip)           ; Restore saved modes
  (setvar "GRIDMODE" sgrid)
  (command "_.UCS" "_P")
  (setvar "HIGHLIGHT" shl)
  (setvar "UCSFOLLOW" sucsf)
  (setvar "osmode" osnap)
  (command "_.LAYER" "_S" clay "")
  (setq *error* olderr)
  (command "_.UNDO" "_E")
  (setvar "CMDECHO" scmde)
  (princ))
附件: 您需要 登录 才可以下载或查看,没有账号?注册

最佳答案

查看完整内容

这个问题还要求助啊?自己看看书就能修改了,都是基础的,只是时间问题。我也要几个小时才能把坐标点对出来 ;;; 螺纹侧视图 (defun c:kl (/ center1 center1x center1y center2 mx1 point1 point2 point3 point4 point5 point6 point7 point8 point9 pointmouse pointmousex pointmousey s ts xx ) (setvar "cmdecho" 0) (if (= mx nil) (setq mx 4.0)) (if (= length0 nil)(setq length0 12.0) ) (s ...
发表于 2012-3-3 20:46:18 | 显示全部楼层
这个问题还要求助啊?自己看看书就能修改了,都是基础的,只是时间问题。我也要几个小时才能把坐标点对出来
;;; 螺纹侧视图
(defun c:kl (/ center1 center1x center1y center2 mx1 point1 point2 point3 point4 point5 point6 point7 point8 point9 pointmouse
               pointmousex pointmousey s ts xx
            )
  (setvar "cmdecho" 0)
  (if (= mx nil) (setq mx 4.0))
  (if (= length0 nil)(setq length0 12.0) )
  (setq s (getreal (strcat "\n请输入螺纹侧视图外径<" (rtos (* 2 mx)) ">:")))
  (if s (setq mx (/ s 2)))
  (while (not (setq center1 (getpoint "\n侧视图基准点位置:"))) (princ "\n无效的点!!! 请重输:")  )
  (setq s (getdist center1 (strcat "\n请输入螺纹侧视图长度<" (rtos length0) ">:")))
  (if s (setq length0 s) )
  (setq pointmouse (cadr (grread 12)))
  (setq mx1 (* mx 0.85))
  (command ".UNDO" "BE")
  (if (= (setq ts (tblsearch "layer" "CENTER"))         nil      )
    (command "_.LAYER" "_M" "CENTER" "L" "CENTER" "" "C" "1" "" "")
    (progn
      (if (= (logand 1 (cdr (assoc 70 ts))) 1)
        (progn
          (initget "Yes No")
          (setq xx (getkword "\n CENTER 层被冻结.解冻吗?[Yes/No] <N>: "))
          (if (= xx "Yes") (command "_.LAYER" "_T" "CENTER" "") )
        )
      )
    )
  )
  (setq center1x (car center1)        center1y (cadr center1)        pointmousex (car pointmouse)pointmousey (cadr pointmouse)  )
  (if (and(> (abs (- pointmousex center1x)) (abs (- pointmousey center1y)))(< center1x pointmousex)  )
    (setq point1 (list center1x (- center1y mx))
          point2 (list (+ center1x length0) (- center1y mx))
          point3 (list (+ center1x length0) (+ center1y mx))
          point4 (list center1x (+ center1y mx))
          point5 (list center1x (- center1y mx1))
          point6 (list (+ (car point3) (* 0.4 mx)) (- center1y mx1))
          point7 (list (+ (car point3) (* 0.4 mx)) (+ center1y mx1))
          point8 (list center1x (+ center1y mx1))
          point9 (list (+ center1x (+ length0 (+ (* 0.4 mx) (* (/ (sin 0.523599) (cos 0.523599)) mx1)))) center1y)
          center2 (list (+ (car point9) (* 0.8 mx)) center1y)
          center1 (list (- center1x (* 0.8 mx)) center1y)
    )
  )
  (if (and(> (abs (- pointmousex center1x)) (abs (- pointmousey center1y)))(> center1x pointmousex))
    (setq point1 (list center1x (- center1y mx))
          point2 (list (- center1x length0) (- center1y mx))
          point3 (list (- center1x length0) (+ center1y mx))
          point4 (list center1x (+ center1y mx))
          point5 (list center1x (- center1y mx1))
          point6 (list (- (car point3) (* 0.4 mx)) (- center1y mx1))
          point7 (list (- (car point3) (* 0.4 mx)) (+ center1y mx1))
          point8 (list center1x (+ center1y mx1))
          point9 (list (- center1x (+ length0 (+ (* 0.4 mx) (* (/ (sin 0.523599) (cos 0.523599)) mx1)))) center1y)
          center2 (list (- (car point9) (* 0.8 mx)) center1y)
          center1 (list (+ center1x (* 0.8 mx)) center1y)
    )
  )
  (if (and(> (abs (- pointmousey center1y)) (abs (- pointmousex center1x)))(> center1y pointmousey))
    (setq point1 (list (- center1x mx) center1y)
          point2 (list (- center1x mx) (- center1y length0))
          point3 (list (+ center1x mx) (- center1y length0))
          point4 (list (+ center1x mx) center1y)
          point5 (list (- center1x mx1) center1y)
          point6 (list (- center1x mx1) (- center1y (+ length0 (* 0.4 mx))))
          point7 (list (+ center1x mx1) (- center1y (+ length0 (* 0.4 mx))))
          point8 (list (+ center1x mx1) center1y)
          point9 (list center1x (- center1y (+ length0 (+ (* 0.4 mx) (* (/ (sin 0.523599) (cos 0.523599)) mx1)))))
          center2 (list center1x (- (cadr point9) (* 0.8 mx)))
          center1 (list center1x (+ center1y (* 0.8 mx)))
    )
  )
  (if (and(> (abs (- pointmousey center1y)) (abs (- pointmousex center1x)))(< center1y pointmousey) )
    (setq point1 (list (- center1x mx) center1y)
          point2 (list (- center1x mx) (+ center1y length0))
          point3 (list (+ center1x mx) (+ center1y length0))
          point4 (list (+ center1x mx) center1y)
          point5 (list (- center1x mx1) center1y)
          point6 (list (- center1x mx1) (+ center1y (+ length0 (* 0.4 mx))))
          point7 (list (+ center1x mx1) (+ center1y (+ length0 (* 0.4 mx))))
          point8 (list (+ center1x mx1) center1y)
          point9 (list center1x (+ center1y (+ length0 (+ (* 0.4 mx) (* (/ (sin 0.523599) (cos 0.523599)) mx1)))))
          center2 (list center1x (+ (cadr point9) (* 0.8 mx)))
          center1 (list center1x (- center1y (* 0.8 mx)))
    )
  )
  (entmake (list '(0 . "LINE") '(8 . "CENTER") (cons 10 center1) (cons 11 center2)))
  (entmake (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(67 . 0) '(410 . "Model") '(100 . "AcDbPolyline") '(90 . 4) '(43 . 0.0)
                 (cons 10 point1) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) (cons 10 point2) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0)
                 (cons 10 point3) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) (cons 10 point4) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0)
           )
  )
  (entmake (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(67 . 0) '(410 . "Model") '(100 . "AcDbPolyline") '(90 . 4) '(43 . 0.0)
                 (cons 10 point5) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) (cons 10 point6) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0)
                 (cons 10 point7) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) (cons 10 point8) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0)
           )
  )
  (entmake (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(67 . 0) '(410 . "Model") '(100 . "AcDbPolyline") '(90 . 3) '(43 . 0.0)
                 (cons 10 point6) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) (cons 10 point9) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0)
                 (cons 10 point7) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0)
           )
  )
  (command ".UNDO" "E")
  (princ)
)

点评

langjs 大师辛苦了,所有机械人员感谢你!  发表于 2012-3-4 16:37

评分

参与人数 1明经币 +1 收起 理由
669423907 + 1 赞一个!

查看全部评分

回复

使用道具 举报

 楼主| 发表于 2012-3-4 11:54:50 | 显示全部楼层
哪位大师高抬贵手,帮帮忙啦,实在不会改啊1
回复

使用道具 举报

 楼主| 发表于 2012-3-4 16:34:28 | 显示全部楼层
langjs 发表于 2012-3-3 20:46
这个问题还要求助啊?自己看看书就能修改了,都是基础的,只是时间问题。我也要几个小时才能把坐标点对出来 ...

谢谢 langjs 大师的热心帮助!
回复

使用道具 举报

 楼主| 发表于 2012-3-4 16:55:21 | 显示全部楼层
langjs 发表于 2012-3-3 20:46
这个问题还要求助啊?自己看看书就能修改了,都是基础的,只是时间问题。我也要几个小时才能把坐标点对出来 ...

langjs 大师,“3中心线” 层我改好了,但改不出 “2虚线” ,
我想用 “2虚线” 层做为螺纹部分,但不起作用?
还望 langjs 大师明点!

  (if (= (setq ts (tblsearch "layer" "2虚线"))         nil      )
(command "layer" "m" "2虚线" "c" "251" "" "lw" "0.13" "" "l" "DASHED" "" "")
    (progn
      (if (= (logand 1 (cdr (assoc 70 ts))) 1)
        (progn
          (initget "Yes No")
          (setq xx (getkword "\n CENTER 层被冻结.解冻吗?[Yes/No] <N>: "))
          (if (= xx "Yes") (command "_.LAYER" "_T" "2虚线" "") )
        )
      )
    )
  )
  (setq center1x (car center1)        center1y (cadr center1)        pointmousex (car pointmouse)pointmousey (cadr pointmouse)  )
  (if (and(> (abs (- pointmousex center1x)) (abs (- pointmousey center1y)))(< center1x pointmousex)  )
    (setq point1 (list center1x (- center1y mx))
          point2 (list (+ center1x length0) (- center1y mx))
          point3 (list (+ center1x length0) (+ center1y mx))
          point4 (list center1x (+ center1y mx))
          point5 (list center1x (- center1y mx1))
          point6 (list (+ (car point3) (* 0.4 mx)) (- center1y mx1))
          point7 (list (+ (car point3) (* 0.4 mx)) (+ center1y mx1))
          point8 (list center1x (+ center1y mx1))
          point9 (list (+ center1x (+ length0 (+ (* 0.4 mx) (* (/ (sin 0.523599) (cos 0.523599)) mx1)))) center1y)
          center2 (list (+ (car point9) (* 0.8 mx)) center1y)
          center1 (list (- center1x (* 0.8 mx)) center1y)
    )
  )
  (if (and(> (abs (- pointmousex center1x)) (abs (- pointmousey center1y)))(> center1x pointmousex))
    (setq point1 (list center1x (- center1y mx))
          point2 (list (- center1x length0) (- center1y mx))
          point3 (list (- center1x length0) (+ center1y mx))
          point4 (list center1x (+ center1y mx))
          point5 (list center1x (- center1y mx1))
          point6 (list (- (car point3) (* 0.4 mx)) (- center1y mx1))
          point7 (list (- (car point3) (* 0.4 mx)) (+ center1y mx1))
          point8 (list center1x (+ center1y mx1))
          point9 (list (- center1x (+ length0 (+ (* 0.4 mx) (* (/ (sin 0.523599) (cos 0.523599)) mx1)))) center1y)
          center2 (list (- (car point9) (* 0.8 mx)) center1y)
          center1 (list (+ center1x (* 0.8 mx)) center1y)
    )
  )
  (if (and(> (abs (- pointmousey center1y)) (abs (- pointmousex center1x)))(> center1y pointmousey))
    (setq point1 (list (- center1x mx) center1y)
          point2 (list (- center1x mx) (- center1y length0))
          point3 (list (+ center1x mx) (- center1y length0))
          point4 (list (+ center1x mx) center1y)
          point5 (list (- center1x mx1) center1y)
          point6 (list (- center1x mx1) (- center1y (+ length0 (* 0.4 mx))))
          point7 (list (+ center1x mx1) (- center1y (+ length0 (* 0.4 mx))))
          point8 (list (+ center1x mx1) center1y)
          point9 (list center1x (- center1y (+ length0 (+ (* 0.4 mx) (* (/ (sin 0.523599) (cos 0.523599)) mx1)))))
          center2 (list center1x (- (cadr point9) (* 0.8 mx)))
          center1 (list center1x (+ center1y (* 0.8 mx)))
    )
  )
  (if (and(> (abs (- pointmousey center1y)) (abs (- pointmousex center1x)))(< center1y pointmousey) )
    (setq point1 (list (- center1x mx) center1y)
          point2 (list (- center1x mx) (+ center1y length0))
          point3 (list (+ center1x mx) (+ center1y length0))
          point4 (list (+ center1x mx) center1y)
          point5 (list (- center1x mx1) center1y)
          point6 (list (- center1x mx1) (+ center1y (+ length0 (* 0.4 mx))))
          point7 (list (+ center1x mx1) (+ center1y (+ length0 (* 0.4 mx))))
          point8 (list (+ center1x mx1) center1y)
          point9 (list center1x (+ center1y (+ length0 (+ (* 0.4 mx) (* (/ (sin 0.523599) (cos 0.523599)) mx1)))))
          center2 (list center1x (+ (cadr point9) (* 0.8 mx)))
          center1 (list center1x (- center1y (* 0.8 mx)))
    )
  )
(command "layer" "m" "3中心线" "c" "1" "" "lw" "0.13" "" "l" "CENTER" "" "")
  (entmake (list '(0 . "LINE") '(8 . "3中心线") (cons 10 center1) (cons 11 center2)))
  (entmake (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(67 . 0) '(410 . "Model") '(100 . "AcDbPolyline") '(90 . 4) '(43 . 0.0)
                 (cons 10 point1) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) (cons 10 point2) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0)
                 (cons 10 point3) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) (cons 10 point4) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0)
           )
回复

使用道具 举报

 楼主| 发表于 2012-3-4 17:15:43 | 显示全部楼层
谢谢,可以了!
(command "layer" "m" "3中心线" "c" "1" "" "lw" "0.13" "" "l" "CENTER" "" "")
;  (if (= (setq ts (tblsearch "layer" "2虚线"))         nil      )
;    (progn
;      (if (= (logand 1 (cdr (assoc 70 ts))) 1)
;        (progn
;          (initget "Yes No")
;          (setq xx (getkword "\n CENTER 层被冻结.解冻吗?[Yes/No] <N>: "))
;          (if (= xx "Yes") (command "_.LAYER" "_T" "DASHED" "") )
;        )
;      )
;    )
;  )




(command "layer" "m" "2虚线" "c" "251" "" "lw" "0.13" "" "l" "DASHED" "" "")
  (entmake (list '(0 . "LINE") '(8 . "3中心线") (cons 10 center1) (cons 11 center2)))
回复

使用道具 举报

发表于 2012-5-3 08:59:06 | 显示全部楼层
我是来偷学的~~~~
回复

使用道具 举报

发表于 2015-7-20 17:39:29 | 显示全部楼层
我感觉应当框选两平行线,自动识别距离并在中心线处生成螺丝符号,大家觉得了
回复

使用道具 举报

发表于 2016-7-29 17:08:53 | 显示全部楼层
谁有画内六角螺丝侧视图的LSP啊,带螺丝头,能拉伸螺丝长度的?
回复

使用道具 举报

发表于 2017-9-25 14:52:02 | 显示全部楼层
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-12-22 22:55 , Processed in 0.297519 second(s), 31 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表