Grrr 发表于 2022-7-5 17:24:24

entsel选取框大小

大家好,
我想知道,当提示用户输入entsel时,是否可以增加这个选取框的大小?

我试着使用cursorsize变量,但没有用。

a_67vdub 发表于 2022-7-5 17:44:21

您回答了自己的问题,变量是“pickbox”。

Grrr 发表于 2022-7-5 17:56:28

 
谢谢你,伙计!
现在,我的问题似乎有点讽刺,但以下是我正在编写的代码的最终结果:
; VLD_Offset
; Perform offset, by detecting with cursor, from which side the entity is selected,
; and then the entity is offseted, corresponding to that side/orientation.
(defun C:test ( / *error* oldcmd oldclp oldpxsz off-dist ent vla-obj P-pt C-pt T-pt )
(vl-load-com)

(defun *error* ( msg )
        (if oldcmd (setvar 'cmdecho oldcmd))
        (if oldclp (setvar 'clipromptlines oldclp))
        (if oldpxsz (setvar 'pickbox oldpxsz))
        (if (not (member msg '("Function cancelled" "quit / exit abort")))
                (princ (strcat "\nError: " msg))
        )
        (princ)
)

(initget 1)
(if (setq off-dist (getreal "\nSpecify offset distance: "))
        (progn
                (setvar 'errno 0)
                (setq oldcmd (getvar 'cmdecho))
                (setvar 'cmdecho 0)
                (setq oldclp (getvar 'clipromptlines))
                (setvar 'clipromptlines 1)
                (setq oldpxsz (getvar 'pickbox)) ; default value is 3
                (setvar 'pickbox (* oldpxsz 3))
                (while T
                        (while
                                (not
                                        (and
                                                (setq ent (entsel "\nPick an entity to offset: "))
                                                (member (cdr (assoc 0 (entget (car ent)))) (list "LINE" "LWPOLYLINE" "SPLINE" "CIRCLE" "ARC" "XLINE" "RAY"))
                                        )
                                )
                                (if (or (= (getvar 'errno) 7) (null (car ent))) (princ "\nYou missed, try again!") )
                        ); while
                        (progn
                                (setq vla-obj (vlax-ename->vla-object (car ent)))
                                (setq P-pt (cadr ent)) ; pick point
                                (setq C-pt (vlax-curve-getClosestPointTo vla-obj P-pt)) ; closest point
                                (setq T-pt (polar C-pt (angle C-pt P-pt) off-dist)) ; trough point
                                (vl-cmdf "_.OFFSET" "T" ent T-pt "E")
                        )
                ); while T
        ); progn
); if off-dist
(princ)
); defun

Lee Mac 发表于 2022-7-5 18:10:06

这是一种糟糕的做法,因为用户通过崩溃程序(使用Esc)被迫退出循环;考虑测试用户是否取消了选择提示,并将此条件用作while循环的测试表达式。
 
注意,progn表达式也不是必需的,因为while将接受测试表达式参数之后的多个表达式参数。

BIGAL 发表于 2022-7-5 18:30:16

我使用的示例,ent将返回false
 

(alert "pick objects select a blank area to exit")
(while
   (setq ent (entsel "\nPick an entity to offset: "))
页: [1]
查看完整版本: entsel选取框大小