1
0
初来乍到
Main Function---------------------------------------------------------------------------;;;Function draws a leader with no text.(defun bmcdNE (wLeader wElev wa / ap np ep N E)(BMCDTextStyles) ;load standard text styles(BMCDDimStyles) ;load standard dim styles;save variables(NEsave-vars); setup error handler here(setvar "cmdecho" 0)(setq *error* leader-error);check and set dscale(if (= dscale nil)(setq dscale (getvar "dimscale")));end if(QlSave);saves current settings;Now we need to set the current settings for the needed leader(setq NoText '(4 ;1. AnnoType 60 0Mtext<def> 1Copy 2Tolerance 3BlockReference 4None0 ;2. ReuseAnno 61 0None<def> 1Next 2Current1 ;3. LeftAttach 62 0TopOfTop 1MiddleOfTop<def> 2Middle 3MiddleOfBottom 4BottomOfBottom3 ;4. RightAttach 63 0TopOfTop 1MiddleOfTop 2Middle 3MiddleOfBottom<def> 4BottomOfBottom0 ;5. Underline 64 1On 0Off<def>0 ;6. Splined 65 1On 0Off<def>1 ;7. NoPointLimit 66 1On 0Off<def>2 ;8. NumPoints 67 Integer (Must be greater than 2) 3<def>0 ;9. Wordwrap 68 1On<def> 0Off1 ;10. AlwaysLeftJust 69 1On 0Off<def>0 ;11. Angle1 70 0Any<def> 1Horizontal 2?d 3Ed 40d 5 d0 ;12. Angle2 71 0Any<def> 1Horizontal 2?d 3Ed 40d 5 d0 ;13. Box 72 1On 0Off<def>0.0 ;14. Textwidth 40 Real (Must be > 0.0) 0.0<def>"." ;15. Arrowname 3 String (or User defined arrow as block name) See definitions below));end setq (command "osnap" "end,mid,intersection,center")(SetQleader NoText)(setvar "dimlwd" -1)(setvar "texteval" 1)(setvar "orthomode" 0) (setq style (cdr(assoc 40 (tblsearch "style" (getvar "textstyle"))))) ;gets the text height from style.(setq comp (cdr(assoc 41 (tblsearch "style" (getvar "textstyle"))))) ;stores the compression factor.(if (= 0 style) (setq ts (getvar "textsize"))) ;sets the text size to the active textsize.(if (/= 0 style) (setq ts style)) ;sets the text size to the style size.(command "layer" "set" "G-ANNO-TEXT" "") (setq pt1 (getpoint "\nEnter starting point:")) ;Gets the first point for the;coordinate and line. (setvar "osmode" 0)(setvar "luprec" 2) (setq save-pt1 pt1) ;;; ;do we need to covert the point from pspace to mspace?(if (= (getvar "tilemode") 0)(setq cs_from 0) ;WCS(setq cs_to 1) ;UCS(setq pt1 (trans pt cs_from cs_to 0) ; disp = 0 indicateds that pt is a point)(setq x1 (car pt1)) ;Stores the x coord of the first point.(setq y1 (cadr pt1)) ;Stores the y coord of the first point.(setq z1 (caddr pt1)) ;stores the z coord of the first point. JAH(setq xabs (abs x1)) ;Gets the absolute value of the x point.(setq yabs (abs y1)) ;Gets the absolute value of the y point.(setq zabs (abs z1)) ;Gets the absolute value of the z point. AMS(setq x (rtos xabs (getvar "lunits") (+(getvar "luprec")0))) ;Converts the x coord from real to string.(setq y (rtos yabs (getvar "lunits") (+(getvar "luprec")0))) ;Converts the y coord form real to string.(setq z (rtos zabs (getvar "lunits") (+(getvar "luprec")0))) ;Converts the z coord form real to string. JAH;if the number of decimal places is less than the precission add zeros(while (< (strlen (substr x (+(vl-string-search "." x) 2))) (getvar "luprec"))(setq x (strcat x "0")));if the number of decimal places is less than the precission add zeros(while (< (strlen (substr y (+(vl-string-search "." y) 2))) (getvar "luprec"))(setq y (strcat y "0")));if the number of decimal places is less than the precission add zeros(while (< (strlen (substr z (+(vl-string-search "." z) 2))) (getvar "luprec"))(setq z (strcat z "0"))) (setq IN x) ;Sets variable for subroutine.(COMMA) ;CALLS SUBROUTINE.(setq x OUT) ;Saves variable from subroutine.(setq IN y) ;Sets variable for subroutine.(COMMA) ;CALLS SUBROUTINE.(setq y OUT) ;Saves variable from subroutine.(setq IN z) ;Sets variable for subroutine.(COMMA) ;CALLS SUBROUTINE.(setq z OUT) ;Saves variable from subroutine. (setq pt1 save-pt1 )(if (> X1 0)(setq E (strcat "E " x )) ;Checks to see if X coordinate)(if(< X1 0)(setq E (strcat "W " x )) ;is positive or negitive)(if(= X1 0)(setq E (strcat "BASELINE " x )) ;and sets the proper label.)(if(> Y1 0)(setq N (strcat "N " y )) ;Checks to see if Y coordinate)(if(< Y1 0)(setq N (strcat "S " y )) ;is positive or negitive)(if(= Y1 0)(setq N (strcat "BASELINE " y )) ;and sets the proper label.