HCBBS Forum (English)
Submit Chemical Projects / Find Solutions
Amplify Your Requirements on a Broader Chemical Platform *Engineering · Technology · Equipment · Solutions*
Submit Request

Sharing a few LSPs; hope it will be helpful to everyone

2008-02-25View Original

Thread Content

;*************************************************Batch Trimming (defun C:BT (/ S1 S2 PT1 PT2 CMDECHO_OLD OSMODE_OLD I XX) (setq CMDECHO_OLD (getvar \"CMDECHO\") OSMODE_OLD (getvar \"OSMODE\")) (setvar \"CMDECHO\" 0) (setvar \"OSMODE\" 0) (princ (strcat \"\\nCurrent settings: Projection=\"(nth (getvar \"PROJMODE\") ‘(\"No Projection\" \"Current UCS\" \"Current View\")) \", Edge=\”(nth (getvar \"EDGEMODE\") ‘(\"No Extension\" \"Extension\"))\") ) (princ \"\\nSelect the edges to trim...\") ;;If no boundary is selected, use all objects as the boundary (if (setq S1 (ssget)) () (setq S1 (ssget \"all\"))) (while (progn (initget 4 \"P E U\") (setq PT1 (getpoint \"\\nSelect the object to trim, or:\")))) (cond ;;Branch 1: Projection option setting ((= PT1 \"P\") (progn (initget 4) (setq XX (getint (strcat \"\\nEnter projection option:\")))) (if (or (= XX 0) (= XX 1) (= XX 2)) (setvar \"PROJMODE\" XX))) ;;Branch 2: Edge extension option setting ((= PT1 \"E\") (progn (initget 4) (setq XX (getint (strcat \"\\nEnter hidden edge extension mode:\")))) (if (or (= XX 0) (= XX 1)) (setvar \"EDGEMODE\" XX))) ;;Branch 4: Undo the previous action ((= PT1 \"U\") (command \"_.undo\" 1))) ;;Branch 5: Trim the selected object ((listp PT1) (progn (if (setq S2 (ssget PT1)) (progn (command \"_.undo\" \"be\") (command \"_.trim\" S1 \"\" S2\") (command \"_.undo\" \"e\")))) (if (and (setq PT2 (getcorner PT1 \" >>>Second corner point: \")) (setq S2 (ssget \"c\" PT1 PT2))) (progn (command \"_.undo\" \"be\") (command \"_.trim\" S1 \"\") (setq I 0) (repeat (sslength S2) (command (list (ssname S2 I) PT1))) (setq I (1+ I))) (command \"\") (command \"_.undo\" \"e\"))) (princ \"\\n★No object selected.\") ") ) ) ) ) ;_End of branch five ) ;_End of cond branch ) ;_End of while (setvar \"OSMODE\" OSMODE_OLD) (setvar \"CMDECHO\" CMDECHO_OLD) (princ \"\n★Normal end.\" Thank you for using it. ") (princ) ) ;_End of defun ;**********************************************Free drawing tool (can be used for sketching and creating signatures) (defun c:zyh( / p1 px) (command \"blipmode\" \"OFF\") (setq code nil) (while (/= code 12) (setq code nil) (setq p1(getpoint \"First point\" )) (while (and (/= code 3)(/= code 12)) (setq in(grread 5)) (setq px(cadr in)) (setq code(car in)) (if (and (/= p1 px) (/= p1 nil) (/= px 0) (/= p1 0) ) (command \"line\" p1 px \"\") ) (setq p1 px) ) ) (princ) ) I’ll share 2 examples today; those who need the LSP program should reply in the comments, and I’ll continue to upload more to share!

Submit a Project

**Looking for Chemical Technology, Equipment & Solutions?** No Registration Required Broader Platform Exposure | Global Chemical Service Provider Connections

Submit Request — Free Consultation

Disclaimer

This is an automated machine translation of the original thread. Some technical terms may have inaccuracies; the original text shall prevail. Click "View Original" at the top right to access the source page, which supports IP-based automatic real-time language translation. Please watch out for contact details and sales inducements to prevent fraud. All content and translations are for reference only, representing solely the poster's personal views. For enquiries, email service@hcbbs.com.