Jump to content

All Activity

This stream auto-updates

  1. Today
  2. @devitg Yours works great. the only thing I would like to add is to set a distance between blocks on the line, just like the copyblockstocurve has. @Saxlle Yours also works, but if block doesn't have scale uniformly set to 1, it asks to type scale, rotation and attribute value, and it goes block by block. Its unnessery.
  3. pkenewell

    closed polyline with automatic hatch

    @SLW210 That's true! the command could be boiled down to this below if you don't want a polyline boundary. However, the PLINE command has more options, and there are 2 extra returns that you have to press at the end to complete the command - that's why I would stick to the original. (defun C:PLH (/ e el) (command "._-hatch" "_Pro" "ANSI34" "10.0" "90" "_W" "_N") (while (= (logand (getvar "cmdactive") 1) 1) (command pause) ) (princ) )
  4. pkenewell

    closed polyline with automatic hatch

    @masterfal Simple - just replace the the options in the command statement for the -HATCH command ; Replace Hatch command line (command "._-hatch" "_pro" "_S" "_S" e "" "") with: (command "._-hatch" "_Pro" "ANSI34" "10.0" "90" "_S" e "" ""); where after "Pro" (properties), the arguments are [Pat. Name] [Scale] [Rotation]
  5. leonucadomi

    ATTDEF COUNT...help

    sorry , I will try to explain myself again the routine you created selects texts and attributes, that's excellent. What I would like you to show is... example: color green texts color yellow ATTDEF att That is, of the total number of selected objects, how many are texts and how many are ATTDEF , regardless of how many times its tags are repeated. another example: number of selected texts : 6 number of selected ATTDEF : 3 I needed Excel to account for them, but if all the amounts are shown here it is very helpful and Excel is not necessary. thanks
  6. I got it now, very fast double extend now. Current settings: Projection=UCS, Edge=None, Mode=Standard then Fence option. If I recall you used to be able to double extend with crossing as well. If I get time I'll dig a little deeper. You have to be careful any extra crossings will send the extend through the closed shapes.
  7. How are you creating the polyline? You can use -Hatch with the "draW boundary" option, just a few clicks for a solid hatch on current layer.
  8. My contribution, you can try it: (prompt "\nTo run a LISP type: CPBLK") (princ) (defun c:CPBLK ( / old_osmode old_attdia ent ptlist spt ept delta num_offset npt ss len i val data block_name data tag_value num ct) (setq old_osmode (getvar 'osmode)) (setq old_attdia (getvar 'attdia)) (setvar 'attdia 0) (setq ent (car (entsel "\nPick the LINE:\n")) ptlist (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget ent))) spt (vlax-curve-getStartPoint (vlax-ename->vla-object ent)) ept (vlax-curve-getEndPoint (vlax-ename->vla-object ent)) delta (- (car ept) (car spt)) num_offset (/ delta (length ptlist)) npt (getpoint "\Pick insertation point for new LINE:") ) (setvar 'osmode 0) (command-s "_LINE" npt (strcat "@" (rtos delta) "<" (itoa 0)) "") (setq ss (ssget "_F" ptlist (list (cons 0 "INSERT"))) len (sslength ss) i 0 val (list) ) (while (< i len) (setq data (entget (ssname ss i)) block_name (cdr (assoc 2 data)) ) (while (/= (cdr (assoc 0 data)) "SEQEND") (setq data (entget (entnext (cdr (assoc -1 data)))) tag_value (cdr (assoc 1 data)) val (append val (list (list tag_value block_name))) ) ) (setq i (1+ i)) ) (setq val (vl-remove-if-not '(lambda (x) (/= (car x) nil)) val) num 0 ct 0 ) (repeat (length val) (command-s "-insert" block_name (list (+ (car npt) num) (cadr npt)) 1 0 (car (nth ct val))) (setq num (+ num num_offset) ct (1+ ct) ) ) (setvar 'osmode old_osmode) (setvar 'attdia old_attdia) (prompt (strcat "\nCopied " (itoa (length val)) " blocks along path.")) (princ) ) and it looks like on the .mp4: Recording2025-07-24at08.56.33-ezgif.com-gif-to-mp4-converter.mp4
  9. Hi guys. It's been more than 10 years, but the problem/bug still occurs in AutoCAD 2025. However, after opening a thread in another Forum, I found a solution. Sharing with you here what worked for me. The bold text bug behaviour (that also occurs for other elements) was solved here by instead of printing directly from AutoCAD to the printer, first I PDF the drawing, and then I print from the PDF. This bug is being generated by the direct communication from AutoCAD to the Printer, but for some unknown reason, AutoCAD doesn't generate the same bug when the PDF printer is used. Cheers
  10. masterfal

    closed polyline with automatic hatch

    Hi All, managed to tweak this code slightly so it draws into a specific layer and then removes the polyline at the end so you are just left with solid hatch. just wondering if i wanted to specify a certain hatch pattern instead of solid (eg ANSI34 with scale of 10 and angle of 90) how would i do that? (defun C:PLH (/ e el old_layer hatch_ent) ;; Store the current layer (setq old_layer (getvar "clayer")) ;; Set the desired layer for the polyline and hatch (command "._layer" "_m" "layernamehere" "") ; Create layer if it doesn't exist (command "._layer" "_s" "layernamehere" "") ; Set current layer (command "._pline") (while (= (logand (getvar "cmdactive") 1) 1) (command pause) ) (if (and (setq e (entlast)) ; 'e' now holds the entity name of the polyline (setq el (entget e)) (= (cdr (assoc 0 el)) "LWPOLYLINE") (= (logand (cdr (assoc 70 el)) 1) 1) ) (progn (command "._-hatch" "_pro" "_S" "_S" e "" "") (setq hatch_ent (entlast)) ; Get the entity name of the newly created hatch (entdel e) ; Delete the polyline using its entity name 'e' ) (princ "\nInvalid Polyline Created (Must be complete and Closed).") ) ;; Restore the original layer (command "._layer" "_s" old_layer "") (princ) )
  11. BIGAL

    ATTDEF COUNT...help

    " how many times each tag is repeated. " that is in the answer I provided. (("048" 1) ("047" 1) ("046" 1) ("045" 2) ("044" 1) ("043" 2) ("042" 1) ("041" 2) ("040" 1) ("039" 1) ("038" 2) ("037" 1) ("036" 2) ("035" 2) ("034" 6) ("033" 6) ("032" 6) ("031" 2) ("030" 2) ("029" 12) ("028" 6) ("027" 6) ("026" 23) ("025" 2) ("024" 4) ("023" 6) ("022" 6) ("021" 1) ("020" 1) ("019" 2) ("018" 2) ("017" 1) ("016" 1) ("015" 2) ("014" 6) ("013" 2) ("012" 2) ("011" 2) ("010" 1) ("009" 1) ("008" 1) ("007" 1) ("006" 4) ("005" 16) ("004" 1) ("003" 1) ("002" 1) ("001" 1)) change code at end add princ lst3 ) (princ lst3) (princ) ) I can do the send to excel if you want ? You have asked for text also can you post anther sample dwg with say both, text and Attdef. Will have a think about missing value.
  12. GLAVCVS

    ATTDEF COUNT...help

    var1, var2, and var3 should be "punto," "angulo," and "distancia"? So: angle and distance... between what objects?
  13. You don't draw a line read the questions asked, pick the pline, pick the block, pick a point to draw the line & blocks and enter a gap distance between them say 1000. The line with copied blocks is automatically drawn. The line will be as long as there is blocks.
  14. Here is the help for Extend it has some variables you can set may be applicable for Acad. https://help.bricsys.com/en-us/document/command-reference/e/extend-command?version=V25&id=165079077042
  15. Yesterday
  16. GLAVCVS

    ATTDEF COUNT...help

    ;BACALADO DE BILBADOOO (PLUS) (defun nqf (tuSS / i lista tipObj cant cad txs atts) (princ "\nNumero que falta") (terpri) (if tuSS (setq cant (sslength tuSS)) (progn (alert "No existe conjunto de seleccion o esta vacio") (exit) ) ) (princ "\nCantidad de textos seleccionados = ") (princ cant) (princ "\nLista de numeros faltantes") ;Pasar del SS a una lista de valores (setq i 0 txs 0 atts 0) (repeat (sslength tuSS) (setq tipObj (cdr (assoc 0 (setq le (entget (ssname tuSS i))))) num (atoi (cdr (assoc (if (= tipObj "TEXT") 1 2) le))) i (1+ i) lista (if (setq l (assoc num lista)) (subst (list num (1+ (cadr l))) l lista) (append lista (list (list num 1))) ) ) (if (= tipObj "TEXT") (setq txs (+ txs 1)) (setq atts (+ atts 1))) ) ;Imprimir los valores que no aparezcan (terpri) (setq i 1) (princ (strcat "\nLista de numeros existentes\n" (while lista (if (setq v (assoc i lista)) (setq cad (if (= (cadr v) 1) (if cad (strcat cad ", " (itoa (car v))) (itoa (car v)) ) (if cad (strcat cad ", " (itoa (car v)) "(" (itoa (cadr v)) ")") (strcat (itoa (car v)) "(" (itoa (cadr v)) ")") ) ) lista (vl-remove v lista) ) (princ (strcat "\nFalta el # " (itoa i))) ) (setq i (1+ i)) cad ) "\nTextos: " (itoa txs) "\nAtributos: " (itoa atts) ) ) (princ) ) (defun c:nqf nil (nqf (ssget '((0 . "TEXT,ATTDEF")))))
  17. @SLW210 it ask for the polyline where the blocks are inserted, then get the coordinates from such polyline , and use it to get all blocks as selectionset . It draw a polyline straight long enough to receive the new block at a given distance, 1000 units in this cas Then it copy each one and move to the new line
  18. Your latest works in AutoCAD 2000i on my home computer, though it makes a new line was that intended? I like yours a lot.
  19. I used the one supplied by the OP.
  20. Holy Old Post bump!!!! Yeah i was looking to do just this today.. totally forgot how... thanks to this thread.. i figured it out. Use the POLAR parameter, start point at the center of rotation, end point at the point you want the stretch to end. Add the POLAR STRETCH action to the SECOND point. Select the objects you want to stretch, like the line and end arrow. Select the object you want to rotate, like the line, end arrow and the triangular arrow near the circle. Boom Done Bob's your Uncle. DynBlock101.dwg
  21. @SLW210 @HypnoS edited please test. cpy-blk-2-poly.lsp
  22. @SLW210 please upload sample dwg , where yo did apply the lisp
  23. leonucadomi

    ATTDEF COUNT...help

    you can make the routine show the number of selected texts and the number of attributes, please
  24. I tried that everyway possible and no luck with AutoCAD 2026, if I get time I'll look through my settings again. Might be a quirk in my AutoCAD 2026. It does seem it used to work as you say.
  25. I get Command: CPY-BLK-2-POLY Select objects: ; error: bad argument type: lselsetp nil
  26. Here is my effort, worked on your drawing for me. ;;; Copy blocks to a polyline/line path in ascending order left to right based on ATTRIBUTE TAG value. | ;;; | ;;; https://www.cadtutor.net/forum/topic/98615-copy-blocks-to-curve-according-to-another-curve/#findComment-675378 | ;;; | ;;; By SLW210 (a.k.a. Steve Wilson) | ;;; | ;;;****************************************************************************************************************| ;| Lines/Polylines need be drawn Left-Right or reversed, could be coded to check direction and reverse them. I'm not motivated to do that, but feel free to alter the code. I did test on angled Polylines/Lines as well as vertical and it works, but might need adjustments. I adjusted a code I already had to handle this specific request for which it works, I doubt if I'll do anymore modifications. |; ;;;***************************************************************************************************************| ;;; This code asks to select the block and type in the tag name from options given (case sensitive). | ;;; | ;;;***************************************************************************************************************| (defun c:BlksSrt2PL (/ blkLst spacing pathEnt pathObj blkCopy len i param pt getAtVal parsFract attrVal blk startPt endPt dx dy visStart dist tangent rotAngle pathDist objType blkSelEnt blkSelObj tagList tagNames selTag ) (vl-load-com) ;; Function to get attribute value by tag name (defun getAtVal (blk tag / atts val) (setq atts (vlax-invoke blk 'GetAttributes)) (setq val "") (foreach att atts (if (= (strcase (vla-get-TagString att)) (strcase tag)) (setq val (vla-get-TextString att)) ) ) val ) ;; Function to convert fractional strings (like "1/2") to numbers (defun parsFract (s / pos num1 num2) (cond ((setq pos (vl-string-search "/" s)) (setq num1 (read (substr s 1 pos))) (setq num2 (read (substr s (+ pos 2)))) (if (and num1 num2 (/= num2 0)) (/ (float num1) num2) 0.0 ) ) ((distof s)) (T 0.0) ) ) ;; Select a block to determine attribute tag name (prompt "\nSelect a block to determine the tag name:") (setq blkSelEnt (car (entsel "\nSelect a block with attributes: "))) (if (not blkSelEnt) (progn (prompt "\nNo block selected. Exiting.") (exit) ) ) (setq blkSelObj (vlax-ename->vla-object blkSelEnt)) (if (not (vla-get-HasAttributes blkSelObj)) (progn (prompt "\nSelected block has no attributes. Exiting.") (exit) ) ) ;; Get all attribute tags from selected block (setq tagList '()) (foreach att (vlax-invoke blkSelObj 'GetAttributes) (setq tagList (cons (vla-get-TagString att) tagList)) ) (setq tagNames (apply 'strcat (mapcar '(lambda (x) (strcat "\n - " x)) tagList) ) ) (prompt (strcat "\nAvailable tags in selected block:" tagNames) ) (initget 1) (setq selTag (getstring "\nEnter the tag to use: ")) ;; --- Collect all blocks with that attribute tag --- (setq blkLst '()) (vlax-for ent (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-Acad-Object)) ) (if (and (= (vla-get-ObjectName ent) "AcDbBlockReference") (vla-get-HasAttributes ent) ) (progn (setq attrVal (getAtVal ent selTag)) (if (and attrVal (/= attrVal "")) (setq blkLst (cons (list (parsFract attrVal) ent) blkLst)) ) ) ) ) (if (= (length blkLst) 0) (progn (prompt "\nNo matching blocks found.") (exit) ) ) ;; Select path: polyline or line (prompt "\nSelect path (polyline or line): ") (setq pathEnt (car (entsel "\nSelect path (polyline or line): "))) (if (not pathEnt) (progn (prompt "\nNo object selected. Exiting.") (exit) ) ) (setq pathObj (vlax-ename->vla-object pathEnt)) (setq objType (vla-get-ObjectName pathObj)) (if (or (equal objType "AcDbPolyline") (equal objType "AcDbLine") ) (progn (setq startPt (vlax-curve-getStartPoint pathObj)) (setq endPt (vlax-curve-getEndPoint pathObj)) ) (progn (prompt (strcat "\nSelected object is not a polyline or line: " objType ". Exiting." ) ) (exit) ) ) ;; Determine start point (setq dx (- (car endPt) (car startPt))) (setq dy (- (cadr endPt) (cadr startPt))) (if (> (abs dy) (abs dx)) ;; Mostly vertical (setq visStart (if (> (cadr startPt) (cadr endPt)) startPt endPt ) ) ;; Mostly horizontal or diagonal (setq visStart (if (< (car startPt) (car endPt)) startPt endPt ) ) ) ;; Sort blocks by numeric tag value (setq blkLst (vl-sort blkLst (function (lambda (a b) (> (car a) (car b)))) ) ) (if (not (equal startPt visStart 1e-6)) (setq blkLst (reverse blkLst)) ) ;; Ask for spacing (initget 7) (setq spacing (getdist "\nEnter spacing between blocks: ")) ;; Place and rotate blocks along path (setq len (length blkLst)) (setq i 0) (setq dist 0.0) (setq pathDist (vlax-curve-getDistAtParam pathObj (vlax-curve-getEndParam pathObj) ) ) (while (and (< i len) (< dist pathDist)) (setq pt (vlax-curve-getPointAtDist pathObj dist)) (setq tangent (vlax-curve-getFirstDeriv pathObj (vlax-curve-getParamAtDist pathObj dist) ) ) (setq rotAngle (atan (cadr tangent) (car tangent))) ;; Flip angles to keep blocks upright (if (or (> rotAngle (/ pi 2)) (< rotAngle (- (/ pi 2)))) (setq rotAngle (+ rotAngle pi)) ) (if pt (progn (setq blk (cadr (nth i blkLst))) (setq blkCopy (vla-copy blk)) (vla-put-InsertionPoint blkCopy (vlax-3d-point pt)) (vla-put-Rotation blkCopy rotAngle) ) ) (setq dist (+ dist spacing)) (setq i (1+ i)) ) (prompt (strcat "\nCopied " (itoa i) " blocks along path.")) (princ) )
  27. pkenewell

    closed polyline with automatic hatch

    @BlackBox Thanks! (yeah - logand is fairly advanced, but shorter lol)
  1. Load more activity
×
×
  • Create New...