;***********************************************************************************************
;Routine to label Point Elevation.
;Command function Name: PZ
;Written by Jean Marie Vianney on June 3/ 2013.
;Last Modified on Jan 5th, 2019 by JM
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Revamped routine to prompt the user
; 1. Precision
; 2. Show the word "Elev.="
;Added scale from insertion by cannoscale setting
; error to handle nil entry an notify the user.
;_______________________________________________________________________________________________
;****Note: -the routine uses text styles
; ML 2.0 Italic
(defun CheckForText
(/ *error* bNameLoc cmd
) ;error handling (compliments of Lee Mac) ;(command "_.LAYER" "S" cl "") ;curent layer hasn't changed or been set yet in LabelPointElev
;(setvar 'clayer (car vals))
(if (not (member msg '
( "Function cancelled" "quit / exit abort"))) ) ;if
)
(load "StealFromTemplate.lsp") (Steal "C:\\MySync\\CAD\\ML_20\\Templates\\ML-C3D20-VO-PR-m.dwt" '(( "Text Styles" ( "*"))))
)
)
(defun setOffsetYByCannoscale_SetVar_h
() ;;2022-06-13
;; use cannoscale to calc the insertion point distance from the line
; Example: 1:1000
; 6 == 1:1000 == 6 characters
; 1000, string to float, 3rd position from 1, substring of cannoscale
(setq h
(* (/ denominator
1000) 1)) ; expected value for 1:1000 = 1, 1:100 = 0.1
; h is the offset y of the new label
) ;(Defun setOffsetYByCannoscale_SetVar_h
(defun c:LabelPointElev
(/ vars vals x rep pt pt2 llb
) ;Error Function
(princ "\nUser Environment restored.") (if (not (member msg '
( "Function cancelled" "quit / exit abort"))) ) ;if
)
(CheckForText)
(setOffsetYByCannoscale_SetVar_h)
(setq vars '
( "CLAYER" "OSMODE" "OSNAPZ" "TEXTSTYLE") ;list of variables )
(or global:ans
(setq global:ans
2)) ;if global:ans is nil it will be set to 2 (setq global:ans x
) ;update for next time ((getkword "\nShow \"Elev.=\" in the string? [Yes/No] <Yes>: ")) ("Yes") )
)
)
(setvar 'clayer
"V-TOPO-ANNO-SPOT") (entmake '
((0 .
"LAYER") (100 .
"AcDbSymbolTableRecord") (100 .
"AcDbLayerTableRecord") (2 .
"V-TOPO-ANNO-SPOT") (70 .
0) (62 .
7))) (setvar 'clayer
"V-TOPO-ANNO-SPOT") )
)
(setq pt2
(list (+ (car pt
) (* h
1.5)) (- (cadr pt
) 0))) ;; set offset from insertion point '(100 . "AcDbEntity")
'(100 . "AcDbMText")
'(71 . 4)
'(72 . 1)
'(7 . "ML 2.0 Italic")
'(42 . 0)
)
)
)
)