Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/25/2020 in all areas

  1. You can pick numerical text and get its value "\nEnter the existing level: " ;;-------------------=={ Parse Numbers }==--------------------;;` ;; ;; ;; Parses a list of numerical values from a supplied string. ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; s - String to process ;; ;;------------------------------------------------------------;; ;; Returns: List of numerical values found in string. ;; ;;------------------------------------------------------------;; (defun LM:ParseNumbers ( s ) ( (lambda ( l ) (read (strcat "(" (vl-list->string (mapcar (function (lambda ( a b c ) (if (or (< 47 b 58) (and (= 45 b) (< 47 c 58) (not (< 47 a 58))) (and (= 46 b) (< 47 a 58) (< 47 c 58)) ) b 32 ) ) ) (cons nil l) l (append (cdr l) (list nil)) ) ) ")" ) ) ) (vl-string->list s) ) ) (setq RL (car (LM:ParseNumbers (cdr (assoc 1 (entget (car (entsel "\nPick text"))))))))
    1 point
  2. Hsanon had a think about this, a couple of suggestions, use my Multi getvals.lsp as you can set the default value so handy in a repeated requirement, you can save the last entry and use it again. It can be one line or as many as required so Wall ht, Sill ht, Window ht etc can be entered and saved. Pi is a valid value in lisp returning 3.141593.... (dtr 0) is not necessary as its 0.0 (dtr 90) is (/ pi 2.0) or (setq d90 (/ pi 2.0)) and use d90 (dtr 180) is pi
    1 point
  3. ;;; as function with path hard coded (defun C:AddToolPalettePath ( / _pimp pFiles CurToolPath NetToolPath) (vl-load-com) (defun _pimp (s) (strcase (vl-string-trim " ;\\" (vl-string-translate "/" "\\" s)))) (setq pFiles (vla-get-files (vla-get-preferences (vlax-get-acad-object)))) (setq CurToolPath (_pimp (vla-get-ToolPalettePath pFiles))) (setq NetToolPath (_pimp "I:\\_CAD STANDARDS\\100 - CAD SUPPORT FILES\\200 - SUPPLEMENTARY FILES\\TOOL PALETTES")) (if (not (vl-string-search NetToolPath CurToolPath)) (vla-put-toolPalettePath pFiles (strcat CurToolPath ";" NetToolPath))) (princ) ) ;;; or as subfunction with argument : ;;; (_AddToolPalettePath "I:\\_CAD STANDARDS\\100 - CAD SUPPORT FILES\\200 - SUPPLEMENTARY FILES\\TOOL PALETTES") (defun _AddToolPalettePath ( $tp / _pimp pFiles CurToolPath NetToolPath) (vl-load-com) (defun _pimp (s) (strcase (vl-string-trim " ;\\" (vl-string-translate "/" "\\" s)))) (setq pFiles (vla-get-files (vla-get-preferences (vlax-get-acad-object)))) (setq CurToolPath (_pimp (vla-get-ToolPalettePath pFiles))) (setq NetToolPath (_pimp $tp)) (if (not (vl-string-search NetToolPath CurToolPath)) (vla-put-toolPalettePath pFiles (strcat CurToolPath ";" NetToolPath))) (princ) )
    1 point
  4. You only need to run this once as the file paths are stored in the registry. If you add it to your acad.lsp file it will add another duplicate line to the setting every time your acad.lsp runs. (vla-put-toolPalettePath pFiles (strcat tpPaths ";" tpPath)) ;;add your new path to the string dividing paths with a ";" The comment to this line means that you must separate individual paths using a semi-colon. The function does this automatically for a single path but if you want to feed it a string of more than one path the individual paths within the string must be separated using a semi-colon
    1 point
  5. The last code I posted does. Don't use that short snippet. Use the example HERE as a base.
    1 point
  6. the code ronjonp made is just an example on how to append multiple paths to the existing one. If you run it multiple times it will append multiple times. In this case indeed you would need to check if the path was already added or not. The last code you posted creates a new one (resets) that's made up from 2 paths only C:\Users... + I:\_CAD... , so this you can run as much a you like. Don't know why the vla-code doesn't work for you because on my computer nos problemos??
    1 point
  7. Try something like this: (defun _addtoolpalettepaths (paths / a b) (setq b (getvar (setq a "*_toolpalettepath"))) (setvar a (strcat b (apply 'strcat (mapcar '(lambda (x) (if (vl-string-search (strcase x) (strcase b)) "" (strcat ";" x) ) ) paths ) ) ) ) ) ;; usage (_addtoolpalettepaths '("c:\\path1" "d:\\path2")) *EDIT .. needed to check if path exists or it keeps duplicating.
    1 point
×
×
  • Create New...