Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/24/2024 in all areas

  1. "if it is possible to modify LeeMac's wonderful Arealabel lisp " The answer is yes but it is always best to ask the author first about possible changes to his or her code as a sign of respect, Lee has a contact me on his website and he often responds here. The Bpoly command will make a boundary for the area, you can then use this to hatch the area with a solid pattern.
    2 points
  2. If you have multiple wall sizes that you use all the time you could make a list of lists with the wall sizes, I know I push my Multi radio buttons & Multi getvals lisp's, but using these would let you quickly choose preset wall sizes. The reason I mention Multi getvals.lsp as a second step is it allows you to change any of the values when setting the wall thickness. You could do a custom dcl left side radio buttons right side edit box shows values that have been selected from the radio button. Multi's posted many times here. (setq walls (list (list "BRK-CAV-INNER-PLAS" 102.5 252.5 467.5 485.5)(list "STD-CAV" 102 180 270 288)))
    1 point
  3. @3dwannab That's cool - I completely understand. Glad you could alter the code to fit your needs!
    1 point
  4. Hi Use a while loop to re-open the dialog if "Select" button is picked. Like this (defun c:OpenDCLDialog ( / dcl_id dclflag dst) (setq dclflag 2) (if (and (setq dcl_id (load_dialog "example_dialog.dcl")) (> dcl_id 0) ) (progn (while (> dclflag 1) (new_dialog "example_dialog" dcl_id) (if dst (set_tile "distance" dst)) (action_tile "distance" "(setq dst $value)") (action_tile "select_btn" "(done_dialog 2)") (action_tile "ok_btn" "(done_dialog 1)") (setq dclflag (start_dialog)) (if (and (= dclflag 2) (setq dst (:select)) ) (setq dst (rtos dst)) ) );while (unload_dialog dcl_id) (if (= dclflag 1) (distof dst) ) );progn ) ) (defun :select () (setq entity (car (entsel "\nSelect an entity: "))) (setq ponto (assoc 10 (entget entity))) (setq dist (getdist (cdr ponto) "Distance: ")) ;;vou fazer algo aqui )
    1 point
  5. The reason for the edit was I am working on a cavity wall 102.5 outer brick leaf / 150 cavity / 215 inner leaf / 18mm plaster so that would translate to 102.5 252.5 467.5 485.5. That would give an aspirin a headache trying to remember that, well me anyway!!
    1 point
  6. I've just tried to change this to offset from the original line. If I enter 100 200 as the offset, i was looking for the first offset to be 100 and then the other 300 (100+200). So, if I enter 100 150 100 it will draw me a cavity wall with 100 inner leaf/150 cavity/100 outer leaf. I thought by adding (setq n (+ n n) in the foreach loop it would do that. (foreach n (mapcar 'distof tl) ;; Not worky (setq n (+ n n)) (setq t1 (car (vlax-invoke ob "offset" (+ n n))) t2 (car (vlax-invoke ob "offset" (- n))) ) (if (< (distance op (vlax-curve-getclosestpointto t1 op)) (distance op (vlax-curve-getclosestpointto t2 op)) ) (vla-delete t2) (vla-delete t1) ) ) Fixed it. Added revision edit in the header. Thanks again @pkenewell for this. It's a huge timesaver. ;|============================================================== moff.lsp by Phil Kenewell - 2/23/2024 Description: This routine contains the command MOFF, or Multiple Offset. It allows you to enter multiple offset distances, separated by spaces and will offset all those distances to the side you specify. Some code Inspired by: RonJonP: https://www.theswamp.org/index.php?topic=24688.msg297553#msg297553 Lee Mac: https://www.theswamp.org/index.php?topic=32743.0 Last Update: - 2024.02.23: Changed using "atof" to "distof" to allow fractions, etc. - 2024.10.23: (Edit by 3dwannab) - Change the offset to offset incrementally. - Entering 100 150 100 will draw a cavity wall with a 100 inner leaf/150 cavity/100 outer leaf. - Command is now moffi to reflect the change to an incremental multiple offset. - Added undo handling. ===============================================================|; (defun c:moffi (/ *error* _strparse ds ob op s t1 t2 tl inc) (defun *error* (errmsg) (and acDoc (vla-EndUndoMark acDoc)) (and errmsg (not (wcmatch (strcase errmsg) "*CANCEL*,*EXIT*")) (princ (strcat "\n<< Error: " errmsg " >>\n")) ) (setvar 'cmdecho var_cmdecho) (setvar 'osmode var_osmode) ) ;; Start the undo mark here (setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object))) (or (vla-EndUndoMark acDoc) (vla-StartUndoMark acDoc)) ;; Sub function to Parse a string by the specified delimiter. (defun _StrParse (str del / pos) (if (and str del) (if (setq pos (vl-string-search del str)) (cons (substr str 1 pos) (_StrParse (substr str (+ pos 1 (strlen del))) del)) (list str) ) ) ) (if (and (setq ds (getstring t (strcat "\nEnter Distances separated by spaces: <" (if pjk:offdist pjk:offdist "") ">")) ds (if (= ds "") pjk:offdist (setq pjk:offdist ds)) ) (/= ds "") (setq tl (_Strparse ds " ")) (> (apply '+ (mapcar 'distof tl)) 0.0) ) (if (and (setq s (entsel "\nSelect a curve to offset: ")) (setq ob (vlax-ename->vla-object (car s))) ) (if (not (vlax-method-applicable-p ob 'Offset)) (princ "\nInvalid object for Offset. ") (if (setq op (getpoint (cadr s) "\nSelect side to Offset: ")) (progn ;; Make sure the offset side point at the outside of the offset zone. (setq op (polar (cadr s) (angle (cadr s) op) (apply '+ (mapcar 'atof tl)))) (setq inc 0.0) ; Initial value of i as a float ;; iterate for each dist (foreach n (mapcar 'distof tl) (setq inc (+ inc n)) ; Increment n by each element in the list so the offset happens incrementally (setq t1 (car (vlax-invoke ob "offset" inc)) t2 (car (vlax-invoke ob "offset" (- inc))) ) (if (< (distance op (vlax-curve-getclosestpointto t1 op)) (distance op (vlax-curve-getclosestpointto t2 op)) ) (vla-delete t2) (vla-delete t1) ) ) ) ) ) ) (progn (setq pjk:offdist nil) (princ "\nInvalid Distances Entered.") ) ) (vla-EndUndoMark acDoc) (*error* nil) (princ) ) ;;(c:moffi) ;;; Unblock for testing
    1 point
  7. Yeah, sure. With NENTSEL you van select nested items: for example items inside a XREF or Block. Here's a function that turns off layers of selected nested items. Command LOFF, for Layers OFF Command NLAYISO for the question you asked for ;; @see https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/turning-off-layers-in-autolisp/td-p/6339611 (DEFUN LAYER_OFF (mylayer on_off / Layoff ) ;;(setq Layoff(getstring "\Should the Layer C165-C345-EBENE turned off? (j/n): ")) (setq Layoff "Y") (if (or (= Layoff "j") (= Layoff "J") (= Layoff "y") (= Layoff "Y")) (if (/= (tblsearch "layer" mylayer) nil) ;;(command "_layer" "_off" mylayer "") (command "_layer" on_off mylayer "") ;;(princ mylayer) );IF );IF );DEFUN LAYER_OFF ;; Turns off layers of NENTSEL selection, of the layer of nested objects (defun c:loff ( / sel obj lay lst) (while (setq sel (nentsel "Select object: ")) (setq obj (car sel)) (setq lay (cdr (assoc 8 (entget obj)))) (LAYER_OFF lay "_off") ) ) ;; nLayiso for Nested Layiso (defun c:nLayiso ( / blk sel obj lay lst) (setq lst (list)) (while (setq sel (nentsel "\nSelect object: ")) (setq obj (car sel)) (setq lay (cdr (assoc 8 (entget obj)))) (setq lst (append lst (list lay))) (princ lay) ) ;; loop over all layers in the drawing (vlax-for lyr (vla-get-layers (vla-get-activedocument (vlax-get-acad-object) ) ) (setq lay (vla-get-name lyr)) ;; exclude current layer (if (/= lay (getvar "CLAYER")) ;; IF layer is in lst then turn on, else turn off (if (member lay lst) (LAYER_OFF lay "_on") (LAYER_OFF lay "_off") ) ) ) ) Happy with this?
    1 point
  8. For try, this exemple? (defun c:foo ( / ss l c n dxf_ent elev) (setq ss (ssget "_X" '((0 . "LWPOLYLINE") (8 . "Terrain - Cont. - Contours")))) (cond (ss (setq l '(0.5 1.0 2.0 5.0 10.0 25.0 50.0 100.0) c '(8 7 6 5 4 3 2 1) ) (repeat (setq n (sslength ss)) (setq dxf_ent (entget (ssname ss (setq n (1- n)))) elev (read (rtos (cdr (assoc 38 dxf_ent)) 2 1)) ) (mapcar '(lambda (x) (if (and (zerop (rem elev (car x))) (null (assoc 62 dxf_ent))) (progn (setq dxf_ent (subst (cons 8 (strcat "_NB-MajorLine_" (if (eq (car x) (fix (car x))) (rtos (car x) 2 0) (rtos (car x) 2 1)))) (assoc 8 dxf_ent) dxf_ent ) ) (entmod (append dxf_ent (list (cons 62 (cdr x))))) ) ) ) (mapcar 'cons l c) ) ) ) ) )
    1 point
×
×
  • Create New...