本帖最后由 liuhe 于 2023-4-9 11:00 编辑
- (DEFUN C:TT ()
- (SETQ E (CAR (ENTSEL"\n选择合并后lw线")))
- (IF E
- (PROGN
- (SETQ ENT (ENTGET E))
- (SETQ PLST (MJ:massoc 10 ENT))
- (SETQ P1DIS (vlax-curve-getDistAtPoint E (CAR PLST))
- P2DIS (vlax-curve-getDistAtPoint E (CADR PLST))
- P3DIS (vlax-curve-getDistAtPoint E (CADDR PLST))
- P4DIS (vlax-curve-getDistAtPoint E (LAST PLST))
- P2 (vlax-curve-getPointAtDist E (* 0.5 P2DIS))
- P3 (vlax-curve-getPointAtDist E (+ (* 0.5 P3DIS) (* 0.5 P2DIS)))
- )
- (Make-TEXT P2 "P2")
- (Make-TEXT P3 "P3")
- (EntmakeDimensionH
- p2
- p3
- (LIST (CAR (MID P2 P3)) (MAX (CADR P2) (CADR P3)))
- )
- )
- )
- )
- (DEFUN MID (P1 P2)
- (MAPCAR (FUNCTION (LAMBDA (X Y) (* 0.5 (+ X Y)))) P1 P2)
- )
- (defun EntmakeDimensionH (p1 p2 txtpt)
- (entmakeX
- (list '(0 . "DIMENSION")
- '(100 . "AcDbEntity")
- '(100 . "AcDbDimension")
- (cons 10 txtpt)
- '(70 . 32)
- '(1 . "")
- '(100 . "AcDbAlignedDimension")
- (cons 13 p1)
- (cons 14 p2)
- '(100 . "AcDbRotatedDimension")
- )
- )
- )
- (defun Make-TEXT (pt str)
- (entmakeX
- (list '(0 . "TEXT") (cons 1 str) (cons 10 pt) (cons 40 10))
- )
- )
- (defun MJ:massoc (key alist)
- (mapcar 'cdr
- (vl-remove-if-not '(lambda (x) (equal key (car x))) alist)
- )
- )
我连圆弧的顶点是啥都看不懂,圆弧的角平分线的点? 上诉代码是两段圆弧合并后为 一个lw线的 代码 |