highflybird 发表于 2022-7-5 17:03:36

延伸两端的线

你好
多选直线,输入距离,直线两端加长。
谢谢你的帮助。

ReMark 发表于 2022-7-5 17:08:51

请尝试附加的由ASMI编写的lisp例程,该例程最初发布在CADTutor上。我不确定日期。加载例程后要键入的命令是blen。
 
注意:此例程将延长或缩短两端的一条线。用户选择。
 
测验lsp

hanhphuc 发表于 2022-7-5 17:14:02

你是说双方吗?
子功能:

;For Extension of linear (lines & align Dimension only)
;hanhphuc 2014
argument:
_e= ename
ex= extension. 'REAL
id= dxf index. eg: '(10 11)

(defun +exlin (_e ex id / l ep a d)
(if (and id (= (length id) 2)) ; index list only limited for 2
   (progn (setq l(entget _e)
       ep (mapcar ''((x) (cdr (assoc x l))) id)
       a(angle (car ep) (cadr ep))
       d(apply 'distance ep)
       ) ;_ end of setq
   (mapcar ''((u v)(entmod (setq l (subst (cons u v) (assoc u l) l)))) ; <--updated
           id
           (mapcar ''((x) (polar (mapcar ''((a b) (/ (+ a b) 2.)) (car ep) (cadr ep)) x (+ (/ d 2.) ex)))
                   (list a (+ a pi))
                   ) ;_ end of mapcar
           ) ;_ end of mapcar
   ) ;_ end of progn
   ) ;_ end of if
) ;_ end of defun

;Example call:
;(+exlin (car(entsel)) 1.0 '(10 11)) <--- click line
;(+exlin (car(entsel)) 1.0 '(13 14)) <--- click aligned dimension


ReMark 发表于 2022-7-5 17:16:55

是的,他是指两端。

Tharwat 发表于 2022-7-5 17:21:06

我的提议很简单
 


(if (not *dist*)(setq *dist* 1.0))

(defun c:EXLIN (/ *error* ext e ve os ad)
(defun *error* (msg)
   (if        (not (wcmatch (strcase msg) "*CANCEL*,*EXIT*"))
   (princ (strcat "\nError: " msg))
   ) ;_ end of if
   (princ)
   ) ;_ end of defun
(setq        ext (getdist (strcat "\nEnter extension? <" (rtos *dist* 2) "> : "))
os(getvar "osmode")
) ;_ end of setq
(if (not ext)
   (setq ext *dist*)
   (setq *dist* ext)
   ) ;_ end of if
(setvar "osmode" 0)
(while (and (setq e (entsel "\nPick Aligned Dimension: "))
      (setq ve (vlax-ename->vla-object (car e))
          ad (vla-get-objectname ve)
          ) ;_ end of setq
      ) ;_ end of and
   (cond ((apply 'or (mapcar ''(($) (wcmatch ad $)) '("*AcDbAlignedD*" "*AcDbRotatedD*")))
   (+exlin (car e) ext '(13 14))
   )
((wcmatch ad "*AcDbLine*") (+exlin (car e) ext '(10 11))) ;(+rdim (car e) ext)
(t nil)
) ;_ end of cond
   ) ;_ end of while
(setvar "osmode" os)
) ;_ end of defun


http://www.cadtutor.net/forum/showthread.php?88181-line-at-both-ends-of-the-extension
(princ "\nhanhphuc 2014. Extension Dimension. Command: EXLIN")
(princ)

highflybird 发表于 2022-7-5 17:25:08

 
谢谢,我在Acad2007中测试了你的代码,没问题!可以两端测试,但我在Acad2010中测试,只有一端。困惑的

highflybird 发表于 2022-7-5 17:29:27

 
Tharwat,谢谢。好久不见。
你的动作很好!美好的

hanhphuc 发表于 2022-7-5 17:35:07

 
@您好,谢谢,我不知道是选线还是尺寸,然后我都做了。
&塔瓦特
我的尺寸已经变得非关联,这正常吗?

ReMark 发表于 2022-7-5 17:38:58

我没有将原始帖子解释为包含维度。我认为OP把它放在那里是为了展示“之前”和“之后”的线条长度。
 
我发布的例程是由ASMI编写的,使用AutoCAD 2015进行了测试,效果良好。
 
请注意,在我发布第一个回复之前,没有其他人提供解决方案。现在OP有不止一个。美好的

highflybird 发表于 2022-7-5 17:43:40

 
是的,双方。
谢谢你的代码。没关系!但为什么维度没有遵循这些线呢?备注和Tharwat的代码可以!
页: [1] 2
查看完整版本: 延伸两端的线