Leaderboard
Popular Content
Showing content with the highest reputation on 10/25/2022 in all areas
-
I'm going to give you a load of work mhupp..... zoom to each entity in the selection set and get the OP to confirm 'delete' or not, then once the selection set is empty, deleted everything, delete the layer? Can't have it both ways, delete the layer and everything or select the items and confirm them one at a time to delete2 points
-
What about Laydel. (command "-laydel" "Name" (cdr (assoc 8 (car (entesel "\nPick object for layer ")))) "" "Y")2 points
-
Here is mine This allows you to just select with the mouse. and then prompts "Delete Contents and Layer: "layer name" [<Yes>/No]: " with the default answer being yes so you can just enter/right click. only changes current layer if its the one being deleted. ;;----------------------------------------------------------------------------;; ;; Delete everything on and the layer itself (defun c:Del-layer (/ lay SS rep e) (setq lay (cdr (assoc 8 (entget (car (entsel)))))) (setq SS (ssget "_X" (list (cons 8 lay)))) (sssetfirst nil ss) (initget "Yes No") (setq rep (cond ((getkword (strcat "\nDelete Layer \"" lay "\" & " (rtos (sslength ss) 2 0) " Entity's: [<Yes>/No]: "))) ("Yes") ) ) (cond ((= rep "Yes") (if (eq (getvar 'clayer) lay) (setvar 'clayer "0") ) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) (vla-delete (vlax-ename->vla-object ent)) ;will delete even if in another paper space. ) (setq e (tblobjname "layer" lay)) (vla-delete (vlax-ename->vla-object e)) (prompt (strcat "\nLayer " lay " Deleted")) ) ) (princ) )2 points
-
@mhupp, Don't forget about object residing in blocks and nested blocks that are residing in the same layer. They will also need to be deleted before you can proceed to delete a layer. In which case I thought LAYDEL has all the calculations worked out already. You can still make improvements, but instead of looping through each object and deleting, simply using (command "_LAYDEL") I feel is more bulletproof: (defun c:foo ( / ent ly op ss) (and (setq ent (car (entsel "\nSelect object whose layer will be deleted <exit>: "))) (setq ly (assoc 8 (entget ent)) ss (ssget "_X" (list ly))) (progn (sssetfirst nil ss) (initget "Yes No") (setq ly (cdr ly) op (cond ((getkword (strcat "\n" (itoa (sslength ss)) " items to be deleted from layer \"" ly "\". Proceed? [Yes/No] <Yes>: "))) ("Yes")) ) (eq op "Yes") ) (progn (if (eq ly (getvar 'clayer)) (setvar 'clayer "0")) (command "_-laydel" "_Name" ly "" "Yes") ) ) (princ) )1 point
-
Thanks. This is what I'm after. I also found a multi measure lisp to make it easier. Thanks a lot.1 point
-
Might want to look at chainage then, this might help https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-Core/files/GUID-1520C3C9-34CB-4AE0-A344-173047F1EEC5-htm.html1 point
-
I dont have whatsapp ! Don't intend to get it either. Nor will I get all the other ones as well. Like Zoom,Ms-Teams, we-transfer, Blockbox and cloud services its a end user preference which ones you use, if you have a company phone I would expect you will have email.1 point
-
Haha, BIGAL beat me to it... I was gonna say there's the LAYDEL command. You don't even need a LISP routine for this.1 point
-
Like Steven P most people have email on their phone so yes can send an email from Autocad. Yes have been in the situation of surveyor on phone asking for a couple of points XY just read out the big numbers.1 point
-
Copied this in the depths of time, sorry no reference to where it came from. This deletes and then purges all objects on a layer doing what you want so long as there are no elements for example in a block that are on the specified layer. Can change this to have an 'entsel' an entity and grab the layer name from using assoc and 8, though I am sure someone will have this all set up, this will give you a start (defun c:laydelLayerNamw (/ ent l_name ss cntr amt ssent) (setq MyLayer "LayuerName") (setvar 'clayer "0") (progn (setq ss (ssget "X" (list (cons 8 MyLayer))) ;; create a selection set of all entites on layer cntr (1- (sslength ss)) ;; set 'cntr' to number of items in selection set amt (itoa cntr) ;; make a string from an integer ) ;; does the sel set have anything in it (if (> cntr 1) (while (>= cntr 0) ;; as long as 'cntr' is greater than or equal to 0 keep looping (setq ssent (ssname ss cntr)) ;; extract the ename from the sel set (entdel ssent) ;; delete that entity (setq cntr (1- cntr)) ;; subtract 1 from cntr ) ) ) (command "zoom" "all" "zoom" ".95x") (command "_.purge" "LA" MyLayer "N") (princ (strcat "\nErased " amt " items")) (princ) )1 point
-
Web server ? https://www.cadtutor.net/forum/topic/56527-connect-to-web-server-via-lisp/1 point
-
@skvl I think the best way to learn a CAD program is to have a specific drawing/model you wish to create. It will force you to learn about AutoCAD features that are most relevant to the type of work you do. Of course, if you are totally new to the program you'll need help in learning the basics. I'd concentrate on 2D for a while before heading into 3D use. A quick search at Amazon turned up this book. You can get a feel if it suits your needs by clicking "Look Inside". You can try it out for free for a beginning lesson! Good luck and post any questions you may have on this forum. You will get a lot of free advice. Lee1 point
-
This does e-mail 9set up as outlook) Not sure why you would want whatsapp, isn't that a chat thing and unless you set up a system to receive messages you kind of lose half its functionality. From my experience they cannot get a desktip only system working - it is all via a mobile phone - so I doub't you'd be able to set it up to work via a third part application like AutoCAD. Last comment is that we would get lots of hassles - I am not sure whatsapp is secure enough to send confidential project information about the internet1 point
-
I had a look at Kindle ebooks just search Autocad found lots of books, some very cheap. I have some and using kindle is easy. George Omura was there.1 point
-
Buy a good after-market book by a respected author is one such method. Ex. - Mastering AutoCAD series by Brian C. Benton and George Omura. The other? Practice, practice, practice. It's how you get good at anything in life.1 point
-
Someone asked me for a modified version so I'm posting it here with thanks to Lee Mac. prompts for maximum movement distance allows MTEXT and Civil 3D Cogo Points only modifies group code 10 or 11, not both ;; Text 2 Point - Lee Mac 2012 ;; Prompts for a selection of Text and Point entities and moves ;; each Text entity to the nearest (2D distance) Point entity in the set. ;; ;; Retains existing Text elevation. (defun c:txt2pt ( / _textinsertion _pointinsertion di1 di2 dxf dcd ent entname inc ins lst mpt mrd pnt sel txt ) (setq mrd 10.0) ;; Maximum permissible distance (defun _textinsertion ( elist ) (if (or (= "MTEXT" (cdr (assoc 0 elist))) (and (zerop (cdr (assoc 72 elist))) (zerop (cdr (assoc 73 elist))) ) ) (assoc 10 elist) (assoc 11 elist) ) ) (defun _pointinsertion ( ename elist / vp res ) (if (= "AECC_COGO_POINT" (cdr (assoc 0 elist))) (setq vp (vlax-ename->vla-object ename) res (list (vlax-get-property vp 'Easting) (vlax-get-property vp 'Northing) (vlax-get-property vp 'Elevation))) (setq res (cdr (assoc 10 elist))))) (setq mrd (cond ((getreal (strcat "\nMaximum move distance <" (rtos mrd 2 1) ">: "))) (mrd) ) ) (princ "\nSelect point and text objects...\n") (if (setq sel (ssget "_:L" '((0 . "POINT,TEXT,AECC_COGO_POINT,MTEXT")))) (progn (repeat (setq inc (sslength sel)) (setq ent (entget (setq entname (ssname sel (setq inc (1- inc)))))) (if (or (eq "POINT" (cdr (assoc 0 ent))) (eq "AECC_COGO_POINT" (cdr (assoc 0 ent))) ) (setq lst (cons (_pointinsertion entname ent) lst)) (setq txt (cons (cons (_textinsertion ent) ent) txt)) ) ) (foreach ent txt (setq ins (list (cadar ent) (caddar ent))) (if (setq pnt (vl-some '(lambda ( pnt ) (equal ins (list (car pnt) (cadr pnt)) 1e-8)) lst)) (setq lst (vl-remove pnt lst)) (progn (setq di1 (distance ins (list (caar lst) (cadar lst))) mpt (car lst) ) (foreach pnt (cdr lst) (if (< (setq di2 (distance ins (list (car pnt) (cadr pnt)))) di1) (setq di1 di2 mpt pnt ) ) ) (if (< di1 mrd) (progn (setq pnt (list (car mpt) (cadr mpt) (caddar ent)) dcd (caar ent) dxf (cdr ent) dxf (subst (cons dcd pnt) (assoc dcd dxf) dxf) ) (entmod dxf) (setq lst (vl-remove mpt lst)) ) ) ) ) ) ) ) (princ) ) (vl-load-com) (princ)1 point
-
My mail box thinks you're spam , well punk are you? (with the voice of Clint Eastwood ) Oh I thought you wanted all ents inside block updated... silly me... good news is nos problemos, the bad news is , dragons never know when to stop and just have to go over the top so its gonna take more time before I'm satisfied (not the youngest dragon on the block anymore ya know)1 point
-
Here's a quick modification - ;; Text 2 Point - Lee Mac 2012 ;; Prompts for a selection of Text and Point entities and moves ;; each Text entity to the nearest (2D distance) Point entity in the set. ;; ;; Retains existing Text elevation. (defun c:txt2pt ( / _textinsertion di1 di2 dxf ent inc ins lst mpt mrd pnt sel txt ) (setq mrd 10.0) ;; Maximum permissible distance (defun _textinsertion ( elist ) (if (and (zerop (cdr (assoc 72 elist))) (zerop (cdr (assoc 73 elist))) ) (cdr (assoc 10 elist)) (cdr (assoc 11 elist)) ) ) (if (setq sel (ssget "_:L" '((0 . "POINT,TEXT")))) (progn (repeat (setq inc (sslength sel)) (setq ent (entget (ssname sel (setq inc (1- inc))))) (if (eq "POINT" (cdr (assoc 0 ent))) (setq lst (cons (cdr (assoc 10 ent)) lst)) (setq txt (cons (cons (_textinsertion ent) ent) txt)) ) ) (foreach ent txt (setq ins (list (caar ent) (cadar ent))) (if (setq pnt (vl-some '(lambda ( pnt ) (equal ins (list (car pnt) (cadr pnt)) 1e-8)) lst)) (setq lst (vl-remove pnt lst)) (progn (setq di1 (distance ins (list (caar lst) (cadar lst))) mpt (car lst) ) (foreach pnt (cdr lst) (if (< (setq di2 (distance ins (list (car pnt) (cadr pnt)))) di1) (setq di1 di2 mpt pnt ) ) ) (if (< di1 mrd) (progn (setq pnt (list (car mpt) (cadr mpt) (caddar ent)) dxf (cdr ent) dxf (subst (cons 10 pnt) (assoc 10 dxf) dxf) dxf (subst (cons 11 pnt) (assoc 11 dxf) dxf) ) (entmod dxf) (setq lst (vl-remove mpt lst)) ) ) ) ) ) ) ) (princ) ) (vl-load-com) (princ)1 point