guyzen2004 Posted September 13, 2007 Share Posted September 13, 2007 Is there a possibility of creating a lisp routine of making horizontal and vertical lines on a certain structure (say a slab) by just giving the horizontal and vertical distances respectively of the lines. And also the distance of the first and last line from the structure so that it may appear that you are drawing reinforcing bars on a given structure. Quote Link to comment Share on other sites More sharing options...
PS_Port Posted September 13, 2007 Share Posted September 13, 2007 Yes this could be done with lisp, but have you looked at ARRAY , might suit your needs? Quote Link to comment Share on other sites More sharing options...
Guest Alan Cullen Posted September 13, 2007 Share Posted September 13, 2007 I would have to agree with Paul. You can write a lisp, but without thinking too hard about that, you could have problems writting the lisp to cover all the different situations. Whereas, by using commands such as ARRAY, OFFSET, DIVIDE, MEASURE and others, you could achieve the result you want just as easily. Quote Link to comment Share on other sites More sharing options...
guyzen2004 Posted September 13, 2007 Author Share Posted September 13, 2007 Thanks for the help guys. Quote Link to comment Share on other sites More sharing options...
CAB Posted September 14, 2007 Share Posted September 14, 2007 You can play with this old routine. ;;; FUNCTION ArrayPick.lsp ;;; Variation of the Array command, user picks the direction and distance ;;; to fill, then enters or picks the object offset distance ;;; Offset direction angle is 0, 90, 180, or 270 deg only ;;; ;;; ARGUMENTS ;;; none ;;; ;;; USAGE ;;; aPick ;;; ;;; PLATFORMS ;;; 2000+ ;;; ;;; AUTHOR ;;; Copyright© 2004 Charles Alan Butler ;;; ab2draft@TampaBay.rr.com ;;; ;;; VERSION ;;; 1.0 Oct. 01, 2004 ;;; ;;; YOU MAY USE THIS CODE ONLY FOR *NON-COMMERCIAL* ;;; PURPOSES AND ONLY IF YOU RETAIN ;;; THIS HEADER COMPLETE AND UNALTERED ;;; you must contact me if you want to use it commercially ;;; (DEFUN c:apick (/ p1 p2 ss dist inc step) (setq usercmd (getvar "CMDECHO")) (setvar "CMDECHO" 0) (setq useros (getvar "osmode")) (setvar "osmode" 175) (prompt "\nSelect objects to offset.") (if (setq ss (ssget)) (progn (if (setq p1 (getpoint "\n*-* Pick Starting point *-*")) (if (setq p2 (getpoint p1 "\n*-* Pick End point *-*")) (progn (setq step (getdist "\nEnter offset distance. [ENTER=24] ")) (setq step (cond (step) (24))) (setq dist (distance p1 p2) ang (angle p1 p2) inc (1+(fix (/ dist step))) ) (cond ((and (>= ang 0.785) (<= ang 2.36)); array up (command "_.array" ss "" "R" inc "" step) ) ((and (> ang 2.36) (< ang 3.9)); array left (command "_.array" ss "" "R" "" inc (- step)) ) ((and (>= ang 3.9) (<= ang 5.5)); array down (command "_.array" ss "" "R" inc "" (- step)) ) (T ; array right (command "_.array" ss "" "R" "" inc step) ) ) ; end cond stmt ) ; end progn ) ; endif ) ; endif ) ; end progn ) ; endif ;;========== Exit Sequence ============ (setvar "osmode" useros) (setvar "CMDECHO" usercmd) (princ) ) ; end defun (prompt "\nArray Pick Loaded. Enter aPick to run.") (princ) Quote Link to comment Share on other sites More sharing options...
guyzen2004 Posted September 17, 2007 Author Share Posted September 17, 2007 Hey Cab, Thank you for your lisp routine. I really appreciate it. Though simple but helps a lot in my drawing. I hope you have this kind of lisp for irregularly shaped figures. Quote Link to comment Share on other sites More sharing options...
CAB Posted September 17, 2007 Share Posted September 17, 2007 Thanks. That lisp works with any shaped object(s) that the array command works with. The limitation is that it arrays in the 0 & 180 or 90 & 270 direction only. I have another I use if the offset direction is not one of those. If that is not what you were refering to by "irregularly shaped figures" please explain further. ;;; TrussOffsetUCS.lsp ;;; ;;; Author: Copyright© 2005 Charles Alan Butler ;;; Version: 1.0 May 01, 2005 ;;; Purpose: offset objects user offset distance to fill selected area ;;; Modified version of TrussOffset.lsp to use UCS ;;; Will work with any objects ;;; ;;; [Prompts] ;;; Select objects ;;; Enter or select offset distance ;;; Pick start & end point of array distance, these picks establish ;;; direction and total distance, not start & end points. ;;; (defun c:trussoucs (/ *error* p1 p2 ss dist num tmp) ;;; error function & Routine Exit (defun *error* (msg) (if (not (member msg '("console break" "Function cancelled" "quit / exit abort" "") ) ) (princ (strcat "\nError: " msg)) ) ; if (setvar "osmode" useros) (setvar "CMDECHO" usercmd) (princ) ) ; ;end error function (setq usercmd (getvar "CMDECHO")) (setvar "CMDECHO" 0) (setq useros (getvar "osmode")) (setvar "orthomode" 1) (prompt "\nSelect objects to offset") (setq ss (ssget)) (if ss (progn (if (null to_step); global var (setq to_step 24) (setq to_step (abs to_step)) ) (setq tmp (getdist (strcat "\nEnter or pick offset amount. <"(rtos to_step) "> "))) (if tmp (setq to_step tmp) ) (setq p1 (getpoint "Pick Starting point")) (if p1 (progn (setq p2 (getpoint p1 "Pick End point and the axix of offset")) (if p2 (progn (setq dist (distance p1 p2) num (fix (1+(/ dist to_step))) ang (angle p1 p2) ) (if (or (equal ang pi 0.2) (equal ang (* pi 1.5) 0.2) ) (setq to_step (- to_step)); reverse the direction ) (setvar "osmode" 0) (cond ((or (equal ang 0 0.2) ; Horrizontal (equal ang pi 0.2) ) (command "_.array" ss "" "R" "" num to_step) ) ((or (equal ang (/ pi 2) 0.2) ; Vertical (equal ang (* pi 1.5) 0.2) ) (command "_.array" ss "" "R" num "" to_step) ) (t (alert "Under condtruction") (setq p3 (polar p1 (+ (angle p1 p2) (/ pi 2)) 50)) (command "._ucs" "N" "3" p1 p2 p3) ; origin x y (command "_.array" ss "" "R" "" num to_step) (command "_ucs" "P") ) ) ; end cond stmt ) ; end progn ) ; endif ) ; end progn ) ; endif ) ; end progn ) ; endif ;;;========== Exit Sequence ============ (*ERROR* "") (princ); Exit quietly ) ; end defun (prompt "\nOffset Object Loaded. Enter OOS to run.") (princ) Quote Link to comment Share on other sites More sharing options...
guyzen2004 Posted September 19, 2007 Author Share Posted September 19, 2007 Thanks Cab. This lisp is what I'm referring for. Quote Link to comment Share on other sites More sharing options...
CAB Posted September 19, 2007 Share Posted September 19, 2007 You are welcome. Glad it worked for you. Quote Link to comment Share on other sites More sharing options...
rochel1280 Posted June 16, 2010 Share Posted June 16, 2010 can u help me how to use this lisp? i also need this one for reinforcement please.. thanks... Quote Link to comment Share on other sites More sharing options...
ReMark Posted June 16, 2010 Share Posted June 16, 2010 It's like deja vue all over again. Instructions on how to load a lisp routine can be found here: http://www.cadtutor.net/faq/questions/28/How+do+I+use+an+AutoLISP+routine%3F Quote Link to comment Share on other sites More sharing options...
tdtboy04 Posted May 20, 2014 Share Posted May 20, 2014 Hi Cab , I have your old code - Rebar . ;; enter rb and spacebar or enter to run (defun C:RB (/ otm llyr plw ansx dia dod fr) (setq otm (getvar "orthomode")) (setq llyr (getvar "clayer")) (setq plw (getvar "plinewid")) (setq ansx (get_key "LDH" "Press key [L D or H] Line, Donut or Hook? : ")) (if (not ansx) (exit) ; user quit ) (initget 7) (setq dia (getdist "\nEnter rebar size : ")) ;; need size error checking (setvar "clayer" "0") (command "orthomode" "1") (cond ((= ansx "L") (command "plinewid" dia) (command "pline") (while (> (getvar "cmdactive") 0) (command pause)) ) ((= ansx "D") (setq did (getvar "donutid")) (setq dod (getvar "donutod")) (command "donut" "0" dia) (while (> (getvar "cmdactive") 0) (command pause)) (setvar "donutid" did) (setvar "donutod" dod) ) ((= ansx "H") (command "plinewid" dia) (command "pline") (while (> (getvar "cmdactive") 0) (command pause)) (setq fr (getvar "filletrad")) (setvar "filletrad" (* dia 2)) (command "fillet" "p" "last") (command "filletrad" fr) ) ) ; end cond stmt (setvar "clayer" llyr) (setvar "plinewid" plw) (command "orthomode" otm) (princ) ) (prompt "\nEnter rb and spacebar or enter to run.") (princ) ;;-------------------------------------------------------- ;; get a key press, return only if matches filter ;; return nil if Enter is pressed (defun get_key (keys msg / key KeyCode Lp) (setq keys (append (vl-string->list (strcase keys)) (vl-string->list (strcase keys t)) ) ) (setq Lp t) (while Lp ; Main Loop (prompt (strcat "\n" msg)) (setq Key nil) (while (= Key nil) ; Loop here until a key is pressed (setq Key (grread nil 2)) ; get a key press ) ;; Process the key press (if (= (car key) 2) ; Skip if not a KeyPress (progn (setq KeyCode (cadr Key)) ; Set ASCII Key Code (cond ((= KeyCode 13) ; ENTER key pressed (setq KeyCode nil Lp nil) ; Exit Loop ) ((member KeyCode keys) ; got a hit (setq Lp nil) ; Exit Loop ) ) ; end cond stmt ) ; progn ) ; Endif ) ;End While (if keyCode (strcase (chr keyCode)) ) ) ; end defun can you add the offset for rebar (concrete cover) . Ex : 10 , 15 , 20 , 25 mm ...... THANKS YOU ! Quote Link to comment Share on other sites More sharing options...
Abdulellah Posted November 24, 2019 Share Posted November 24, 2019 (edited) hello . i am new at this forum can you help me to write lisp . thanks for all worthily efforts abdulellah.alattab@gmail.com Edited November 24, 2019 by Abdulellah Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.