Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/06/2019 in all areas

  1. You may need to read the codes that you copied and search if there is any question mark(s) or any other weired chars added automatically with the codes due to the software of this forum and this is happening a lot.
    1 point
  2. Hi, Give this a shot. (defun c:enz (/ key pnt dim a b c) ;; Tharwat - 5.Jul.2019 ;; (and (or (initget "EN ENZ Z") (setq key (cond ((getkword "\nPick your go [EASTING+NORTHING , EASTING+NORTHING+Z , Z] [EN ENZ Z] < EN > :" ) ) ("EN") ) ) ) (setq pnt (getpoint "\nSpecify base point : ")) (setq dim (getvar 'DIMZIN)) (setvar 'DIMZIN 0) (mapcar 'set '(a b c) (mapcar '(lambda (k p) (strcat k (rtos p 2 4))) '("E=" "N=" "Z=") pnt ) ) (setvar 'DIMZIN dim) (command "_.LEADER" "_none" pnt "\\" "" (nth (vl-position key '("EN" "ENZ" "Z")) (list (strcat a "\\P" b) (strcat a "\\P" b "\\P" c) c) ) "" ) ) (princ) )
    1 point
  3. The suggestion is good a couple of changes put the two getpoint into a while so you can repeat. ; pick a point and make a leader ; by Alan H July 2019 (defun C:cxy ( / pt1 pt2 ans txtx txty txtz oldlay) (command "-layer" "m" "Co-ordinates" "c" 1 "Co-ordinates" "") (setq oldlay (getvar 'clayer)) (setvar 'clayer "Co-ordinates") (if (not AH:Butts)(load "Multi Radio buttons.lsp")) (if (= but nil)(setq but 1)) (setq ans (ah:butts but "V" '("Please choose" "E-N" "E-N-Z" "Z"))) (setvar "cmdecho" 0) (while (setq pt1 (getpoint "\nPick point for co-ordinate: ")) (setq pt2 (getpoint pt1 "\nPick point for text: ")) (if pt2 (progn (setq txtx (strcat "E= " (rtos (car pt1) 2 3) )) (setq txty (strcat "N= " (rtos (cadr pt1) 2 3) )) (setq txtz (strcat "Z= " (rtos (caddr pt1) 2 3) )) (princ "\n") (cond ((= ans "E-N")(command "leader" pt1 pt2 "Annotation" txtx txty "")) ((= ans "E-N-Z")(command "leader" pt1 pt2 "Annotation" txtx txty txtz "")) ((= ans "Z")(command "leader" pt1 pt2 "Annotation" txtz "")) ) ) ) ) (setvar 'clayer oldlay) (princ) ) (c:cxy) . Multi radio buttons.lsp
    1 point
  4. Try the attached. It inserts the leader/text as a mleader in the current mleader style. This must be set up correctly for your desired text size, since I don't know what this is. (defun rh:sammlung_n (o_lst grp / tmp n_lst) (setq n_lst nil) (cond ( (and o_lst (= (rem (length o_lst) grp) 0)) (while o_lst (repeat grp (setq tmp (cons (car o_lst) tmp) o_lst (cdr o_lst))) (setq n_lst (cons (reverse tmp) n_lst) tmp nil) );end_while ) ( (/= (rem (length o_lst) grp) 0) (princ "\nModulus Error : The passed list length is not exactly divisible by the group size!!")) );end_cond (if n_lst (reverse n_lst)) );end_defun (vl-load-com) (defun rh:223 (lst / a) (setq a (mapcar '(lambda (x) (reverse (cons 0.0 (reverse x)))) lst))) ;;Object ID (defun c:oid ( / *error* c_doc c_spc sv_lst sv_vals level p0 p1) (defun *error* ( msg ) (mapcar 'setvar sv_lst sv_vals) (if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc)) (if (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (princ (strcat "\nOops an Error : " msg " occurred."))) (princ) );end_*error*_defun (setq c_doc (vla-get-activedocument (vlax-get-acad-object)) c_spc (vlax-get-property c_doc (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace)) sv_lst (list 'osmode 'cmdecho) sv_vals (mapcar 'getvar sv_lst) );end_setq (mapcar 'setvar sv_lst '(0 0)) (setq ss (ssget '((0 . "POINT,CIRCLE,LINE,LWPOLYLINE")))) (cond (ss (if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc)) (vla-startundomark c_doc) (repeat (setq cnt (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq cnt (1- cnt))))) (cond ( (= (vlax-get-property obj 'objectname) "AcDbLine") (setq i_pts (mapcar '(lambda (x) (vlax-get obj x)) (list "startpoint" "endpoint")))) ( (= (vlax-get-property obj 'objectname) "AcDbCircle") (setq i_pts (rh:sammlung_n (vlax-get obj 'center) 3))) ( (= (vlax-get-property obj 'objectname) "AcDbPoint") (setq i_pts (rh:sammlung_n (vlax-get obj 'coordinates) 3))) (t (setq i_pts (rh:223 (rh:sammlung_n (vlax-get obj 'coordinates) 2)))) );end_cond (foreach pt i_pts (setq pt2 (mapcar '+ pt '(1.0 1.0 0.0)) txt (strcat "E=" (rtos (car pt) 2 4) "\\P" "N=" (rtos (cadr pt) 2 4)) ml_obj (vlax-invoke c_spc 'addmleader (append pt pt2) 0) );end_setq (vlax-put-property ml_obj 'textstring txt) (vlax-put-property ml_obj 'textleftattachmenttype 7) (vlax-put-property ml_obj 'textrightattachmenttype 7) );end_foreach );end_repeat (if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc)) ) );end_cond (mapcar 'setvar sv_lst sv_vals) (princ) );end_defun
    1 point
×
×
  • Create New...