The code written in the forum is mainly to demonstrate the usage of the main functions to be introduced. There may be a better or direct way to implement it.
The following code mainly introduces Let SSGET support keywords.....1. Let SSGET support keywords, callback functions, and modify prompt strings.
;|
xdrx-initssget
1.ssget Supports CallBack Function Usages,
2.Supports one-click carriage return. For example, if you enter B, you can enter directly.|;
(xdrx-initssget "\nPlease select the padding to be modified [Scale(B)/Spacing(V)]<Exit>:"
"B V"
""
"-KEYWORD"
)
(xdrx-initssget
"\nPlease select the padding to be modified [Scale(B)/Spacing(V)]<Exit>:"
;;Replace "Select Objects:" with the prompt string
"B V"
;;Keyword, supports one-click carriage return. After entering the keyword, enter the callback function processing, and then continue the SSGET process.
""
"-KEYWORD"
;;CallBack Function
)
(xdrx
-ssget '
((0 .
"hatch") (2 .
"~solid")))
(defun c:xdtb
-hatchmodscl
(/ gap scl ss i x
) "\nCurrent settings: "
(cond ((= #xd
-var
-global
-mode
-hatch
-mode
0) "Scale(") ((= #xd-var-global-mode-hatch-mode 1) "Spacing(")
)
#xd-var-global-gap
")"
)
)
"\nInput Scale<"
#xd-var-global-gap
">:"
t
)
)
)
(setq #xd
-var
-global
-gap val
) )
(setq #xd
-var
-global
-mode
-hatch
-mode
0) )
((= key "V")
(xdrx
-prompt "\nInput Spacing<" #xd
-var
-global
-gap
">:" t
) )
)
(setq #xd
-var
-global
-gap val
) )
(setq #xd
-var
-global
-mode
-hatch
-mode
1) )
)
)
(xdrx-begin)
(if (not #xd
-var
-global
-gap
) (setq #xd
-var
-global
-gap
1.0) )
(if (not #xd
-var
-global
-mode
-hatch
-mode
) (setq #xd
-var
-global
-mode
-hatch
-mode
0) )
;|
xdrx-initssget
1.ssget Supports CallBack Function Usages,
Let SSGET support keywords, callback functions, and modify prompt strings.
2.Supports one-click carriage return. For example, if you enter B, you can enter directly.|;
(xdrx-initssget
"\nPlease select the padding to be modified [Scale(B)/Spacing(V)]<Exit>:"
"B V"
""
"-KEYWORD"
)
(if (setq ss
(xdrx
-ssget '
((0 .
"hatch") (2 .
"~solid")))) (if (= #xd
-var
-global
-mode
-hatch
-mode
0) (xdrx-entity-setproperty
ss
"patternscale"
#xd-var-global-gap
)
(setq gap
(xdrx
-getpropertyvalue x
"ParallelSpacing")) scl (xdrx-getpropertyvalue x "PatternScale")
scl (* scl (/ #xd-var-global-gap gap))
)
(xdrx-setpropertyvalue x "patternscale" scl)
)
)
)
(xdrx-pickset->ents ss)
)
"\nSelected"
"Hatch, modified successfully"
i
)
)
)
)
)
(xdrx-end)
)