Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/20/2019 in all areas

  1. Thanx @BIGAL , @Cad64 & @rkmcswain for your quick response.... issue has been resolved FILEDIA worked.
    1 point
  2. (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) There's surely a better way to do it, but this works for me.
    1 point
  3. Quick one: (defun c:SetLayer (/ name col) (if (setq name (getstring t "New layer name: ")) (if (tblsearch "LAYER" name) (progn (prompt "Layer already exists, set as current.") (setvar "CLayer" name)) (if (setq col (acad_colordlg 7 nil)) (progn (entmake (list '(0 . "LAYER") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLayerTableRecord") '(70 . 0) (cons 2 name) (cons 62 col))) (prompt "Layer created and set current.") (setvar "CLayer" name))))) (princ))
    1 point
×
×
  • Create New...