Jump to content

Leaderboard

  1. Danielm103

    Danielm103

    Community Member


    • Points

      7

    • Posts

      355


  2. BIGAL

    BIGAL

    Trusted Member


    • Points

      7

    • Posts

      20,246


  3. Paul Li

    Paul Li

    Member


    • Points

      4

    • Posts

      50


  4. Steven P

    Steven P

    Trusted Member


    • Points

      4

    • Posts

      3,044


Popular Content

Showing content with the highest reputation since 09/25/2026 in Posts

  1. I use this in visual studio to toggle between header and source. also since I'm a southpaw, I use home and end for copy paste autohotkey is the GOAT! #z::Run www.autohotkey.com ;ALT + XX ; home::send ^c ; end::send ^v ; #IfWinActive ahk_exe devenv.exe ;PgUp::SendRaw `,DS.ARGS() ;misc command ;PgDn::SendRaw `,DS.ARGS({"val:type"}) ;misc command Insert::send ^k^o ;toggle header/source Delete::send ^a^k^f{Esc} ;select all and format #IfWinActive
    3 points
  2. an AI translation (defun c:ldoit ( / ss i ent dxf x1 x2 rot normal dirVec vAxis projDist newX2 ) ;; 1. Select only DIMENSION objects (setq ss (ssget '((0 . "DIMENSION")))) (if ss (progn ;; Iterate backwards through the selection set (repeat (setq i (sslength ss)) (setq i (1- i)) (setq ent (ssname ss i)) (setq dxf (entget ent)) ;; Ensure it is specifically a Rotated/Linear dimension (if (member '(100 . "AcDbRotatedDimension") dxf) (progn ;; 2. Corrected DXF Codes: 13 maps to xLine1Point, 14 maps to xLine2Point (setq x1 (cdr (assoc 13 dxf))) ; xLine1Point (Defpoint 1) (setq x2 (cdr (assoc 14 dxf))) ; xLine2Point (Defpoint 2) (setq rot (cdr (assoc 50 dxf))) ; Rotation angle (in radians) (setq normal (cdr (assoc 210 dxf))) ; Normal Vector ;; 3. Compute direction vector based on rotation angle (setq dirVec (list (cos rot) (sin rot) 0.0)) ;; 4. Vector subtraction: vAxis = x2 - x1 (setq vAxis (mapcar '- x2 x1)) ;; 5. Dot Product: vAxis . dirVec (setq projDist (+ (* (car vAxis) (car dirVec)) (* (cadr vAxis) (cadr dirVec)) (* (caddr vAxis) (caddr dirVec)))) ;; 6. Calculate new X2 point: x1 + (dirVec * projDist) (setq newX2 (list (+ (car x1) (* (car dirVec) projDist)) (+ (cadr x1) (* (cadr dirVec) projDist)) (+ (caddr x1) (* (caddr dirVec) projDist)))) ;; 7. Replace the old DXF 14 (xLine2Point) with the calculated coordinates (setq dxf (subst (cons 14 newX2) (assoc 14 dxf) dxf)) ;; 8. Update and refresh the entity in the CAD database (entmod dxf) (entupd ent) ) ) ) ) ) (princ) )
    2 points
  3. ;;; DIMFL - Shorten the extension lines of selected dimensions. ;;; ;;; Applies a per-dimension override of DIMFXLON / DIMFXL, so the extension line ;;; starts at a fixed distance from the dimension line instead of at the ;;; definition point. Fixes the dimensions you pick, not the whole style. ;;; ;;; NO MEASUREMENT CHANGES. Definition points are not moved; only how far the ;;; extension line is DRAWN. A 50 stays a 50. ;;; Reversible with the Restore option. One Ctrl+Z undoes the whole pass. ;;; ;;; WARNING: if a dimension looks wrong because its definition point MOVED, this ;;; fixes the look but not the value, and makes the error harder to spot. Check ;;; the numbers before shortening anything. (vl-load-com) (defun R0:DFL-Get (obj prop / r) (setq r (vl-catch-all-apply 'vlax-get (list obj prop))) (if (vl-catch-all-error-p r) nil r)) (defun R0:DFL-Put (obj prop val / r) (setq r (vl-catch-all-apply 'vlax-put (list obj prop val))) (not (vl-catch-all-error-p r))) ;; (logand 4 nil) throws, so a missing layer record answers "not locked". (defun R0:DFL-Bloqueada (en / cap) (setq cap (tblsearch "LAYER" (cdr (assoc 8 (entget en))))) (and cap (= 4 (logand 4 (cdr (assoc 70 cap)))))) ;; Default length = whatever the first picked dimension already carries. Whoever ;; set up the style usually chose a number that suits the drawing scale. (defun R0:DFL-Sugerido (ss / i en obj v) (setq i 0 v nil) (while (and (< i (sslength ss)) (null v)) (setq en (ssname ss i) i (1+ i) obj (vlax-ename->vla-object en) v (R0:DFL-Get obj 'ExtLineFixedLen)) (if (or (not (numberp v)) (<= v 1e-9)) (setq v nil))) (if v v 2.5)) (defun c:DIMFL ( / *error* ss i en obj largo sug modo hechos fallo bloq und doc) (defun *error* (msg) (if und (vl-catch-all-apply 'vla-EndUndoMark (list doc))) (if (and msg (not (wcmatch (strcase msg) "*CANCEL*,*QUIT*,*BREAK*,*EXIT*,*ABORT*"))) (princ (strcat "\n[X] DIMFL: " msg))) (princ)) (princ "\nDIMFL | Shorten extension lines (no measurement is changed).") (princ "\n Select dimensions: ") (if (null (setq ss (ssget '((0 . "DIMENSION"))))) (princ "\n[!] DIMFL: nothing selected.") (progn (princ "\n Shorten = fixed length extension lines") (princ "\n Restore = back to starting at the definition point (LONG again)") (initget "Shorten Restore") (setq modo (getkword "\n [Shorten/Restore] <Shorten>: ")) (if (null modo) (setq modo "Shorten")) (if (= modo "Shorten") (progn (setq sug (R0:DFL-Sugerido ss)) (initget 6) (setq largo (getdist (strcat "\n Extension line length <" (rtos sug 2 3) ">: "))) (if (null largo) (setq largo sug)))) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)) und T) (vla-StartUndoMark doc) (setq i 0 hechos 0 fallo 0 bloq 0) (while (< i (sslength ss)) (setq en (ssname ss i) i (1+ i)) (if (R0:DFL-Bloqueada en) (setq bloq (1+ bloq)) (progn (setq obj (vlax-ename->vla-object en)) ;; ExtLineFixedLen = DIMFXL, ExtLineFixedLenSuppress = DIMFXLON. ;; Despite the "Suppress" name the value follows DIMFXLON: 0 = off ;; (long lines), -1 = on (fixed length). Length first, switch second. (if (= modo "Shorten") (if (and (R0:DFL-Put obj 'ExtLineFixedLen largo) (R0:DFL-Put obj 'ExtLineFixedLenSuppress -1)) (setq hechos (1+ hechos)) (setq fallo (1+ fallo))) (if (R0:DFL-Put obj 'ExtLineFixedLenSuppress 0) (setq hechos (1+ hechos)) (setq fallo (1+ fallo)))) (vl-catch-all-apply 'vla-Update (list obj))))) (vla-EndUndoMark doc) (setq und nil) (princ (strcat "\n\n[OK] DIMFL: " (itoa hechos) " dimension(s) " (if (= modo "Shorten") (strcat "with a " (rtos largo 2 3) " extension line") "restored: their lines are LONG again"))) (if (> bloq 0) (princ (strcat "\n " (itoa bloq) " on locked layers: skipped."))) (if (> fallo 0) (princ (strcat "\n " (itoa fallo) " did not accept the change."))) (if (= modo "Shorten") (princ "\n No measurement changed. To revert: DIMFL, Restore option.") (princ "\n To shorten them again: DIMFL, Shorten option.")))) (princ)) (princ "\n[DIMFL] loaded. Type DIMFL to shorten extension lines.") (princ)
    2 points
  4. At a fishing weigh in a 3 shoe long fish was photographed, submitted and then disqualified as its accurate length could not be established. Often when looking at outside projects would pace a length as a guide. Then use real length for design.
    2 points
  5. @Dadgad Actually I even went as far as creating a lisp command so I can make the selections to dwgunits within a dcl gui instead of looking at the dull command line interface. https://marketplace.autodesk.com/apps/5190d5ec-0b6a-4b70-b089-2753abcb8e3a?priceId=bfbb3227-aa55-4923-b9e6-7fe3db0a0a5b
    2 points
  6. Made the notes in Word with a hexagon font. The indents are Character plus a period, that is why second hexagon appears, looking at setting Word style not "A." but "A" only. Can do numbers as well. Copied to Bricscad but the font is not supported in Bricscad to old a font, yes found that out. removed period from bullet style. If you open your notes in word should be able to reset the bullets and save then into MTEXT. In Bricscad with a bit of care you can highlite the bullet character and change it to another font, ie a hexagon font. Hopefully only need to do once. and save your notes, then you add or remove paragraphs. The one above is called HEX:gon Expanded. Above 9 get two hexagons. A-Z is ok tested on Word Doc.
    1 point
  7. If you can work with vectors, all you need is the dotProduct @Ap.Command() def doit(): ps, ss = Ed.Editor.select([(0, "DIMENSION")]) if ps != Ed.PromptStatus.eOk: return for id in ss.objectIds(Db.RotatedDimension.desc()): rotdim = Db.RotatedDimension(id, Db.OpenMode.kForWrite) x1 = rotdim.xLine1Point() x2 = rotdim.xLine2Point() dir_vec = Ge.Vector3d.kXAxis.rotateBy(rotdim.rotation(), rotdim.normal()) v_axis = x2 - x1 proj_dist = v_axis.dotProduct(dir_vec) rotdim.setXLine2Point(x1 + (dir_vec * proj_dist))
    1 point
  8. So the blocks are easy to make with an attribute for the number. Have the attribute with a default value such as '.' If you have one block entered with the attribute competed, this should allow you to increment the others - you need to select the first block attribute to get the value needed and then hit each other attribute in turn to add the next number. Try this LISP for incremental numbering - a part of something much larger so perhaps it isn't as nice as it could be but it works. This should also work for lettering (A -> B, and 1A ->1B, A1 ->A2) Then just have to split the mtext into parts I think - Lee Macs string to list can do part of this - just making a note in case I get time tomorrow to do that for you. Suspect you will need 2 LISPS, the one below to number the block attributes and one to split the text. (defun c:ctx+ ( / increment sel ) ;;Sub Functions (defun LM:roundm ( n m ) ;;http://www.lee-mac.com/round.html (* m (atoi (rtos (/ n (float m)) 2 0))) ) (defun uprev (base sel increments / ent entlst currentrevision revlength revisionprefix anumber ones leadingzero revcode revletter revnumber leadingzeros RL) ;;Sub routines (defun itsnotadate ( increments revlength entlst currentrevision base revisionprefix anumber / currentrevision revlength revisionprefix anumber ones leadingzero revcode revletter) (if (or (= (rtos (atof currentrevision)) currentrevision) (= (type currentrevision) 'INT) ) ; endor (progn (if (= (type currentrevision) 'STR) (setq revletter (+ (atof currentrevision) increments )) (setq revletter (+ currentrevision increments)) ) ; end if (setq revletter (rtos revletter)) ) ; end progn numbers only (progn (setq increments (LM:roundm increments 1 )) ;; set increments to integer, nearest nth (if (< 0 revlength) (progn (setq ones (substr currentrevision revlength)) (if (numberp (read ones))(setq anumber 1)) ) ) ;end if end progn (setq RL 0) ; length or numerical part (while (< RL revlength) (if (and (= RL anumber) (numberp (read (substr (substr currentrevision (- revlength RL) RL ) 1 1)))) (setq anumber (+ RL 1))) (setq RL (+ RL 1)) ) ; end while ;;work out numerical revision. (if (> anumber 0) (progn (setq revnumber (substr currentrevision (- revlength (- anumber 1)) anumber)) (setq revnumber (itoa (+ increments (read revnumber)))) ;;increase rev number by 1 (if (and (> revlength anumber)(/= revlength anumber)) (setq revisionprefix (substr currentrevision 1 (- revlength anumber))) ;;first characters of revision ) ; end if ;;fix leading zeros (setq leadingzeros (- anumber (strlen revnumber))) (setq leadingzero "") (repeat leadingzeros (setq leadingzero (strcat leadingzero "0")) ) ; end repeat (setq revletter (strcat revisionprefix leadingzero revnumber)) ) ; end progn ) ; end if anumber > 0 ;;Work out letters revisions (if (= anumber 0) (progn (setq revcode (+ increments (ascii ones))) ;;increase rev letter by 1 ;;set exceptions here ; (if (= 73 revcode)(setq revcode 74)) ;;I ;; if Rev Box, skip I ; (if (= 79 revcode)(setq revcode 80)) ;;O ;; If Rev Box, skip O ; (if (= 105 revcode)(setq revcode 106)) ;;i ; (if (= 111 revcode)(setq revcode 112)) ;;o.. its of to work we go. (if (= 91 revcode)(setq revcode 65)) ;;Z -> A. Won't increment 'tens' value (if (= 123 revcode)(setq revcode 97)) ;;z -> a Won't increment 'tens' value (setq revisionprefix (substr currentrevision 1 (- revlength 1))) ;;first characters of revision (setq revletter (strcat revisionprefix (chr revcode))) ) ; end progn ) ; end if ) ; end progn alpha-numeric ) ; end if number processing revletter ) ; end defun not date ;;;;;;;;;;;;;; (if (= (type sel) 'LIST) ; if selection is (<entname> (0 1 2)) or just <entname> (setq ent (car sel)) (setq ent sel) ) (setq entlst (entget ent)) ;;entity definiton (setq currentrevision base) ;;text string passed to function (setq revlength (strlen currentrevision)) ;;length of selected revision (setq revisionprefix "") ;;set prefix to blank (setq anumber 0) ;;a counter (setq revletter (itsnotadate increments revlength entlst currentrevision base revisionprefix anumber) ) (setq entlst (subst (cons 1 revletter) (assoc 1 entlst) entlst)) (entmod entlst) (entupd ent) revletter ) (if (= increments nil)(setq increments 1) ) ;; Checks if increments is a value (if (= (type increments) 'STR) (if (= nil (distof increments)) (setq increments 1) (setq increments (distof increments)) ) ) (setq increments (atoi (rtos increments))) (setq endloop "No") ; a marker (setq sel "1") ; Increment amount (while (= endloop "No") ; Select a text of enter a value loop (initget "4 3 2 1 0 -1 -2 -3 -4 Exit") ; increment amount accepted. Increase list if needed (setq sel (nentsel (strcat "\nSelect Text or Enter Text Increment (" (itoa increments) ") [3/2/1/0/-1/-2/-3/Exit]: ") ) ) (cond ( (null sel)(setq endloop "Yes") ) ( (= "Exit" sel)(princ)(exit) ) ((member sel '("-4" "-3" "-2" "-1" "0" "1" "2" "3" "4")) (setq increments (atoi sel)) ) ( (if (and (cdr (assoc 1 (entget (car sel))))(wcmatch (cdr (assoc 0 (entget (car sel)))) "TEXT,MTEXT,ATTRIB,*LEADER") ) (setq endloop "Yes")) ) ( (if (not (wcmatch (cdr (assoc 0 (entget (car sel)))) "TEXT,MTEXT,ATTRIB,*LEADER") ) (princ "\nThats not text...\n")) ) ) ) ;;end while (setq endloop "No") (setq ent (car sel)) (setq entlst (entget ent)) (setq base (cdr (assoc 1 entlst))) (setq base (vl-string-right-trim " " base)) ;; remove trailing spaces (princ ": ")(princ base) (if (= increment nil) (setq increment increments)) (while (while (= endloop "No") (setq sel (nentsel "\nSelect Text to Replace and Increment: ") ) (cond ( (null sel)(setq endloop "Yes") ) ( (= "Exit" sel)(princ)(exit) ) ( (if (and (cdr (assoc 1 (entget (car sel))))(wcmatch (cdr (assoc 0 (entget (car sel)))) "TEXT,MTEXT,ATTRIB,*LEADER") ) (setq endloop "Yes")) ) ( (if (not (wcmatch (cdr (assoc 0 (entget (car sel)))) "TEXT,MTEXT,ATTRIB,*LEADER") ) (princ "\nThats not text...\n")) ) ) ) ;;end while (princ (uprev base sel increment)) (setq endloop "No") (setq increment (+ increment increments)) );;end while (setvar "CMDECHO" 0) (command "regen") ;;in case of nested blocks (setvar "CMDECHO" 1) (princ) )
    1 point
  9. @dber From your post, I understood that you want to number construction detail notes from an existing MTEXT object. I put together two versions so you can try both and choose whichever suits your workflow: - Loose geometry: separate hexagon outlines, solid fills and text numbers. - Block with attribute: each marker is a block with an editable number attribute. Both versions read manual paragraph breaks in the MTEXT. Wrapped lines remain part of the same numbered paragraph, and empty paragraphs are skipped. Each hexagon is sized proportionally to the text and centered vertically beside its paragraph. Commands: - HENL / HENB: add markers beside the existing MTEXT without moving or splitting it. - HENLC / HENBC: create separate numbered paragraphs at a location you pick, with the option to keep or delete the original. You can load both files together—their commands are different. These versions are intended for single-column, non-annotative MTEXT without fields. Give them a try and let me know how they work for your example. Code below. ;;; HEXENUM 1.2 - Loose geometry | AutoCAD Windows / Visual LISP ;;; HENL / HEXENUML: number the existing MTEXT in place. ;;; HENLC / HEXENUMLC: create separate paragraphs at a picked location. ;;; Hexagon side = 1.8 x nominal text height; SOLID fill = ACI 255. ;;; Both editions can be loaded together; command and helper names are isolated. (vl-load-com) (defun R0:HENL-Fail (msg) (setq henl-msg msg) (exit)) (defun R0:HENL-Prefix (frames / result frame) (setq result "") (foreach frame (reverse frames) (setq result (strcat result "{" frame))) result) (defun R0:HENL-Close (frames / result) (setq result "") (repeat (length frames) (setq result (strcat result "}"))) result) (defun R0:HENL-Records (s / i n ch next token frames part visible result j brk start) (setq i 1 n (strlen s) frames (list "") part "{" visible nil) (while (<= i n) (setq start i ch (substr s i 1) next (substr s (1+ i) 1) brk nil) (cond ((or (= ch (chr 10)) (= ch (chr 13))) (setq brk T) (if (and (= ch (chr 13)) (= next (chr 10))) (setq i (1+ i))) (setq i (1+ i))) ((= ch "\\") (cond ((= next "P") (setq brk T i (+ i 2))) ((= next "N") (R0:HENL-Fail "Column breaks found. Set the MTEXT to a single column.")) ((member next '("\\" "{" "}" "~")) (setq part (strcat part (substr s i 2)) i (+ i 2)) (if (/= next "~") (setq visible T))) ((member next '("A" "C" "c" "F" "f" "H" "Q" "T" "W" "p" "S")) (setq j (+ i 2)) (while (and (<= j n) (/= (substr s j 1) ";")) (setq j (1+ j))) (if (> j n) (R0:HENL-Fail "Incomplete MTEXT formatting code.")) (setq token (substr s i (1+ (- j i))) part (strcat part token) i (1+ j)) (if (= next "S") (setq visible T) (setq frames (cons (strcat (car frames) token) (cdr frames))))) ((member next '("L" "l" "O" "o" "K" "k")) (setq token (substr s i 2) part (strcat part token) i (+ i 2) frames (cons (strcat (car frames) token) (cdr frames)))) ((and (= next "U") (= (substr s (+ i 2) 1) "+")) (setq part (strcat part (substr s i 7)) i (+ i 7) visible T)) (T (setq part (strcat part ch) i (1+ i) visible T)))) ((= ch "{") (setq frames (cons "" frames) part (strcat part ch) i (1+ i))) ((= ch "}") (if (null (cdr frames)) (R0:HENL-Fail "Unbalanced formatting braces.")) (setq frames (cdr frames) part (strcat part ch) i (1+ i))) (T (setq part (strcat part ch) i (1+ i)) (if (not (member ch (list " " (chr 9)))) (setq visible T)))) (if brk (progn (if visible (setq result (cons (list (strcat part (R0:HENL-Close frames)) (1- start) (R0:HENL-Close frames)) result))) (setq part (R0:HENL-Prefix frames) visible nil)))) (if (/= (length frames) 1) (R0:HENL-Fail "Unbalanced formatting braces.")) (if visible (setq result (cons (list (strcat part (R0:HENL-Close frames)) n (R0:HENL-Close frames)) result))) (reverse result)) (defun R0:HENL-Split (s) (mapcar 'car (R0:HENL-Records s))) (defun R0:HENL-Normalize (s) (while (vl-string-search (strcat (chr 13) (chr 10)) s) (setq s (vl-string-subst "\\P" (strcat (chr 13) (chr 10)) s))) (while (vl-string-search (chr 13) s) (setq s (vl-string-subst "\\P" (chr 13) s))) (while (vl-string-search (chr 10) s) (setq s (vl-string-subst "\\P" (chr 10) s))) s) (defun R0:HENL-Register (obj) (setq henl-created (cons obj henl-created)) obj) (defun R0:HENL-Box (obj / lo hi) (vla-Update obj) (vla-GetBoundingBox obj 'lo 'hi) (list (vlax-safearray->list lo) (vlax-safearray->list hi))) (defun R0:HENL-Props (obj src) (vla-put-Layer obj (vla-get-Layer src)) (vla-put-TrueColor obj (vla-get-TrueColor src)) obj) (defun R0:HENL-Text (space src content width h at attach / obj) (setq obj (R0:HENL-Register (vla-AddMText space (vlax-3d-point at) width content))) (R0:HENL-Props obj src) (vla-put-StyleName obj (vla-get-StyleName src)) (vla-put-Height obj h) (vla-put-Rotation obj 0.0) (vla-put-AttachmentPoint obj attach) (vla-put-InsertionPoint obj (vlax-3d-point at)) (vla-put-LineSpacingStyle obj (vla-get-LineSpacingStyle src)) (vla-put-LineSpacingFactor obj (vla-get-LineSpacingFactor src)) obj) (defun R0:HENL-Hex (space src center side / coords k a arr obj) (setq k 5) (repeat 6 (setq a (* pi (/ k 3.0)) coords (cons (+ (car center) (* side (cos a))) (cons (+ (cadr center) (* side (sin a))) coords)) k (1- k))) (setq arr (vlax-make-safearray vlax-vbDouble '(0 . 11))) (vlax-safearray-fill arr coords) (setq obj (R0:HENL-Register (vla-AddLightWeightPolyline space arr))) (R0:HENL-Props obj src) (vla-put-Elevation obj (caddr center)) (vla-put-Closed obj :vlax-true) (vla-put-ConstantWidth obj 0.0) (vla-put-Lineweight obj 0) obj) (defun R0:HENL-Number (space src number center h side / obj box w ht factor p q) (setq obj (R0:HENL-Text space src (itoa number) 0.0 h center 5) box (R0:HENL-Box obj) p (car box) q (cadr box) w (- (car q) (car p)) ht (- (cadr q) (cadr p)) factor (min 1.0 (/ (* side 1.45) (max w 1e-12)) (/ (* side 1.2) (max ht 1e-12)))) (if (< factor 1.0) (vla-put-Height obj (* h factor))) (setq box (R0:HENL-Box obj) p (car box) q (cadr box)) (vla-Move obj (vlax-3d-point (mapcar '(lambda (a b) (/ (+ a b) 2.0)) p q)) (vlax-3d-point center)) obj) (defun R0:HENL-Fill (space src boundary / arr obj) (setq arr (vlax-make-safearray vlax-vbObject '(0 . 0))) (vlax-safearray-put-element arr 0 boundary) (setq obj (R0:HENL-Register (vla-AddHatch space 0 "SOLID" :vlax-false 0))) (vla-AppendOuterLoop obj arr) (vla-put-Elevation obj (vla-get-Elevation boundary)) (vla-put-Layer obj (vla-get-Layer src)) (vla-put-Color obj 255) (vla-put-EntityTransparency obj "0") (vla-Evaluate obj) (setq henl-fills (cons obj henl-fills)) obj) (defun R0:HENL-FillsBack (space / dict table arr) (if henl-fills (progn (setq dict (vla-GetExtensionDictionary space) table (vl-catch-all-apply 'vla-GetObject (list dict "ACAD_SORTENTS"))) (if (vl-catch-all-error-p table) (setq table (vla-AddObject dict "ACAD_SORTENTS" "AcDbSortentsTable"))) (setq arr (vlax-make-safearray vlax-vbObject (cons 0 (1- (length henl-fills))))) (vlax-safearray-fill arr henl-fills) (vla-MoveToBottom table arr)))) (defun R0:HENL-CenterY (obj box cy / mid) (setq mid (/ (+ (cadar box) (cadadr box)) 2.0)) (vla-Move obj (vlax-3d-point '(0.0 0.0 0.0)) (vlax-3d-point (list 0.0 (- cy mid) 0.0))) obj) (defun R0:HENL-Discard (obj) (vla-Delete obj) (setq henl-created (vl-remove obj henl-created))) (defun R0:HENL-InPlace (space src content records height width point initial / probe single box top left side rec prefix total partheight cy center boundary number previous overlaps) (setq probe (R0:HENL-Text space src content width height point (vla-get-AttachmentPoint src))) (vla-put-Visible probe :vlax-false) (setq box (R0:HENL-Box probe) top (cadadr box) left (caar box) side (* 1.8 height) number initial overlaps 0) (vla-put-AttachmentPoint probe 1) (vla-put-InsertionPoint probe (vlax-3d-point point)) (setq single (R0:HENL-Text space src "M" width height point 1)) (vla-put-Visible single :vlax-false) (foreach rec records (setq prefix (strcat "{" (substr content 1 (cadr rec)) (caddr rec))) (vla-put-TextString probe prefix) (setq box (R0:HENL-Box probe) total (- (cadadr box) (cadar box))) (vla-put-TextString single (car rec)) (setq box (R0:HENL-Box single) partheight (- (cadadr box) (cadar box)) cy (+ (- top total) (/ partheight 2.0)) center (list (- left side (* 0.7 height)) cy (caddr point))) (if (and previous (< (abs (- previous cy)) (* (sqrt 3.0) side))) (setq overlaps (1+ overlaps))) (setq boundary (R0:HENL-Hex space src center side)) (R0:HENL-Fill space src boundary) (R0:HENL-Number space src number center height side) (setq previous cy number (1+ number))) (R0:HENL-Discard single) (R0:HENL-Discard probe) (if (> overlaps 0) (princ (strcat "\n[!] " (itoa overlaps) " pairs of hexagons may overlap: insufficient paragraph spacing."))) number) (defun R0:HENL-Initial (/ s n valid) (while (not valid) (setq s (getstring "\nStarting NUMBER <1>: ")) (if (= s "") (setq s "1")) (if (and (<= (strlen s) 9) (vl-every '(lambda (c) (and (>= c 48) (<= c 57))) (vl-string->list s))) (setq n (atoi s) valid T) (princ "\nEnter an integer from 0 to 999999999."))) n) (defun R0:HENL-Annotative (ename / data) (setq data (assoc -3 (entget ename '("AcadAnnotative")))) (and data (member '(1070 . 1) (cdr (cadr data))))) (defun R0:HENL-Select (/ pick en data layer done) (while (not done) (setq pick (entsel "\nHENL | Select the MTEXT to number <Exit>: ")) (cond ((null pick) (setq done T en nil)) (T (setq en (car pick) data (entget en) layer (tblsearch "LAYER" (cdr (assoc 8 data)))) (cond ((/= (cdr (assoc 0 data)) "MTEXT") (princ "\nSelect an MTEXT object, not single-line text or a block.")) ((/= 0 (logand 5 (cdr (assoc 70 layer)))) (princ "\nThe layer is locked or frozen.")) ((minusp (cdr (assoc 62 layer))) (princ "\nThe layer is turned off.")) (T (setq done T)))))) en) (defun R0:HENL-Cleanup (rollback / obj result) (if (and rollback henl-retiring henl-source (null (entget henl-source))) (if (not (entdel henl-source)) (princ "\n[!] Check whether the original MTEXT was restored."))) (if rollback (foreach obj henl-created (setq result (vl-catch-all-apply 'vla-Delete (list obj))) (if (vl-catch-all-error-p result) (princ "\n[!] Could not remove an output object; check the drawing.")))) (if henl-highlight (vl-catch-all-apply 'redraw (list henl-source 4))) (if henl-undo (vl-catch-all-apply 'vla-EndUndoMark (list henl-doc))) (foreach obj henl-vars (vl-catch-all-apply 'setvar (list (car obj) (cdr obj)))) (princ)) (defun R0:HENL-Run (relocate / *error* henl-msg henl-created henl-source henl-highlight henl-doc henl-undo henl-vars henl-retiring henl-fills src data content parts height width angle normal space initial option point side cy center para textobj box realheight obj number style rowheight bottom boundary records) (defun *error* (msg) (R0:HENL-Cleanup T) (cond (henl-msg (princ (strcat "\n[!] HENL: " henl-msg))) ((and msg (not (wcmatch (strcase msg) "*CANCEL*,*QUIT*,*BREAK*,*EXIT*"))) (princ (strcat "\n[!] HENL: " msg))) (T (princ "\nHENL canceled. Original preserved."))) (princ)) (setq henl-doc (vla-get-ActiveDocument (vlax-get-acad-object)) henl-vars (list (cons "DYNMODE" (getvar "DYNMODE")) (cons "DYNPROMPT" (getvar "DYNPROMPT")))) (setvar "DYNMODE" 3) (setvar "DYNPROMPT" 1) (if (setq henl-source (R0:HENL-Select)) (progn (setq src (vlax-ename->vla-object henl-source) data (entget henl-source) content (R0:HENL-Normalize (vla-get-TextString src)) height (vla-get-Height src) width (vla-get-Width src) angle (vla-get-Rotation src) normal (cdr (assoc 210 data)) style (tblobjname "STYLE" (vla-get-StyleName src))) (if (and normal (not (equal normal '(0.0 0.0 1.0) 1e-8))) (R0:HENL-Fail "This version requires text on a plane parallel to WCS XY.")) (if (vl-string-search "%<" content) (R0:HENL-Fail "MTEXT fields are not supported; the original has been preserved.")) (if (and (assoc 75 data) (/= 0 (cdr (assoc 75 data)))) (R0:HENL-Fail "Disable MTEXT columns before numbering.")) (if (or (= (cdr (assoc 72 data)) 3) (/= 0 (logand 4 (cdr (assoc 70 (tblsearch "STYLE" (vla-get-StyleName src))))))) (R0:HENL-Fail "Vertical text is not supported in this version.")) (if (or (R0:HENL-Annotative henl-source) (and style (R0:HENL-Annotative style))) (R0:HENL-Fail "Use non-annotative MTEXT and a non-annotative text style.")) (if (<= height 0.0) (R0:HENL-Fail "Invalid text height.")) (setq records (R0:HENL-Records content) parts (mapcar 'car records)) (if (null parts) (R0:HENL-Fail "No non-empty paragraphs found.")) (if (> (length parts) 10000) (R0:HENL-Fail "The limit is 10000 paragraphs per run.")) (redraw henl-source 3) (setq henl-highlight T) (princ (strcat "\n" (itoa (length parts)) " paragraphs | Hexagon side length: " (rtos (* 1.8 height) 2 4))) (setq initial (R0:HENL-Initial)) (if relocate (progn (initget "Keep Delete") (setq option (getkword "\nORIGINAL [Keep/Delete] <Keep>: ")) (initget 1) (setq point (trans (getpoint (strcat "\nCenter of the FIRST hexagon (" (itoa initial) "): ")) 1 0))) (setq option "Keep" point (vlax-safearray->list (vlax-variant-value (vla-get-InsertionPoint src))))) (setq space (vlax-ename->vla-object (cdr (assoc 330 (reverse data))))) (if (and (= 1 (logand 1 (getvar "UNDOCTL"))) (= 0 (logand 8 (getvar "UNDOCTL")))) (progn (vla-StartUndoMark henl-doc) (setq henl-undo T))) (setq side (* 1.8 height) cy (cadr point) number initial) (if relocate (progn (foreach para parts (setq textobj (R0:HENL-Text space src para width height (list (+ (car point) side (* 0.7 height)) cy (caddr point)) 1) box (R0:HENL-Box textobj) realheight (- (cadadr box) (cadar box)) rowheight (max realheight (* (sqrt 3.0) side))) (if bottom (setq cy (- bottom (* 0.8 height) (/ rowheight 2.0)))) (R0:HENL-CenterY textobj box cy) (setq center (list (car point) cy (caddr point)) boundary (R0:HENL-Hex space src center side)) (R0:HENL-Fill space src boundary) (R0:HENL-Number space src number center height side) (setq bottom (- cy (/ rowheight 2.0)) number (1+ number)))) (setq number (R0:HENL-InPlace space src content records height width point initial))) (foreach obj henl-created (if (not (equal angle 0.0 1e-12)) (vla-Rotate obj (vlax-3d-point point) angle)) (vla-Update obj) (if (not (entget (vlax-vla-object->ename obj))) (R0:HENL-Fail "Could not verify the output."))) (if (/= (length henl-created) (* (if relocate 4 3) (length parts))) (R0:HENL-Fail "The output is incomplete.")) (R0:HENL-FillsBack space) (vla-Regen henl-doc 0) (redraw henl-source 4) (setq henl-highlight nil) (if (= option "Delete") (progn (setq henl-retiring T) (if (not (entdel henl-source)) (R0:HENL-Fail "Could not delete the original.")))) (setq henl-created nil henl-retiring nil) (R0:HENL-Cleanup nil) (princ (strcat "\n[OK] " (itoa (length parts)) " paragraphs | Numbers " (itoa initial) " to " (itoa (1- number)) " | " (if relocate (strcat "Original " (if (= option "Delete") "deleted." "preserved.")) "Original MTEXT unchanged.")))) (R0:HENL-Cleanup nil)) (princ)) (defun c:HEXENUML () (R0:HENL-Run nil)) (defun c:HENL () (R0:HENL-Run nil)) (defun c:HEXENUMLC () (R0:HENL-Run T)) (defun c:HENLC () (R0:HENL-Run T)) (princ "\nHEXENUM 1.2 (loose geometry) | HENL: number in place | HENLC: create at another point.") (princ) ;;; HEXENUM 1.3 - Block with NUM attribute | AutoCAD Windows / Visual LISP ;;; HENB / HEXENUMB: number the existing MTEXT in place. ;;; HENBC / HEXENUMBC: create separate paragraphs at a picked location. ;;; Hexagon side = 1.8 x nominal text height; SOLID fill = ACI 255. ;;; Both editions can be loaded together; command and helper names are isolated. (vl-load-com) (defun R0:HENB-Fail (msg) (setq henb-msg msg) (exit)) (defun R0:HENB-Prefix (frames / result frame) (setq result "") (foreach frame (reverse frames) (setq result (strcat result "{" frame))) result) (defun R0:HENB-Close (frames / result) (setq result "") (repeat (length frames) (setq result (strcat result "}"))) result) (defun R0:HENB-Records (s / i n ch next token frames part visible result j brk start) (setq i 1 n (strlen s) frames (list "") part "{" visible nil) (while (<= i n) (setq start i ch (substr s i 1) next (substr s (1+ i) 1) brk nil) (cond ((or (= ch (chr 10)) (= ch (chr 13))) (setq brk T) (if (and (= ch (chr 13)) (= next (chr 10))) (setq i (1+ i))) (setq i (1+ i))) ((= ch "\\") (cond ((= next "P") (setq brk T i (+ i 2))) ((= next "N") (R0:HENB-Fail "Column breaks found. Set the MTEXT to a single column.")) ((member next '("\\" "{" "}" "~")) (setq part (strcat part (substr s i 2)) i (+ i 2)) (if (/= next "~") (setq visible T))) ((member next '("A" "C" "c" "F" "f" "H" "Q" "T" "W" "p" "S")) (setq j (+ i 2)) (while (and (<= j n) (/= (substr s j 1) ";")) (setq j (1+ j))) (if (> j n) (R0:HENB-Fail "Incomplete MTEXT formatting code.")) (setq token (substr s i (1+ (- j i))) part (strcat part token) i (1+ j)) (if (= next "S") (setq visible T) (setq frames (cons (strcat (car frames) token) (cdr frames))))) ((member next '("L" "l" "O" "o" "K" "k")) (setq token (substr s i 2) part (strcat part token) i (+ i 2) frames (cons (strcat (car frames) token) (cdr frames)))) ((and (= next "U") (= (substr s (+ i 2) 1) "+")) (setq part (strcat part (substr s i 7)) i (+ i 7) visible T)) (T (setq part (strcat part ch) i (1+ i) visible T)))) ((= ch "{") (setq frames (cons "" frames) part (strcat part ch) i (1+ i))) ((= ch "}") (if (null (cdr frames)) (R0:HENB-Fail "Unbalanced formatting braces.")) (setq frames (cdr frames) part (strcat part ch) i (1+ i))) (T (setq part (strcat part ch) i (1+ i)) (if (not (member ch (list " " (chr 9)))) (setq visible T)))) (if brk (progn (if visible (setq result (cons (list (strcat part (R0:HENB-Close frames)) (1- start) (R0:HENB-Close frames)) result))) (setq part (R0:HENB-Prefix frames) visible nil)))) (if (/= (length frames) 1) (R0:HENB-Fail "Unbalanced formatting braces.")) (if visible (setq result (cons (list (strcat part (R0:HENB-Close frames)) n (R0:HENB-Close frames)) result))) (reverse result)) (defun R0:HENB-Split (s) (mapcar 'car (R0:HENB-Records s))) (defun R0:HENB-Normalize (s) (while (vl-string-search (strcat (chr 13) (chr 10)) s) (setq s (vl-string-subst "\\P" (strcat (chr 13) (chr 10)) s))) (while (vl-string-search (chr 13) s) (setq s (vl-string-subst "\\P" (chr 13) s))) (while (vl-string-search (chr 10) s) (setq s (vl-string-subst "\\P" (chr 10) s))) s) (defun R0:HENB-Register (obj) (setq henb-created (cons obj henb-created)) obj) (defun R0:HENB-Box (obj / lo hi) (vla-Update obj) (vla-GetBoundingBox obj 'lo 'hi) (list (vlax-safearray->list lo) (vlax-safearray->list hi))) (defun R0:HENB-Props (obj src) (vla-put-Layer obj (vla-get-Layer src)) (vla-put-TrueColor obj (vla-get-TrueColor src)) obj) (defun R0:HENB-Text (space src content width h at attach / obj) (setq obj (R0:HENB-Register (vla-AddMText space (vlax-3d-point at) width content))) (R0:HENB-Props obj src) (vla-put-StyleName obj (vla-get-StyleName src)) (vla-put-Height obj h) (vla-put-Rotation obj 0.0) (vla-put-AttachmentPoint obj attach) (vla-put-InsertionPoint obj (vlax-3d-point at)) (vla-put-LineSpacingStyle obj (vla-get-LineSpacingStyle src)) (vla-put-LineSpacingFactor obj (vla-get-LineSpacingFactor src)) obj) (defun R0:HENB-BlockDef (doc nom / blks blk coords k a arr pl hat lazo att) (if (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-Item (list (vla-get-Blocks doc) nom)))) T (progn (setq blks (vla-get-Blocks doc) blk (vla-Add blks (vlax-3d-point '(0.0 0.0 0.0)) nom) k 5 coords nil) (repeat 6 (setq a (* pi (/ k 3.0)) coords (cons (cos a) (cons (sin a) coords)) k (1- k))) (setq arr (vlax-make-safearray vlax-vbDouble '(0 . 11))) (vlax-safearray-fill arr coords) (setq pl (vla-AddLightWeightPolyline blk arr)) (vla-put-Closed pl :vlax-true) (setq hat (vla-AddHatch blk 0 "SOLID" :vlax-false 0) lazo (vlax-make-safearray vlax-vbObject '(0 . 0))) (vlax-safearray-put-element lazo 0 pl) (vla-AppendOuterLoop hat lazo) (vla-put-Layer hat "0") (vla-put-Color hat 255) (vla-Evaluate hat) (vla-Delete pl) (setq pl (vla-AddLightWeightPolyline blk arr)) (vla-put-Closed pl :vlax-true) (vla-put-Layer pl "0") (vla-put-ConstantWidth pl 0.0) (setq att (vla-AddAttribute blk (/ 1.0 1.8) 0 "Number" (vlax-3d-point '(0.0 0.0 0.0)) "NUM" "1")) (vla-put-Layer att "0") (vla-put-Alignment att 10) (vla-put-TextAlignmentPoint att (vlax-3d-point '(0.0 0.0 0.0))) (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-Item (list blks nom))))))) (defun R0:HENB-Marker (space src center side number / obj atts a box p q w ht factor) (setq obj (R0:HENB-Register (vla-InsertBlock space (vlax-3d-point center) "IR_HEX" side side side 0.0))) (vla-put-Layer obj (vla-get-Layer src)) (vla-put-TrueColor obj (vla-get-TrueColor src)) (setq atts (vl-catch-all-apply 'vla-GetAttributes (list obj))) (if (vl-catch-all-error-p atts) (R0:HENB-Fail "Could not read the marker attributes.") (foreach a (vlax-safearray->list (vlax-variant-value atts)) (vla-put-TextString a (itoa number)) (setq box (R0:HENB-Box a) p (car box) q (cadr box) w (- (car q) (car p)) ht (- (cadr q) (cadr p)) factor (min 1.0 (/ (* side 1.45) (max w 1e-12)) (/ (* side 1.2) (max ht 1e-12)))) (if (< factor 1.0) (vla-put-Height a (* (vla-get-Height a) factor))) (if (/= (itoa number) (vla-get-TextString a)) (R0:HENB-Fail (strcat "Marker " (itoa number) " has no number."))))) obj) (defun R0:HENB-CenterY (obj box cy / mid) (setq mid (/ (+ (cadar box) (cadadr box)) 2.0)) (vla-Move obj (vlax-3d-point '(0.0 0.0 0.0)) (vlax-3d-point (list 0.0 (- cy mid) 0.0))) obj) (defun R0:HENB-Discard (obj) (vla-Delete obj) (setq henb-created (vl-remove obj henb-created))) (defun R0:HENB-InPlace (space src content records height width point initial / probe single box top left side rec prefix total partheight cy center number previous overlaps) (setq probe (R0:HENB-Text space src content width height point (vla-get-AttachmentPoint src))) (vla-put-Visible probe :vlax-false) (setq box (R0:HENB-Box probe) top (cadadr box) left (caar box) side (* 1.8 height) number initial overlaps 0) (vla-put-AttachmentPoint probe 1) (vla-put-InsertionPoint probe (vlax-3d-point point)) (setq single (R0:HENB-Text space src "M" width height point 1)) (vla-put-Visible single :vlax-false) (foreach rec records (setq prefix (strcat "{" (substr content 1 (cadr rec)) (caddr rec))) (vla-put-TextString probe prefix) (setq box (R0:HENB-Box probe) total (- (cadadr box) (cadar box))) (vla-put-TextString single (car rec)) (setq box (R0:HENB-Box single) partheight (- (cadadr box) (cadar box)) cy (+ (- top total) (/ partheight 2.0)) center (list (- left side (* 0.7 height)) cy (caddr point))) (if (and previous (< (abs (- previous cy)) (* (sqrt 3.0) side))) (setq overlaps (1+ overlaps))) (R0:HENB-Marker space src center side number) (setq previous cy number (1+ number))) (R0:HENB-Discard single) (R0:HENB-Discard probe) (if (> overlaps 0) (princ (strcat "\n[!] " (itoa overlaps) " pairs of hexagons may overlap: insufficient paragraph spacing."))) number) (defun R0:HENB-Initial (/ s n valid) (while (not valid) (setq s (getstring "\nStarting NUMBER <1>: ")) (if (= s "") (setq s "1")) (if (and (<= (strlen s) 9) (vl-every '(lambda (c) (and (>= c 48) (<= c 57))) (vl-string->list s))) (setq n (atoi s) valid T) (princ "\nEnter an integer from 0 to 999999999."))) n) (defun R0:HENB-Annotative (ename / data) (setq data (assoc -3 (entget ename '("AcadAnnotative")))) (and data (member '(1070 . 1) (cdr (cadr data))))) (defun R0:HENB-Select (/ pick en data layer done) (while (not done) (setq pick (entsel "\nHENB | Select the MTEXT to number <Exit>: ")) (cond ((null pick) (setq done T en nil)) (T (setq en (car pick) data (entget en) layer (tblsearch "LAYER" (cdr (assoc 8 data)))) (cond ((/= (cdr (assoc 0 data)) "MTEXT") (princ "\nSelect an MTEXT object, not single-line text or a block.")) ((/= 0 (logand 5 (cdr (assoc 70 layer)))) (princ "\nThe layer is locked or frozen.")) ((minusp (cdr (assoc 62 layer))) (princ "\nThe layer is turned off.")) (T (setq done T)))))) en) (defun R0:HENB-Cleanup (rollback / obj result) (if (and rollback henb-retiring henb-source (null (entget henb-source))) (if (not (entdel henb-source)) (princ "\n[!] Check whether the original MTEXT was restored."))) (if rollback (foreach obj henb-created (setq result (vl-catch-all-apply 'vla-Delete (list obj))) (if (vl-catch-all-error-p result) (princ "\n[!] Could not remove an output object; check the drawing.")))) (if henb-highlight (vl-catch-all-apply 'redraw (list henb-source 4))) (if henb-undo (vl-catch-all-apply 'vla-EndUndoMark (list henb-doc))) (foreach obj henb-vars (vl-catch-all-apply 'setvar (list (car obj) (cdr obj)))) (princ)) (defun R0:HENB-Run (relocate / *error* henb-msg henb-created henb-source henb-highlight henb-doc henb-undo henb-vars henb-retiring src data content parts height width angRot normal space initial option point side cy center para textobj box realheight obj number style rowheight bottom records) (defun *error* (msg) (R0:HENB-Cleanup T) (cond (henb-msg (princ (strcat "\n[!] HENB: " henb-msg))) ((and msg (not (wcmatch (strcase msg) "*CANCEL*,*QUIT*,*BREAK*,*EXIT*"))) (princ (strcat "\n[!] HENB: " msg))) (T (princ "\nHENB canceled. Original preserved."))) (princ)) (setq henb-doc (vla-get-ActiveDocument (vlax-get-acad-object)) henb-vars (list (cons "DYNMODE" (getvar "DYNMODE")) (cons "DYNPROMPT" (getvar "DYNPROMPT")))) (setvar "DYNMODE" 3) (setvar "DYNPROMPT" 1) (if (setq henb-source (R0:HENB-Select)) (progn (setq src (vlax-ename->vla-object henb-source) data (entget henb-source) content (R0:HENB-Normalize (vla-get-TextString src)) height (vla-get-Height src) width (vla-get-Width src) angRot (vla-get-Rotation src) normal (cdr (assoc 210 data)) style (tblobjname "STYLE" (vla-get-StyleName src))) (if (and normal (not (equal normal '(0.0 0.0 1.0) 1e-8))) (R0:HENB-Fail "This version requires text on a plane parallel to WCS XY.")) (if (vl-string-search "%<" content) (R0:HENB-Fail "MTEXT fields are not supported; the original has been preserved.")) (if (and (assoc 75 data) (/= 0 (cdr (assoc 75 data)))) (R0:HENB-Fail "Disable MTEXT columns before numbering.")) (if (or (= (cdr (assoc 72 data)) 3) (/= 0 (logand 4 (cdr (assoc 70 (tblsearch "STYLE" (vla-get-StyleName src))))))) (R0:HENB-Fail "Vertical text is not supported in this version.")) (if (or (R0:HENB-Annotative henb-source) (and style (R0:HENB-Annotative style))) (R0:HENB-Fail "Use non-annotative MTEXT and a non-annotative text style.")) (if (<= height 0.0) (R0:HENB-Fail "Invalid text height.")) (setq records (R0:HENB-Records content) parts (mapcar 'car records)) (if (null parts) (R0:HENB-Fail "No non-empty paragraphs found.")) (if (> (length parts) 10000) (R0:HENB-Fail "The limit is 10000 paragraphs per run.")) (redraw henb-source 3) (setq henb-highlight T) (princ (strcat "\n" (itoa (length parts)) " paragraphs | Hexagon side length: " (rtos (* 1.8 height) 2 4))) (setq initial (R0:HENB-Initial)) (if relocate (progn (initget "Keep Delete") (setq option (getkword "\nORIGINAL [Keep/Delete] <Keep>: ")) (initget 1) (setq point (trans (getpoint (strcat "\nCenter of the FIRST hexagon (" (itoa initial) "): ")) 1 0))) (setq option "Keep" point (vlax-safearray->list (vlax-variant-value (vla-get-InsertionPoint src))))) (setq space (vlax-ename->vla-object (cdr (assoc 330 (reverse data))))) (if (and (= 1 (logand 1 (getvar "UNDOCTL"))) (= 0 (logand 8 (getvar "UNDOCTL")))) (progn (vla-StartUndoMark henb-doc) (setq henb-undo T))) (if (not (R0:HENB-BlockDef henb-doc "IR_HEX")) (R0:HENB-Fail "Could not create the IR_HEX block.")) (setq side (* 1.8 height) cy (cadr point) number initial) (if relocate (progn (foreach para parts (setq textobj (R0:HENB-Text space src para width height (list (+ (car point) side (* 0.7 height)) cy (caddr point)) 1) box (R0:HENB-Box textobj) realheight (- (cadadr box) (cadar box)) rowheight (max realheight (* (sqrt 3.0) side))) (if bottom (setq cy (- bottom (* 0.8 height) (/ rowheight 2.0)))) (R0:HENB-CenterY textobj box cy) (setq center (list (car point) cy (caddr point))) (R0:HENB-Marker space src center side number) (setq bottom (- cy (/ rowheight 2.0)) number (1+ number)))) (setq number (R0:HENB-InPlace space src content records height width point initial))) (foreach obj henb-created (if (not (equal angRot 0.0 1e-12)) (vla-Rotate obj (vlax-3d-point point) angRot)) (vla-Update obj) (if (not (entget (vlax-vla-object->ename obj))) (R0:HENB-Fail "Could not verify the output."))) (if (/= (length henb-created) (* (if relocate 2 1) (length parts))) (R0:HENB-Fail "The output is incomplete.")) (vla-Regen henb-doc 0) (redraw henb-source 4) (setq henb-highlight nil) (if (= option "Delete") (progn (setq henb-retiring T) (if (not (entdel henb-source)) (R0:HENB-Fail "Could not delete the original.")))) (setq henb-created nil henb-retiring nil) (R0:HENB-Cleanup nil) (princ (strcat "\n[OK] " (itoa (length parts)) " paragraphs | Numbers " (itoa initial) " to " (itoa (1- number)) " | " (if relocate (strcat "Original " (if (= option "Delete") "deleted." "preserved.")) "Original MTEXT unchanged.")))) (R0:HENB-Cleanup nil)) (princ)) (defun c:HEXENUMB () (R0:HENB-Run nil)) (defun c:HENB () (R0:HENB-Run nil)) (defun c:HEXENUMBC () (R0:HENB-Run T)) (defun c:HENBC () (R0:HENB-Run T)) (princ "\nHEXENUM 1.3 (block + attribute) | HENB: number in place | HENBC: create at another point.") (princ)
    1 point
  10. If you use notepad+ as an editor for Autolisp, the CTRL+ALT+b leaves a lot to be desired when it comes to selecting between brackets. The VLIDE double-click is much more satisfying. So here is an AutoHotKey script that gives you this functionnality while preserving the normal Dbl-Click of notepad+: #Requires AutoHotkey v2.0 #SingleInstance Off ; 1. Set up a unique communication highway (MsgNumber 0x401) OnMessage(0x401, ReceiveCloseSignal) ReceiveCloseSignal(wParam, lParam, msg, hwnd) { ExitApp } ; 2. Find any running old instance (ignoring itself) and send it the "Self-Destruct" signal DetectHiddenWindows True if (oldScriptHwnd := WinExist(A_ScriptFullPath " ahk_class AutoHotkey")) { if (oldScriptHwnd != A_ScriptHwnd) { ; Ensure the script doesn't close itself! PostMessage(0x401, 0, 0, , "ahk_id " oldScriptHwnd) WinWaitClose("ahk_id " oldScriptHwnd, , 2) } } ; 3. Automatically relaunch the script using UI Access to bypass UAC entirely if !A_IsCompiled && !InStr(A_AhkPath, "_UIA.exe") { uiaPath := RegExReplace(A_AhkPath, "\.exe$", "_UIA.exe") if FileExist(uiaPath) { try { Run('"' uiaPath '" "' A_ScriptFullPath '"') ExitApp } } } ; 4. Your Application-Specific Hotkeys #HotIf WinActive("ahk_class Notepad++") ~LButton:: { static lastClick := 0 currentClick := A_TickCount if (currentClick - lastClick < DllCall("GetDoubleClickTime")) { KeyWait("LButton") Sleep(60) SendEvent("^!b") lastClick := 0 } else { lastClick := currentClick } } #HotIf Link to download AutoHotKey https://www.autohotkey.com also available on Microsoft app store (Free) NppBrackets.ahk
    1 point
  11. In the past lots of napkins, drawn on hands, cardboard (both drawn on and cut to some weird shape), no rubber gloves, but work gloves. Not for CAD, but, I have hade to build things to hammer handles, coworkers hand size, etc. when somehow nobody had a tape measure. And NO, I wasn't laughing, I am serious, AI has it's uses, but some things it will never get a grasp of IMO. Though I only have tried the free stuff, maybe paid for is better, I did like some of the images to video I did on TikTok and the special effects on some of the grandkids sports videos.
    1 point
  12. Hard to compare without seeing the original. I have redone PDFs a good bit in the past, some go very quickly (vector and some raster) others are a mess from the start, different scales, fat lines, blurry lines and Text etc. What can AI do when you hand it a scribbled on wet napkin?
    1 point
  13. Intriguing to use AI to draw it all for you - certainly could speed up things - I'd need to thoroughly check a few times to gain confidence in the process. My approach is slightly different generally. Recent PDFs done with CAD allow you to convert to lines, arc, and so on but the accuracy might be off. I'll scale the PDF, convert and then snap entities to a grid again - often 1.25 or 2.5mm - and that usually gets the right result... on a PDF that can be converted. A mix of both, yours and mine could get good results. Our biggest problem is historic records - scanned paper copies originally drawn in pen and ink - now that would be a good work out for AI !
    1 point
  14. After installing the above bundle, everything works as expected. (To install these bundle, a free vedacad account is sufficient.) --- After nearly 40 emails of intense communication with @Paul Li, I saw the professionalism and rigor of the senior developer, and this real feedback after actual use has taken VedaCAD a big step forward. Thank you @Paul Li
    1 point
  15. here's 2 for h&v alignment:..DIM.Fix.Y.Leaders.lsp ..DIM.Fix.X.Leaders.lsp
    1 point
  16. This was created using a pdf as the base and Cadarc architectural program over the top, internal doors to be added.
    1 point
  17. As @VicoWang mentioned I've been running some major tests implementing this new VedaCAD system of deploying 3rd party add-ons in my case specifically to AutoCAD users. @VicoWang has been really responsive with all my feedback. I'm fairly impressed with how this provides a software developer like myself another platform to push out my apps to end users to implement on their AutoCAD system. Along with AutoCAD users, I'm hoping AutoCAD LT 2024 and higher version users will also try installing and running these apps. Since currently the Autodesk App Store (now known as the Design & Make Marketplace) do not support AutoCAD LT, this VCID deployment method provides an excellent solution to have AutoLISP coded apps load & run on LT. The following is a list of my VCIDs: [DDCalc] VCID: B-NN9XC DDCalc is an on screen graphical calculator within Autodesk® AutoCAD® that supports feet, inch & fractional numeric entries. [DDList] VCID: B-NLR04 DDList is Autodesk® AutoCAD® basic list command but on steroids. [DwgSetup] VCID: B-4K6UL DwgSetup App offers two user friendly graphic user interface commands to make drawing setup changes: (1) DDSetup and (2) DDDwgunits [VpScale App] VCID: B-31VQK VpScale Apps offers two very useful Viewport Scaling Applications: DDZmVpSc & DDSetVpSc [VTN] VCID: B-0Z8Q6 Virtual Tablet Navigator (VTN) is an add-on AutoLISP application using DCL to bring Autodesk® AutoCAD® physical Tablet Menu commands virtually onto the graphics screen. [XOM] VCID: B-09NQD Xref Object Manager (XOM) is an AutoLISP application using a dynamic dialog box to present built-in & added operations to manage External Reference Objects displayed both in a Tree and a List view.
    1 point
  18. Never thought about that - I always still use ctrl+ V / C - means I have to let go of the mouse every now and then
    1 point
  19. This is a port of BrxBlockMan to Python. should be a good sample of how to use a lot of the API, Palettes, Jigs, Cloning Etc. - select a drawing from the directory control - double click or drag a block from the List control to the current drawing - double click the main preview to insert the whole drawing - click the open folder button to add your favorite folder(s) - use the dropdown to navigate to a favorite folder - right click on a dwg to open it in Bricscad - right click on a folder to add it to favorites - right click on the dropdown ctrl to clear favorites https://github.com/CEXT-Dan/PyRx/tree/main/PySamples/wxPython/BlockMan Requires PyRx, BlockMan.py and BlockMan.xrc should be in the same folder
    1 point
  20. If it doesn't kill us, it makes us stronger...and older! Growing old beats the hell out of the only other option.
    1 point
  21. Yes, you are correct. The AI bots do not declare themselves like search engine bots do, they remain anonymous, so it's not possible to target only AI bots. Blocking all bots effectively destroys a site's SEO and search indexing. So my approach (at the moment) is to ride out the storm and see if it eases in the future.
    1 point
  22. Hello friends, I have noticed the same intermittent errors. As some have suggested, this seems to be to do with AI bot activity which floods available resources, making it difficult to serve pages to real users. I am hoping this will subside over time, once all models have gorged themselves on our content. Right now we have two choices. We can either add a Capture test that means you need to complete an action before getting access to the forum (this basically filters out the bots) or we just put up with random errors for now. Let me know what you think.
    1 point
  23. LJade: Here is an example of what I mentioned in my previous post. Note that the channel supports the steel decking, and the decking supports the concrete. The rebar is embedded in the concrete. Note the flashing and canted drip edge in the example as well.
    1 point
  24. @Steven P not sure if this is what you mean, but I have pick attribute in say title block in a layout and it will copy that attribute value into the correct attribute in all blocks of that name, I think also a do multiple atts, handy when say you change a project description, updates all layouts etc.
    1 point
  25. When it comes to keeping copies of various revisions completed, file naming and renaming could become really tricky especially if they're externally referenced to other dwgs. So to avoid having to repath dwgs that may be referenced elsewhere, what I've done in the past is to have the most current dwg always named the same and stored in the same location. A folder is created with the revision date as the name and the dwg is then copied into that folder. Now I have preserved copies of major milestone revisions saved in the project folder.
    1 point
  26. This is something I hate to do, but sometimes I'm in a hurry. One title block may be different in some fundamental way. I can't just explode it, because I'll lose all the information in the attributes. There's not enough time to create an entire block for one sheet, and why bother when there's only one? So it's time to Burst a move (sorry).
    1 point
  27. That sounds like a fake Norton Pop-Up, ISeeYou, used to be (is?) an older vulnerability for web cams, I guy was activating webcams without the activation light on and blackmailing women with photos, he was caught and arrested a while back. I'll look for the article. Here is the Wiki iSeeYou - Wikipedia This looks to be a good while back.
    1 point
  28. Likewise, we save a full copy of the as issued drawings, plus the PDF mark ups and check prints each in a separate folder. Unless specified otherwise all our files are suffixed with the revision code. Mark ups and check prints are in sequentially numbered and dated folders - so we can always go back. Typical folders: 1.0 Working Drawings 2.0 Check Prints - 2.1 Check Print 01-01-26 - 2.2 Check Print 15-03-26 3.0 Markups - 3.1 Markup 01-01-26 - 3.2 Markup 10 -03-26 4.0 Previous Versions And of course if there is a significant change between issues, I'll save the before and after away somewhere safe We usually issue PDFs during the project and if required the as-builts as dwgs right at the end I believe that the construction cloud saves each save as a new version whether it is a new revision or not
    1 point
  29. Like others if a revision then a dwg was saved. We also saved a "AS Built" dwg, all our dwg's were recorded and could be looked up, we went back to 1999. They were saved as Tiffs later on as Pdf's. As we controlled the dwg's in regards to access by others, server locked, we made sure only the latest version was in the current working directory, we had a superseded directory. As part of document control a new project had specific directories premade.
    1 point
  30. This is one of the knottiest issues in engineering work. What constitutes a full revision? When do you issue a partial revision, if you do at all? How do you track the changes? How do you roll them back if necessary? Worst of all, different shops use different criteria, and sometimes the same shop uses different criteria for different projects. It seems like common sense, since storage is so cheap these days, to save a new copy of the drawing for each revision, and append the revision number to the file name. That way the old revisions are still available if you need to refer to them or send them to someone. Even better, keep the revisions in a subfolder so they don't clutter up the main project folder. And this should go without saying--keep current backups! The current working file should have the project name (or whatever) with no revision number. Again, though, some shops will use different standards. For smaller projects, there's no need to keep old revisions, especially if you've sent them out all along. You can go back to those emails for attached copies of old drawings. As always, simpler is better. Make a plan and stick to it. Otherwise you're asking for trouble.
    1 point
  31. It may now look like a "Medion Design USB Graphics pad". Yes did get it to work with CAD but went back to a mouse, I dont do enough true drafting to really get into using it. Maybe Win 10.
    1 point
×
×
  • Create New...