Thread Content
;;========================================Custom function library;;======Get the AutoCAD object first (setq * acad * (vlax-get-acad-object)) ;;====== Then get the current document (setq * doc * (vlax-get-property * acad * 'ActiveDocument)) ;;===== Then send a command to the current document, and the command parameter is a string. ;;====== The format of the command is the same as the manual input command, note that a space is used to indicate confirmation. ;;====== If there is no space at the end, the command will be written to the command line but not executed immediately. ;;For example (defun c:B () (vla-sendcommand * doc * "BLOCK ")) Where "B" is a customized shortcut command and "BLOCK " is a system command. ;;======================================== Shortcut command list;;======Single key(defun c:A () (command "ARC")) ;Arc(defun c:B () (vla-sendcommand * doc * "BLOCK ")) ;Block definition (defun c:C () (command "CIRCLE")) ; Circle (defun c:D () (vla-sendcommand * doc * "DIMSTYLE ")) ; Dimension style (defun c:E () (command "ERASE")) ; Delete (defun c:F () (COMMAND "FILLET")) ; Fillet (defun c:R () (COMMAND "REGEN")) ; Regenerate model (defun c:S () (COMMAND "STRETCH")) ; Stretch (defun c:T () (COMMAND "_.TRIM" "")) ;Cut (automatically cut the nearest part) (defun c:V () (COMMAND "MOVE")) ;Move (defun c:W () (vla-sendcommand * doc * "WBLOCK ")) ; write block (defun c: * doc * "INSERT ")) ;Insert (defun c:XX () (COMMAND "OPTIONS")) ;Options (defun c:GS () (COMMAND "MATCHPROP")) ;Format brush (defun c:BZ () (COMMAND "DSETTINGS")) ;Object capture (defun c:AD () (COMMAND "APPLOAD")) ;Load application (defun c:SC () (COMMAND "SCALE")) ;Zoom in, zoom out (defun c:ST () (vla-sendcommand * doc * "STYLE ")) ; Text style (defun c:RE () (COMMAND "RECTANG")) ; Rectangle (defun c:RT () (COMMAND "ROTATE")) ; Rotation (defun c:DV () (COMMAND "DIVIDE")) ; Divide (defun c:FD () (COMMAND "FIND")) ; Find (defun c:BB () (vla-sendcommand * doc * "BHATCH ")) ;Pattern fill(defun c:BR () (COMMAND "BREAK")) ;Break(defun c:EX () (COMMAND "_.EXTEND" "")) ;Extend (automatically extend to the nearest intersection) (defun c:VE () (COMMAND "MOVE")) ;Move (defun c:ED () (COMMAND "PEDIT")) ;Multiple line segment, single line conversion (defun c:DB () (COMMAND "POLYGON")) ;Polygon (defun c:EE () (vla-sendcommand * doc * "LINETYPE ")) ; Line type manager (defun c:AE () (vla-sendcommand * doc * "LAYER ")) ; Layer manager (defun c:DT () (COMMAND "DIST")) ; Query distance (defun c:DE () (COMMAND "DIMLINEAR")) ; Line label (defun c:DR () (COMMAND "DIMRADIUS")) ; Radius label (defun c:DD () (COMMAND "DIMDIAMETER")) ; Diameter label (defun c:DA () (COMMAND "DIMANGULAR")) ;Download the fan mark and save it as * .LSP file, start CAD, APPLOAD and that’s it!