Jump to content

Leaderboard

Popular Content

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

  1. hai, i need help.i have a working lisp routine which gives perpendicular line distance to main pline when clicked on a place perpendicular, all i want to add is the leader at the where i click and Easting and Northing and CH. and also instead of TEXT i need MText position where i can click. pls reply if its possible. i've added a screenshot for reference ..... thanks:) (defun c:Chi (/ s p c a d tp sch) (setq sch (getstring "\nSpecify start chainage : <0>")) ;"0" is set as the default value (if (= sch "")(setq sch "0")) (if (and (setq s (car (entsel "\nPick a polyline :"))) (or (= (cdr (assoc 0 (entget s))) "LWPOLYLINE") (alert "Invalid object! Please pick a polyline only.") ) ) (while (and (setq p (getpoint "\nSpecify point perpendicular to polyline :") ) (setq c (vlax-curve-getclosestpointto s p)) (setq a (angle p c)) (not (grdraw p c 1 -1)) ;; rubber line in red colour. (setq d (angle '(0. 0. 0.) (vlax-curve-getfirstderiv s (vlax-curve-getparamatpoint s c) ) ) ) (or (or (equal (rem (+ d (* pi 0.5)) (+ pi pi)) a 1e-4) (equal (rem (+ d (* pi 1.5)) (+ pi pi)) a 1e-4) ) (alert "Picked point is not a perpendicular to picked polyline. <!>" ) ) (setq tp (getpoint "\nSpecify Point for Text : ")) ) (entmakex (list '(0 . "text") '(100 . "AcDbEntity") '(67 . 0) '(370 . 13) '(100 . "AcDbText") (cons 10 tp) (cons 40 0.6) ; Change text height here (cons 1 (strcat "CH=" sch "+" (rtos (vlax-curve-getdistatpoint s c) 2 3) ;3 instead of 4 to specify precision ) ) (cons 71 0) (cons 72 0) (cons 11 '(0 0 0)) '(100 . "AcDbText") (cons 73 0) ) ) ) ) (princ) ) (vl-load-com)
    1 point
  2. I think that this simple request reveals that you do not really understand the complexity of what you are asking for free. Your 'autocad coordinate' is a UTM coordinate which is a plane grid. The 'Decimal Degrees format' is Longitude and Latitude which are lines along the surface of the Earth. The transformation formulae are complex, and not something that a keen volunteer could write in a spare minute. Be reasonable in your requests and do a bit of research into coordinate systems.
    1 point
  3. @Emmanuel Delay @ronjonp Thank you so much Both of you, Both are working perfect and as i wanted. @ronjonpThe foo lisp was working before also but it just adds a line to the nearest block insert (not to the line perpendicular),have attached a snap. Thanks now the code is working as i wanted.
    1 point
  4. I'm using AutoCAD 2020. Give this version a try for dynamic and attributed blocks. (defun c:bs (/ a b n) ;; RJP » 2019-07-23 (if (and (setq a (car (entsel "\nPick block to replace with new: "))) (setq b (car (entsel "\nPick block to be used for replace: "))) (= "INSERT" (cdr (assoc 0 (entget a))) (cdr (assoc 0 (entget b)))) (setq n (vla-get-effectivename (vlax-ename->vla-object a))) (setq b (vlax-ename->vla-object b)) ) (foreach bl (mapcar 'cadr (ssnamex (ssget "_x" (list '(0 . "insert"))))) (cond ((= n (vla-get-effectivename (vlax-ename->vla-object bl))) (entmod (append (entget (vlax-vla-object->ename (vla-copy b))) (vl-remove-if-not '(lambda (x) (member (car x) '(10 41 42 43))) (entget bl)) ) ) (entdel bl) ) ) ) ) (princ) ) (vl-load-com)
    1 point
  5. Seems to work fine here. If your blocks are not dynamic or attributed this could be simplified quite a bit. Not much error checking on selection. (defun c:bs (/ a b) ;; RJP » 2019-07-23 (if (and (setq a (car (entsel "\nPick block to replace with new: "))) (setq b (car (entsel "\nPick block to be used for replace: "))) (setq a (assoc 2 (entget a))) (setq b (assoc 2 (entget b))) ) (foreach x (mapcar 'cadr (ssnamex (ssget "_x" (list '(0 . "insert") a)))) (entmod (subst b a (entget x))) ) ) (princ) )
    1 point
×
×
  • Create New...