6
23
17
初来乍到
使用道具 举报
106
1万
101
顶梁支柱
;;; HATCHB.LSP ver 2.1;;; Recreates hatch boundary by selecting a hatch;;; Boundary is created in current layer/color/linetype in WCS;;; Known problem with some elipses and splines;;; By Jimmy Bergmark;;; Copyright (C) 1997-2004 JTB World, All Rights Reserved;;; Website: www.jtbworld.com;;; E-mail: info@jtbworld.com;;; 2000-02-12 - First release;;; 2000-03-27 - Counterclockwise arc's and ellipse's fixed;;; Objects created joined to lwpolyline if possible;;; Error-handling, undo of command;;; Can handle PLINETYPE = 0,1,2;;; 2000-03-30 - Integrating hatchb and hatchb14;;; Selection of many hatches;;; Splines supported if closed.;;; 2001-04-02 - Fixed bug with entmake of line with no Z for r14;;; 2001-07-31 - Removed an irritating semicolon to enable polylines to be created.;;; 2001-10-04 - Changed mail and homepage so it's easy to find when new versions comes up.;;; 2003-02-06 - Minor fix;;; 2003-02-17 - Area returned if no islands is found since it's not consistant;;; 2003-05-19 - Fix to take PEDITACCEPT variable used in AutoCAD 2004 into account;;; 2004-11-05 - Minor bugs fixed;;; Tested on AutoCAD r14, 2000, 2000i, 2002, 2004, 2005;;; should be working on older versions too.(defun c:hb (/ es blay ed1 ed2 loops1 bptf part et noe plist ic bul nr ang1 ang2 obj *ModelSpace* *PaperSpace* space cw errexit undox olderr oldcmdecho ss1 lastent en1 en2 ss lwp list->variantArray 3dPoint->2dPoint A2k ent i ss2 knot-list controlpoint-list kn cn pos xv bot area hst )(setq A2k (>= (substr (getvar "ACADVER") 1 2) "15"))(if A2k (progn (defun list->variantArray (ptsList / arraySpace sArray) (setq arraySpace (vlax-make-safearray vlax-vbdouble (cons 0 (- (length ptsList) 1)) ) ) (setq sArray (vlax-safearray-fill arraySpace ptsList)) (vlax-make-variant sArray) ) (defun areaOfObject (en / curve area) (if en (if A2k (progn (setq curve (vlax-ename->vla-object en)) (if (vl-catch-all-error-p (setq area (vl-catch-all-apply 'vlax-curve-getArea (list curve)) ) ) nil area ) ) (progn (command "._area" "_O" en) (getvar "area") ) ) ) ) ))(if A2k (defun 3dPoint->2dPoint (3dpt) (list (float (car 3dpt)) (float (cadr 3dpt))) )) (defun errexit (s) (princ "\nError: ") (princ s) (restore) ) (defun undox () (command "._ucs" "_p") (command "._undo" "_E") (setvar "cmdecho" oldcmdecho) (setq *error* olderr) (princ) ) (setq olderr *error* restore undox *error* errexit ) (setq oldcmdecho (getvar "cmdecho")) (setvar "cmdecho" 0) (command "._UNDO" "_BE") (if A2k (progn (vl-load-com) (setq *ModelSpace* (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-acad-object)) ) *PaperSpace* (vla-get-PaperSpace (vla-get-ActiveDocument (vlax-get-acad-object)) ) )) ); For testing purpose; (setq A2k nil) (if (/= (setq ss2 (ssget '((0 . "HATCH")))) nil) (progn (setq i 0) (setq area 0)