Jump to content

All Activity

This stream auto-updates

  1. Past hour
  2. Today
  3. Those course (i.e. - project) files would only be available to actual paying students although if you were to search through the many threads re: Penn-Foster you could conceivably find individual project files students have posted copies of over the years. For example, the Oleson Village Project. What is your interest in the files?
  4. You can turn the viewport off and everything in it will not plot. Frozen layers will still plot, you need to turn them off.
  5. Emmanuel Delay

    Automatically add text to a table

    I think this is what you want. Command ATTT (vl-load-com) ;; ATTT for Add Text To Table (defun c:ATTT ( / rowstart obj texts i x x_vals x_vals_sorted) (setq rowstart (getint "\nStart Row (row 1 = the row of 000): ")) (setq obj (vlax-ename->vla-object (car (entsel "\nPick table: ")))) (princ "\nSelects the green title objects: ") (setq texts (ssget (list (cons 0 "TEXT") (cons 8 "TEXT-0.3")))) (setq x_vals (list)) (setq i 0) (repeat (sslength texts) (setq x (nth 0 (cdr (assoc 10 (entget (ssname texts i)))))) (setq x_vals (append x_vals (list x))) (setq i (+ i 1)) ) ;; sort the x-values (setq x_vals_sorted (vl-sort-i x_vals '<)) (setq i 0) (setq col 0) (repeat (sslength texts) (setq text (ssname texts (nth i x_vals_sorted))) (setq title (cdr (assoc 1 (entget text)))) (setq row (+ i rowstart)) (vla-settext obj row col title) (setq i (+ i 1)) ) (princ) )
  6. If you just want to add to end of a table it is easy as there is a function of Vla-insertrow so just do that for the extra text you want I would look at a selection set. So can do in random order or some sorted list of the selection set. Could then read the entire table and resort it if required.
  7. Emmanuel Delay

    Automatically add text to a table

    I think based on something Bigal wrote, link in the code. Command TEST (feel free to rename) - User selects the table - User picks the start row. Fill in 1 for the row of 000, Fill in 2 for the row of 001, ... (you can hardcode this (setq row 1) if you will always start with 1 - User selects the title objects, the green text objects "GENERAL NOTES 0" ... one by one ;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/user-text-to-existing-table-cells/td-p/12238012 ;;You can get tables using ssget. ;; ;;I just posted this, the 0 0 is the title, 1 1 is 1st cell in header (vl-load-com) (defun c:test ( / obj rows cols row col value_ cellvalue) (setq obj (vlax-ename->vla-object (car (entsel "\nPick table: ")))) (setq rows (vlax-get-property obj 'rows)) (setq cols (vlax-get-property obj 'columns)) ;; get value of a cell ;;(setq col (getint "\nColumn: ")) ;;(setq row (getint "\nRow: ")) ;;(setq cellvalue (vlax-variant-value (vla-GETCELLVALUE OBJ row col))) ;;(princ "\n") ;;(princ cellvalue) ;;;;;;;;;;;; (setq col 0) (setq row (getint "\nStart Row (row 1 = the row of 000): ")) (princ "\nNow select texts: ") (while (setq title_obj (entsel "\ntitle object: ")) (setq title (cdr (assoc 1 (entget (car title_obj))))) ;;So if you know where "REVISION" is row & column can check easy then use next to put values. (vla-settext obj row col title) (setq row (+ row 1)) ) ) Happy with this? We can quite easily let you select all the all the frames, and read all the Text objects on layer "TEXT-0.3", sort from left to right, ... then auto fill in the table If you want
  8. I have looked everywhere for coursework cad files and haven't found anything. any help would be appreciated It tells you to go to 'X' file, but it doesn't exist.
  9. Hello, Can anyone help me with my dilemma. I'm doing AutoCAD automation and I want a schedule to not shows at time but show at other times. The schedule is shown through a viewport. I have tried making a costume viewport layer for it and freezing it. But freezing the layer of the vp does not seem to stop what inside the vp from printing. So is there an option to link the viewport to what it shows so if I freeze the vp layer it won't print what it shows.
  10. Yesterday
  11. Hi All, This is just to let you know that we have recently had a problem with the validation of new user registrations. This meant that some people will not have been able to register for the forum. This must have been frustrating and I apologise for any inconvenience this may have caused. The problem with the anti-spam controls has now been fully resolved and all visitors are now able to register. Thanks for your continued support, David
      • 1
      • Thanks
  12. How to keep attribute's text horizontal (rotation =0) by dynamic blocks with alignement parameter ? i see a lot of info for keeping text horizontal by block rotation but not for block alignement.
  13. Hi every one I need a lisp that adds the texts I select, to a pre defined table in Autocad. In the attached file, I need to select texts in the "DRAWING TITLE" part, and add them to the first column of the table. It would be great if the lisp, itself, can automatically select all of the mentioned texts and add them to the table. But if not, I can manually select the texts, and the lisp adds them to the table. Add Text to Table.dwg
  14. Last week
  15. @BIGAL, sorry for the late reply. Here's the property: \pxqj;all work and no play makes jack a dull boy; all work and no play makes jack a dull boy; all work and no play makes jack a dull boy; all work and no play makes jack a dull boy; all work and no play makes jack a dull boy; all work and no play makes jack a dull boy; all work and no play makes jack a dull boy; all work and no play makes jack a dull boy; all work and no play makes jack a dull boy; all work and no play makes jack a dull boy; See screen shot of the properties that shows this too along with how the mleader is left justified and not using justified paragraph. The editor is correct, but as soon as I exit, it displays as above.
  16. This fake is worth more than two cents. The code works the way I wanted it to. Thanks! But I don't understand why I should drive carefully.
  17. Lee Mac

    Counting arrayrect elements

    No, I mean the data returned by my (LM:arraydata) function - you just assumed you should use the length of the list, without actually checking what the list contains.
  18. GLAVCVS

    Counting arrayrect elements

    P.S.: This is just my two cents — though to be honest, it’s probably counterfeit
  19. GLAVCVS

    Counting arrayrect elements

    This is the first time I’ve ever done an “autopsy” on an object like this. I’ve carefully extracted what seemed to me to be the information I was looking for. So I must say: DRIVE CAREFULLY AND RESPECT ALL STOP SIGNS.
  20. GLAVCVS

    Counting arrayrect elements

    (defun c:CountElemArrayrect (/ ss n pt ent le dameFFCC) (defun dameFFCC (ent / items rows cont cols filas) (foreach l (entget (cdr (assoc 330 (entget (cdr (assoc 330 (entget ent))))))) (cond (items (if (= (setq cont (+ (if cont cont 0) (if (= (car l) 90) 1 0))) 3) (setq cols (cdr l) items nil cont nil))) (rows (if (= (setq cont (+ (if cont cont 0) (if (= (car l) 90) 1 0))) 3) (setq filas (cdr l) rows nil cont nil))) ((= (car l) 1) (if (= (cdr l) "Items") (setq items T) (if (= (cdr l) "Rows") (setq rows T)) ) ) ) ) (if (and filas cols) (* filas cols)) ) (princ "Select a arrayrect: ") ;;; (setq ss (ssget '((0 . "ARRAY"))) ;;; n 0) (if (and (setq ent (car (entsel))) (= (cdr (assoc 0 (setq le (entget ent)))) "INSERT") (= "ACDBASSOCDEPENDENCY" (cdr (assoc 0 (entget (cdr (assoc 330 le))))))) (progn (setq n (dameFFCC ent)) ;;; (vla-get-Count ;;; (vlax-ename->vla-object (ssname ss 0)))) (princ (strcat "The number of elements in the array: " (itoa n))) (princ "Specify the insertion point of the text: ") (setq pt (getpoint)) (if pt (entmakex (list (cons 0 "TEXT") (cons 10 pt) (cons 1 (itoa n)) (cons 40 25) ; text height (cons 7 (getvar "TEXTSTYLE")) ) ) ) ) ) (princ) )
  21. number of array elements.dwg
  22. GLAVCVS

    Counting arrayrect elements

    If you post an example drawing, maybe someone else will be encouraged to join the conversation.
  23. DXF data ( (-1 . <Object name: 233aa8f9cf0>) (0 . "INSERT") (5 . "17957") (102 . "{ACAD_REACTORS") (330 . <Object name: 233aa8f9d80>) (102 . "}") (330 . <Object name: 23bc15009f0>) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "Hatching") (100 . "AcDbBlockReference") (2 . "*U268") (10 77260.1 54657.3 0.0) (41 . 1.0) (42 . 1.0) (43 . 1.0) (50 . 0.0) (70 . 0) (71 . 0) (44 . 0.0) (45 . 0.0) (210 0.0 0.0 1.0) ) I've looked at the data, but I need professional help... How can I count elements in an array in lisp?
  24. Lee Mac

    Counting arrayrect elements

    Did you even look at the data that my function returns?
  25. The code writes the same amount for arrays with different numbers of elements... (defun c:ArrCountTxt ( / ent arrData count insPt txtHeight) (prompt "Select a arrayrect: ") (setq ent (car (entsel))) (if (and ent (= "INSERT" (cdr (assoc 0 (entget ent))))) (progn (setq arrData (LM:arraydata ent)) ;; count the number of elements (setq count (length arrData)) (princ (strcat "Number of array elements: " (itoa count))) (prompt "Specify the insertion point of the text: ") (setq insPt (getpoint)) (setq txtHeight 20) (entmake (list (cons 0 "TEXT") (cons 8 (cdr (assoc 8 (entget ent)))) ; (cons 10 insPt) (cons 40 txtHeight) (cons 1 (strcat "Quantity: " (itoa count))) (cons 7 "Standard") (cons 50 0.0) ) ) ) ) (princ) ) (defun LM:arraydata ( ent / enx lst rtn ) (if (and (setq enx (entget ent)) (= "INSERT" (cdr (assoc 0 enx))) (setq lst (vl-some (function (lambda ( x ) (if (and (= 330 (car x)) (= "ACDBASSOCDEPENDENCY" (cdr (assoc 0 (entget (cdr x)))))) (cdr (assoc 330 (entget (cdr x)))) ) ) ) (member '(102 . "{ACAD_REACTORS") enx) ) ) (setq lst (entget lst)) (setq lst (cons nil (member (assoc 1 lst) lst))) ) (while lst (setq rtn (cons (cons (cdadr lst) (cdar (cddddr lst))) rtn) lst (cdddr (cddddr lst)) ) ) ) (reverse rtn) )
  26. (defun c:LE-CalExtFFL ( / pt1 pt2 pt3 r TxtRotation TxtJustification radians degrees ecoA para) (setq ecoA (getvar "CMDECHO")) (setvar "CMDECHO" 0) (vla-startUndomark (vla-get-activeDocument (vlax-get-acad-object))) (command "_layer" "_m" "-LE-E-External Levels" "") (setq Prefix "") (setq Suffix "") (while (and (not para) (setq ffl-ent (car (entsel))) (= (cdr (assoc 0 (entget ffl-ent))) "MTEXT") ) (if (setq r (vl-catch-all-apply '(lambda () ;; Get the MText object and extract text content (setq ffl-obj (entget ffl-ent)) (setq ffl-text (cdr (assoc 1 ffl-obj))) (princ (strcat "\nFFL Text found: " ffl-text)) (setq ffl-value (ExtractFFLValue ffl-text)) (princ "\nSelect points where to place the level text (Press Enter to finish): ") (if ffl-value (if (setq pt1 (getpoint "\nSelect first point: ")) (if (setq pt2 (getpoint pt1 "\nSelect second point: ")) (virtualiza) ) ) ) ) ) ) (setq para T) ) ) (if r (progn (entdel (entlast)) (princ "\r"))) (setvar "CMDECHO" ecoA) (princ) ) (defun asr (p1 p2 p3 / a b) (if (> (abs (- (setq a (angle p1 p2)) (setq b (angle p2 p3)))) PI) (if (< a b) (if (> (+ a PI PI) b) - +) (if (> (- a PI PI) b) - +) ) (if (> a b) - +) ) ) (defun virtualiza (/ para grd mto txJA d a1 a ejp1 ejp2 pandora color pt) (while (and (not para) (setq grd (grread nil 13 0)) (or (listp (cadr grd)) (= (car grd) 2))) (princ "\rMove the mouse to decide Justification and change Height, press < C > to change color, < + > or < - > to increase or decrease offset or press ESCAPE to cancel) ") (if (= (car grd) 2) (cond ((member (cadr grd) '(67 99)) (setq color (acad_colorDLG 1 T))) ((member (cadr grd) '(43 45)) ;|+ o -|; (vla-put-InsertionPoint (vlax-ename->vla-object mto) (vlax-3d-point (setq pt (polar (if pt pt pt1) ((if (member txJA '(1 3)) - +) (angle pt1 pt2) (/ PI 2.)) ((if (= (cadr grd) 43) + -) 0.1)))))) ) (progn (setq pt3 (cadr grd)) (setq SpotLevel (- ffl-value 0.15)) ;; Initialize point list ;; Prompt for points where to place the new MText (setq TxtRotation (angle pt1 pt2)) (setq TxtValue SpotLevel) (DefMTextJustification pt1 pt2 pt3) (if mto (if (/= TxtJustification txJA) (entmod (subst (cons 71 (setq txJA TxtJustification)) (assoc 71 (entget mto)) (entget mto))) ) (setq mto (CreateMText pt1 TxtValue TxtRotation (setq txJA TxtJustification)) a (cdr (assoc 40 (entget mto)))) ) (setq a (cdr (assoc 40 (entget mto))) ejp1 (polar pt1 ((if (member txJA '(1 3)) - +) (angle pt1 pt2) (/ PI 2.)) (/ a 2.)) ejp2 (polar pt2 ((if (member txJA '(1 3)) - +) (angle pt1 pt2) (/ PI 2.)) (/ a 2.)) ) (if (= (car grd) 3) (setq para T)) (cond ((> (setq d (distance (cadr grd) (setq ppp (inters ejp1 ejp2 (cadr grd) (polar (cadr grd) (+ (angle pt1 pt2) (/ PI 2.)) 1) nil)))) (* a (if pandora 1. 2.))) (setq d (/ d 2.) a1 (if (< (setq a1 (/ (fix (* d 10)) 10.)) 0.1) 0.1 a1) ) (entmod (append (entget mto) (if color (list (cons 40 a1) (cons 62 color)) (list (cons 40 a1))))) (setq pandora T) (princ (strcat " << Current Size: " (rtos a1 2 1) " >>")) ) (pandora (setq d (/ d 2.) a1 (if (< (setq a1 (/ (fix (* d 10)) 10.)) 0.1) 0.1 a1) ) (entmod (append (entget mto) (if color (list (cons 40 a1) (cons 62 color)) (list (cons 40 a1))))) (princ (strcat " << Current Size: " (rtos a1 2 1) " >>")) ) ) ) ) ) (vla-EndUndomark (vla-get-activeDocument (vlax-get-acad-object))) ) (defun ExtractFFLValue (text-string / clean-text) (if (> (strlen text-string) 5) ;Charcters Removed from String (setq clean-text (substr text-string 6)) (setq clean-text text-string) ) (if (numberp (read clean-text)) (read clean-text) (progn (vlr-beep-reaction) (princ "\n*** ERROR : Could not extract numeric value from FFL text ***") nil ) ) ) (defun DefMTextJustification ( p1 p2 p3 / p) ;; Top Left = 1 ;; Top Center = 2 ;; Top Right = 3 ;; Middle Left = 4 ;; Middle Center = 5 ;; Middle Right = 6 ;; Bottom Left = 7 ;; Bottom Center = 8 ;; Bottom Right = 9 (setq p1 (polar p1 (angle p2 p1) 1e8)) (if (or (and (>= (angle p1 p2) 0.0) (<= (angle p1 p2) (/ PI 2.))) (>= (angle p1 p2) (/ (* 3. PI) 2.)) ) (progn (setq Prefix "+") (setq Suffix "") (if (= (asr p1 (inters p1 p2 p3 (polar p3 (+ (angle p1 p2) (/ PI 2.)) 1) nil) p3) -) (setq TxtJustification 1) (setq TxtJustification 7) ) ) (progn (setq Prefix "") (setq Suffix "+") (setq TxtRotation (+ TxtRotation pi)) (if (= (asr p1 (inters p1 p2 p3 (polar p3 (+ (angle p1 p2) (/ PI 2.)) 1) nil) p3) +) (setq TxtJustification 3) (setq TxtJustification 9) ) ) ) ) (defun CreateMText ( point txtvalue txtrot txtjust / txtjust txtrot mtext-obj) (setq mtext-obj (entmakex (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 8 (getvar "CLAYER")) ; Current layer (cons 100 "AcDbMText") (cons 10 point) ; Insertion point (cons 40 0.5) ; Text height (adjust as needed) (cons 41 0.0) ; Reference rectangle width (cons 71 txtjust) (cons 72 5) ; Drawing direction (cons 1 (strcat Prefix (rtos txtvalue 2 3) Suffix)) ; Text content with "+" prefix (cons 50 txtrot) ; Rotation angle ) ) ) mtext-obj )
  27. A relatively simple approach CivilTech.mp4
  28. Lee Mac

    Counting arrayrect elements

    Consider the following function to obtain the data from the array: (defun LM:arraydata ( ent / enx lst rtn ) (if (and (setq enx (entget ent)) (= "INSERT" (cdr (assoc 0 enx))) (setq lst (vl-some (function (lambda ( x ) (if (and (= 330 (car x)) (= "ACDBASSOCDEPENDENCY" (cdr (assoc 0 (entget (cdr x)))))) (cdr (assoc 330 (entget (cdr x)))) ) ) ) (member '(102 . "{ACAD_REACTORS") enx) ) ) (setq lst (entget lst)) (setq lst (cons nil (member (assoc 1 lst) lst))) ) (while lst (setq rtn (cons (cons (cdadr lst) (cdar (cddddr lst))) rtn) lst (cdddr (cddddr lst)) ) ) ) (reverse rtn) ) Call with the array block reference entity, e.g.: (LM:arraydata (car (entsel)))
  29. Lee Mac

    Counting arrayrect elements

    If you inspect the DXF data for a rectangular array (e.g. using my Entity List program, for example), you will see that it is in fact a block reference (INSERT).
  1. Load more activity
×
×
  • Create New...