Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/10/2025 in all areas

  1. Thanks to GLAVCVS and BIGAL ;; https://www.cadtutor.net/forum/topic/97779-specify-the-height-mark-at-the-base-point-of-the-blocks/ ;; Thanks to GLAVCVS and BIGAL 10.05.2025 ;; 1. Select the base block — "0.000". ;; 2. Select all the blocks (along with the base block). ;; The code will process only those with the same effective name as the base effective name. ;; The marks will appear 600 mm above the insertion of each block. ;; The code works with static and dynamic blocks. (defun c:MarkElev-EffNm (/ doc dmzAnt baseSS baseEnt baseObj baseEffName basePt allSS n ent entObj effName pt cota etq #etq) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (setq dmzAnt (getvar "DIMZIN")) (setvar "DIMZIN" 0) (princ "\nSelect the base block (INSERT): ") (if (setq baseSS (ssget "_+.:E:S" '((0 . "INSERT")))) (progn (setq baseEnt (ssname baseSS 0)) (setq baseObj (vlax-ename->vla-object baseEnt)) (setq baseEffName (vla-get-EffectiveName baseObj)) (setq basePt (cdr (assoc 10 (entget baseEnt)))) (princ (strcat "\nEffectiveName the base block: " baseEffName)) (princ "\nSelect all the blocks to mark: ") (if (setq allSS (ssget '((0 . "INSERT")))) (progn (setq n 0) (while (< n (sslength allSS)) (setq ent (ssname allSS n)) (setq entObj (vlax-ename->vla-object ent)) (setq effName (vla-get-EffectiveName entObj)) (setq pt (cdr (assoc 10 (entget ent)))) (if (= effName baseEffName) (progn (if (equal pt basePt 1e-6) (entmakex (list (cons 0 "TEXT") (cons 10 (list (car pt) (+ (cadr pt) 600))) (cons 40 250) (cons 1 "0.000") (cons 50 0.0) (cons 7 (getvar "TEXTSTYLE")) (cons 8 (getvar "CLAYER")) ) ) (progn (setq cota pt) (setq #etq (/ (- (cadr cota) (cadr basePt)) 1000.0)) (setq etq (if (minusp #etq) (rtos #etq 2 3) (strcat "+" (rtos #etq 2 3)) ) ) (entmakex (list (cons 0 "TEXT") (cons 10 (list (car cota) (+ (cadr cota) 600))) (cons 40 250) (cons 1 etq) (cons 50 0.0) (cons 7 (getvar "TEXTSTYLE")) (cons 8 (getvar "CLAYER")) ) ) ) ) ) ) (setq n (1+ n)) ) ) ) ) ) (setvar "DIMZIN" dmzAnt) (princ) )
    1 point
  2. Hi It's not possible to use foreach directly on an sset You'll need to convert the sset to a list first. For example: (vl-remove-if 'listp (mapcar 'cadr (ssnamex sset)))
    1 point
  3. @GLAVCVS @BIGAL thank you very much. Now I understand this topic. The EffectiveName (RO) for the dynamic block is set by the user, and the Name = "*U3" is assigned by the Autocad. Is it possible to ignore the Name in the code and execute the command for the selected blocks? This code shows the EffectiveName and Name of the selected dynamic block.: (defun c:BlockNames-Txt (/ ent obj inspt name effname dx dy) (vl-load-com) (if (setq ent (car (entsel "\nSelect a block: "))) (progn (setq obj (vlax-ename->vla-object ent)) (setq name (vla-get-Name obj)) (setq effname (vla-get-EffectiveName obj)) (setq inspt (vlax-get obj 'InsertionPoint)) ;; Text offset from the base point of the block (can be changed at will) (setq dx 20.0) (setq dy 20.0) (entmakex (list (cons 0 "TEXT") (cons 8 (getvar "CLAYER")) (cons 10 (list (+ (car inspt) dx) (+ (cadr inspt) dy) (caddr inspt))) (cons 40 2.5) (cons 1 (strcat "Name: " name)) ) ) (entmakex (list (cons 0 "TEXT") (cons 8 (getvar "CLAYER")) (cons 10 (list (+ (car inspt) dx) (+ (cadr inspt) (* 2 dy)) (caddr inspt))) (cons 40 2.5) (cons 1 (strcat "EffectiveName: " effname)) ) ) (princ (strcat "\nName: " name)) (princ (strcat "\nEffectiveName: " effname)) ) ) (princ) )
    1 point
  4. If you select a block you can get two things its effective name and the name of the block, as mentioned often a block name becomes *U23 but it has an effective name still. So the way around it is to over select using SSget with "INSERT" and check the blocks "Effective name" matches the first block picked. Using dumpit on a dynamic block 2 properties ; EffectiveName (RO) = "TA-WINDOW" ; Name = "*U308"
    1 point
  5. In Bricscad you can use Appload and save a custom lisp containing all your shortcuts, yes use Autoload within that lisp, for me I use custom lisps rather than play with the default lisps, this works for Autocad as well, Appload add to Start up suite. Just a side comment did a post yesterday about making a Install.lsp to do just that and it is possible to find what the load on start up currently are, then add a new one. (setq ver (vl-registry-read "HKEY_CURRENT_USER\\Software\\Bricsys\\BricsCAD" "CURVER")) (setq val (strcat "HKEY_CURRENT_USER\\Software\\Bricsys\\BricsCAD\\" ver "\\en_US\\Profiles\\Default\\Config")) (setq suppath (vl-registry-read val "SRCHPATH"))
    1 point
  6. @SLW210 just use the Multi radio buttons.lsp for the dcl. Just make sure Multi radio buttons.lsp is saved in a support path or add full path to the Load. (if (not AH:Butts)(load "Multi Radio buttons.lsp")) (setq ans (ah:butts 1 "v" '("please choose" "REGION" "HATCH" "LINE" "CIRCLE" "ARC" "LWPOLYLINE" "TEXT" "MTEXT" "SPLINE" "INSERT" "BLOCK"))) ; ans holds the button picked value Multi radio buttons.lsp
    1 point
  7. Then you will only have to change the references to the old blocks in the code for the new ones.
    1 point
  8. The most important of these conditions is that the place where the text is to be placed remains y+600 and that the name of the block that marks the base point is unique and different from the rest of the blocks.
    1 point
×
×
  • Create New...