Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/17/2021 in all areas

  1. OSNAPOVERRIDE (System Variable) https://help.autodesk.com/view/ACD/2022/ENU/?guid=GUID-F3B84568-4B41-427C-8B9F-FE4C1E547D9D Prevents overrides to default object snap settings. With it set to 1 only the current running object snap settings can be used unless you select another osnap first, you cannot pick a point in blank space or use a different osnap otherwise. Teach that beginner when snapping to an endpoint in an area there's other points to snap to close by picking anywhere on that half of that line segment that's not near anything else will prevent them from snapping to the wrong point by accident.
    2 points
  2. (defun foo (lst / l n) (setq n (length lst) l (mapcar 'car lst)) (vl-remove-if '(lambda (a) (= (- n (length (vl-remove (car a) l))) 1)) lst) )
    2 points
  3. First, we get the length of the list as a whole, i.e. the number of items in that list (stored in variable n). Then we remove every occurrence of that element from the list using vl-remove and take its length, which is (length (vl-remove (car a) l)). Subtracting the total length with the removed length gives you the number of occurrences of that item in the list, so if it's not equal to 1 (or greater than 1), remove that item from the list. So: l is stored as (1 1 2) and n as 3. Let's take the last item of the list, a=(2 (<Entity name: 8290ba00>)) (car a) = 2 (vl-remove 2 l) = (1 1) (length (1 1)) = 2 (- n 2) --> (- 3 2) = 1 (= 1 1) = T, therefore remove item from list. So if a=(1 (<Entity name: 8290b880>)): (car a) = 1 (vl-remove 1 l) = (2) (length (2)) = 1 (- n 1) --> (- 3 1) = 2 (= 2 1) = nil, therefore do not remove item from list. By the way, debugging is something that programmers must be able to perform. You can use it in this case too even thought it doesn't yield any errors. But I have to say, that it does yield an error when I first write it up and tested it. No matter how skilled anyone is at programming (myself, Lee, and all the best programmers out there), you're bound to make a mistake at some point, especially codes with thousands of lines, so it's good to know where they occur in order to be able to fix the error. To do that, we use the debugging feature of AutoLISP. These can include step-by-step execution and variable watching. Lee Mac has provided an excellent tutorial in this link and it is VERY important for programmers to be able to use this. You can also use it in this scenario to see how the code functions.
    1 point
  4. You could make the Aperture box bigger.
    1 point
  5. Look into the OVERKILL command. It will remove and/or consolidate lines and arcs that overlap. It doesn't seem to work on text.
    1 point
  6. Finally some meaningful results. Thanks guys for your time (defun C:PLOTME () (setq n (getint "\nEnter Number of Steps : ")) (if (setq ss (ssget "x" '((0 . "insert") (2 . "A4-STD")))) (progn (setq i -1) (repeat n (setq px (cdr (assoc 10 (entget (ssname ss (setq i (1+ i))))))) (setq aa (atof (rtos (car px) 2 4))) (setq bb (atof (rtos (cadr px) 2 4))) (setq nx (rtos (- aa 34355.3919) 2 4)) (setq ny (rtos (- bb 77165.1662) 2 4)) (setq mx (rtos (- aa 2855.3919) 2 4)) (setq my (rtos (- bb 32576.5481) 2 4)) (setq sp2 (strcat nx "," ny)) (setq sp3 (strcat mx "," my)) (princ sp2) (princ sp3) (command "plot" "Y" "MODEL" "PDFCreator" "A4" "Millimeters" "Portrait" "No" "Window" sp2 sp3 "FIT" "center" "Y" "DDSHIPCON 2018.ctb" "Y" "N" "N" "N" "Y") (PRINC) ); repeat );progn );if (princ) ); end function
    1 point
  7. Yes bigal the routine is in mspace when the ssget function in line 55 is executed. Therefore you would assume that 'cvport would be the current VP such as 2, 3 etc . It should be unique since there can only be one current VP. The problem is the way the human brain works vs the computer! The ssget function filter does not know "current" as a human might think it only knows a number. That is, (getvar 'cvport) is going to return a number. Just a number with no other meaning to the computer. Although us humans think it means "current". So here's the "problem": the ssget filter sees (cons 69 2). Every layout could have a number 2 VP. In my example file that is true since every layout has at least one VP. Therefore as mhupp pointed out we need to also filter for the layout tab number 'ctab . Adding the filter element (cons 410 'ctab) solves the problem since there is only one number 2 VP on the active tab. With everybody's help my routine is working. With special thanks to Lee Mac and his ms2ps program.
    1 point
  8. Pick the word "Quote" next to the "plus" and you get it. (like I did here)
    1 point
  9. Load this: (defun hpimprint (/ collection names) (setq names (list "")) (if (not (vl-catch-all-error-p (setq collection (vl-catch-all-apply (function (lambda () (vla-item (vla-getextensiondictionary (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))) "ACAD_LAYERFILTERS"))) )))) (vlax-for item collection (setq names (cons (vla-get-name item) names)))) names (or(member "Linetype" names)(command "._-layer" "filter" "new" "property" "All" "LINETYPE==\"~Continuous\"" "Linetype" "X" nil)) (or(member "Lineweight" names)(command "._-layer" "filter" "new" "property" "All" "LINEWEIGHT==\"~Default\"" "Lineweight" "X" nil)) (or(member "NCS" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"[A,C,E,L,V]-*\" or NAME== \"Layer*\"" "NCS" "X" nil)) (or(member "CWS" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"(CWS)*\" or NAME== \"Layer*\"" "CWS" "X" nil)) (or(member "TFR" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"(TFR)*\" or NAME== \"Layer*\"" "TFR" "X" nil)) (or(member "BD" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"(BD)*\" or NAME== \"Layer*\"" "BD" "X" nil)) (princ "Layer Filter Names » ")(princ names) ; (princ "\nSave, close and reopen the DWT or DWG for the Filters to be put into alphabetical order.") (princ) ) (vl-load-com) (hpimprint)
    1 point
  10. Hurts when nobody's willing to help you out. I recommend this, but it's not free: SuperBoundary The program itself is amazing, I wish I could do that.
    1 point
  11. I use this one which I created YEARSSSSS ago Still working fine for me (defun c:Z-coord ( ) (graphscr) (princ "\nATTENTION !!! Do NOT use this routine on a 3D-drawing !!!") (initget "y Y n N") (setq sure (getkword "\nAre you sure you want to move all Z-coِordinates to 0.000 ? (Y/N) <N>:")) (setq sure (strcase sure)) (if (= sure "") (setq sure "N") ) (if (= sure "Y") (progn (initget "y Y n N") (setq reallysure (getkword "\nAre you REALLY sure ? (Y/N) <N>: ")) (setq reallysure (strcase reallysure)) (if (= reallysure "") (setq reallysure "N") ) ) ) (if (= reallysure "Y") (progn (setq zasnw 0.0) (if (setq selectie (ssget "x")) (progn (setq aantent (sslength selectie)) (setq teller 0) (while (< teller aantent) (setq startlijst nill) (setq endlijst nill) (setq elevlijst nill) (setq diktelijst nill) (setq volg nill) (setq entnaam (ssname selectie teller)) (setq teller (1+ teller)) (setq entlijst (entget entnaam)) (setq startlijst (assoc 10 entlijst)) (setq endlijst (assoc 11 entlijst)) (setq elevlijst (assoc 38 entlijst)) (setq diktelijst (assoc 39 entlijst)) (setq volg (cdr (assoc 66 entlijst))) (setq xstart (cadr startlijst)) (setq ystart (caddr startlijst)) (setq xend (cadr endlijst)) (setq yend (caddr endlijst)) (setq startnw (list '10 xstart ystart zasnw)) (setq endnw (list '11 xend yend zasnw)) (setq elev (cons '38 zasnw)) (setq dikte (cons '39 zasnw)) (setq entlijst (subst startnw startlijst entlijst)) (entmod entlijst) (entupd entnaam) (if (not (= endlijst nil)) (progn (setq entlijst (subst endnw endlijst entlijst)) (entmod entlijst) (entupd entnaam) ) ) (if (not (= elevlijst nil)) (progn (setq entlijst (subst elev elevlijst entlijst)) (entmod entlijst) (entupd entnaam) ) ) (if (not (= diktelijst nil)) (progn (setq entlijst (subst dikte diktelijst entlijst)) (entmod entlijst) (entupd entnaam) ) ) (if (= volg 1) (progn (setq entnaam1 (entnext entnaam)) (while (= volg 1) (setq startlijst nill) (setq endlijst nill) (setq elevlijst nill) (setq diktelijst nill) (setq volg nill) (setq entlijst (entget entnaam1)) (setq startlijst (assoc 10 entlijst)) (setq endlijst (assoc 11 entlijst)) (setq elevlijst (assoc 38 entlijst)) (setq diktelijst (assoc 39 entlijst)) (setq volg (cdr (assoc 66 entlijst))) (if (not (= startlijst nil)) (progn (setq xstart (cadr startlijst)) (setq ystart (caddr startlijst)) (setq startnw (list '10 xstart ystart zasnw)) (setq entlijst (subst startnw startlijst entlijst)) (entmod entlijst) (entupd entnaam1) ) ) (if (not (= endlijst nil)) (progn (setq xend (cadr startlijst)) (setq yend (caddr startlijst)) (setq endnw (list '10 xend yend zasnw)) (setq entlijst (subst endnw endlijst entlijst)) (entmod entlijst) (entupd entnaam1) ) ) (if (not (= elevlijst nil)) (progn (setq entlijst (subst elev elevlijst entlijst)) (entmod entlijst) (entupd entnaam1) ) ) (if (not (= diktelijst nil)) (progn (setq entlijst (subst dikte diktelijst entlijst)) (entmod entlijst) (entupd entnaam1) ) ) (if (= volg 1) (setq entnaam1 (entnext entnaam1)) ) ) ) ) ) ) ) ) ) (setvar "attreq" 1) (princ) )
    1 point
×
×
  • Create New...