gazzalp Posted December 14, 2008 Share Posted December 14, 2008 id like a lisp that would add a band beam to a plan. the way i see it working is i select a grid, it offsets a line 1200mm to each side on a layer called concrete, and set to linetype "awthidden2". Id like it to also automatically add the dimension of 2400, as well as a block we have called SYM-SlabTag (not sure if this one is do-able, and if it is if the person writing the lisp needs to see the block) Quote Link to comment Share on other sites More sharing options...
asos2000 Posted December 14, 2008 Share Posted December 14, 2008 Could you upload a sample Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 14, 2008 Share Posted December 14, 2008 If you could upload a sample of what you want to accomplish - and the block would really help to understand what is going on. Quote Link to comment Share on other sites More sharing options...
gazzalp Posted December 14, 2008 Author Share Posted December 14, 2008 Here you go. For now i just have put it all on one dwg, but what would actually happen ios the grid will be on an xref, all the other items i want on the new drawing. So i will open a new drawing with nothing on it, xref in the grid, start the lisp and it will ask for the grid, i select the grid (select top and bottom of grid) and it puts the two green lines on (1200 each side of grid) with the dimension and "slab tag" Thanks guys test.dwg Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 14, 2008 Share Posted December 14, 2008 It will be really hard to offset lines each side of an Xref - that is the trouble I am finding. Because, obviously with a block one is unable to offset any lines off of the block itself. Quote Link to comment Share on other sites More sharing options...
gazzalp Posted December 16, 2008 Author Share Posted December 16, 2008 I kind of worded it bad; it doesnt necisserily have to offset those lines. The way i see it is we have a grid line, The lisp could ask us for the centre line (pick the bottom and top most points of the grid) then it knows the outside most lines will be 1200 either side of the points we picked. Then in the middle add tjhe dimension and tag. In a way its like a multiline, where theres 2 lines that are dashed and the centre of that multiline is the grid (except i dont want a multiline, thats just an example) hope this clears things up. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 16, 2008 Share Posted December 16, 2008 Try this: (defun c:gridline (/ *error* varLst oldVars tpt bpt ang llpt l1 lrpt l2 l1mid l2mid) ; --- Error Trap --- (defun *error* (msg) (mapcar 'setvar varLst oldVars) (if (= msg "") (princ "\nFunction Complete.") (princ "\nError or Esc pressed... ") ) ;_ end if (princ) ) ; end of *error* (setq varLst (list "CMDECHO" "CLAYER" "OSMODE") oldVars (mapcar 'getvar varLst) ) ; end setq ; --- Error Trap --- (setvar "cmdecho" 0) (defun makelay (x) (if (not (tblsearch "Layer" x)) (command "-layer" "m" x "") ) ;_ end if ) ;_ end defun (if (and (setq tpt (getpoint "\nSelect Top Point of Gridline: ")) (setq bpt (getpoint "\nSelect Base Point of Gridline: ")) ) ;_ end and (progn (setq ang (angle tpt bpt)) (setvar "osmode" 0) (makelay "Concrete") (setvar "clayer" "Concrete") (command "_line" (setq llpt (polar tpt (+ ang (/ pi 2)) 1200)) (polar llpt ang (distance tpt bpt)) "" ) ;_ end command (setq l1 (entlast)) (command "_line" (setq lrpt (polar tpt (- ang (/ pi 2)) 1200)) (polar lrpt ang (distance tpt bpt)) "" ) ;_ end command (setq l2 (entlast)) (command "_chprop" l1 l2 "" "lt" "awthidden2" "") (setq l1mid (polar llpt ang (/ (distance tpt bpt) 2))) (setq l2mid (polar lrpt ang (/ (distance tpt bpt) 2))) (makelay "Dimensions") (setvar "clayer" "Dimensions") (command "_dimaligned" l1mid l2mid l1mid) (alert "\nI'm not sure what you would like done with the block... \nCheers \nLee Mac." ) ;_ end alert ) ;_ end progn (alert "\nProgram Requires Two Selected Points.") ) ;_ end if (*error* "") ) ;_ end defun Quote Link to comment Share on other sites More sharing options...
gazzalp Posted December 16, 2008 Author Share Posted December 16, 2008 Awesome Lee, you are a champion. Only thing is it doesnt insert the block (which you know about because it came up with the dialog box telling me) all i want with the block is it to be inserted under the dimension, in the middle of the band (as long as it doesnt clash with the dimension it should be fine). Is this possible?thanks for your help. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 16, 2008 Share Posted December 16, 2008 Awesome Lee, you are a champion. Only thing is it doesnt insert the block (which you know about because it came up with the dialog box telling me) all i want with the block is it to be inserted under the dimension, in the middle of the band (as long as it doesnt clash with the dimension it should be fine). Is this possible?thanks for your help. I can add that, but is the block stored under a specific filepath, or just in th ACAD search directory? If its in the search directory, I'll just need the block name, if its somewhere else, I'll need the block name and full filepath to add to the LISP. Or I can leave that part blank for you to fill in. Quote Link to comment Share on other sites More sharing options...
gazzalp Posted December 17, 2008 Author Share Posted December 17, 2008 Dont have alot of time now to look for it, but if you leave the areas i need to fill in (maybe put in bold something like add file path/name here) that way i wont have to bother you again asking where to put it Quote Link to comment Share on other sites More sharing options...
gazzalp Posted December 17, 2008 Author Share Posted December 17, 2008 Lee, the block is in a folder that is located on our server, so im guessing i need the file path... If you leave the part blank and let me know what to fill in where i should be able to handle that. Thanks alot Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 17, 2008 Share Posted December 17, 2008 Try this: (defun c:gridline (/ *error* varLst oldVars tpt bpt slab ang llpt l1 lrpt l2 l1mid l2mid blkpt) ; --- Error Trap --- (defun *error* (msg) (mapcar 'setvar varLst oldVars) (if (= msg "") (princ "\nFunction Complete.") (princ "\nError or Esc pressed... ") ) ;_ end if (princ) ) ; end of *error* (setq varLst (list "CMDECHO" "CLAYER" "OSMODE") oldVars (mapcar 'getvar varLst) ) ; end setq ; --- Error Trap --- (setvar "cmdecho" 0) (defun makelay (x) (if (not (tblsearch "Layer" x)) (command "-layer" "m" x "") ) ;_ end if ) ;_ end defun (if (and (setq tpt (getpoint "\nSelect Top Point of Gridline: ")) (setq bpt (getpoint "\nSelect Base Point of Gridline: ")) (setq slab (getstring t "\nSpecify Slab Thickness: ")) ) ;_ end and (progn (setq ang (angle tpt bpt)) (setvar "osmode" 0) (makelay "Concrete") (setvar "clayer" "Concrete") (command "_line" (setq llpt (polar tpt (+ ang (/ pi 2)) 1200)) (polar llpt ang (distance tpt bpt)) "" ) ;_ end command (setq l1 (entlast)) (command "_line" (setq lrpt (polar tpt (- ang (/ pi 2)) 1200)) (polar lrpt ang (distance tpt bpt)) "" ) ;_ end command (setq l2 (entlast)) (command "_chprop" l1 l2 "" "lt" "awthidden2" "") (setq l1mid (polar llpt ang (/ (distance tpt bpt) 2))) (setq l2mid (polar lrpt ang (/ (distance tpt bpt) 2))) (makelay "Dimensions") (setvar "clayer" "Dimensions") (command "_dimaligned" l1mid l2mid l1mid) (setq blkpt (polar tpt ang (- (/ (distance tpt bpt) 2) 1000))) (command "-insert" [b][color=Red]"C:\..." ; << Filepath goes here[/color][/b] blkpt "" "" "0.0" slab) ) ;_ end progn (alert "\nProgram Requires Two Selected Points.") ) ;_ end if (*error* "") ) ;_ end defun REMEMBER: when you specify a filepath, use double \\ to indicate one backslash. i.e C:\\Users\\Lee Mac\\Documents\\block.dwg Quote Link to comment Share on other sites More sharing options...
gazzalp Posted December 17, 2008 Author Share Posted December 17, 2008 Ok its making more sense to me now.... Two problems - could we possibly change it so the block that is inserted goes on a layer called "Tags" and also scales to 100 (it inserts at 1) Thanks Lee Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 17, 2008 Share Posted December 17, 2008 Ok its making more sense to me now.... Two problems - could we possibly change it so the block that is inserted goes on a layer called "Tags" and also scales to 100 (it inserts at 1) Thanks Lee Try this: (defun c:gridline (/ *error* varLst oldVars tpt bpt slab ang llpt l1 lrpt l2 l1mid l2mid blkpt) ; --- Error Trap --- (defun *error* (msg) (mapcar 'setvar varLst oldVars) (if (= msg "") (princ "\nFunction Complete.") (princ "\nError or Esc pressed... ") ) ;_ end if (princ) ) ; end of *error* (setq varLst (list "CMDECHO" "CLAYER" "OSMODE") oldVars (mapcar 'getvar varLst) ) ; end setq ; --- Error Trap --- (setvar "cmdecho" 0) (defun makelay (x) (if (not (tblsearch "Layer" x)) (command "-layer" "m" x "") ) ;_ end if ) ;_ end defun (if (and (setq tpt (getpoint "\nSelect Top Point of Gridline: ")) (setq bpt (getpoint "\nSelect Base Point of Gridline: ")) (setq slab (getstring t "\nSpecify Slab Thickness: ")) ) ;_ end and (progn (setq ang (angle tpt bpt)) (setvar "osmode" 0) (makelay "Concrete") (setvar "clayer" "Concrete") (command "_line" (setq llpt (polar tpt (+ ang (/ pi 2)) 1200)) (polar llpt ang (distance tpt bpt)) "" ) ;_ end command (setq l1 (entlast)) (command "_line" (setq lrpt (polar tpt (- ang (/ pi 2)) 1200)) (polar lrpt ang (distance tpt bpt)) "" ) ;_ end command (setq l2 (entlast)) (command "_chprop" l1 l2 "" "lt" "awthidden2" "") (setq l1mid (polar llpt ang (/ (distance tpt bpt) 2))) (setq l2mid (polar lrpt ang (/ (distance tpt bpt) 2))) (makelay "Dimensions") (setvar "clayer" "Dimensions") (command "_dimaligned" l1mid l2mid l1mid) (setq blkpt (polar tpt ang (- (/ (distance tpt bpt) 2) 1000))) (makelay "Tags") (setvar "clayer" "Tags") (command "-insert" [b][color=Red]"C:\..." ; << Filepath goes here[/color][/b] blkpt "100" "100" "0.0" slab) ) ;_ end progn (alert "\nProgram Requires Two Selected Points.") ) ;_ end if (*error* "") ) ;_ end defun Quote Link to comment Share on other sites More sharing options...
gazzalp Posted December 18, 2008 Author Share Posted December 18, 2008 Excellent Lee, works perfect. Thanks alot Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 18, 2008 Share Posted December 18, 2008 No probs, happy to help. 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.