Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/23/2019 in all areas

  1. Seems like a simple regen issue. Notice that the main function is not a command ('C:') function. I have renamed the main function and added an example of a command function: ; Blk can be a block name or the ename of a "BLOCK" entity. (defun KGA_BlockClassic_EffectiveName (blk / elst blkRecHnd) (setq elst (entget (if (= 'ename (type blk)) blk (tblobjname "block" blk))) ) (if (and (= "*" (substr (cdr (assoc 2 elst)) 1 1)) (setq blkRecHnd (cdr (assoc 1005 (cdadr (assoc -3 (entget (cdr (assoc 330 elst)) '("AcDbBlockRepBTag"))))))) ) (cdr (assoc 2 (entget (handent blkRecHnd)))) (cdr (assoc 2 elst)) ) ) ; (ChangeDynBlockColor (vla-get-name (vlax-ename->vla-object (car (entsel)))) (acad_colordlg 2)) (defun ChangeDynBlockColor (nme col / N_Mod blks i nmeLst) (defun N_Mod (blk) (vlax-for obj blk (if (and (= "AcDbBlockReference" (vla-get-objectname obj)) (not (vl-position (strcase (vla-get-effectivename obj)) nmeLst)) ) (setq nmeLst (append nmeLst (list (strcase (vla-get-effectivename obj))))) ; Append required. (vla-put-color obj col) ) ) ) (setq blks (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))) (setq nmeLst (list (strcase (KGA_BlockClassic_EffectiveName nme)))) (setq i 0) (while (< i (length nmeLst)) (setq nme (nth i nmeLst)) (vlax-for blk blks (if (= nme (strcase (KGA_BlockClassic_EffectiveName (vla-get-name blk)))) (N_Mod blk) ) ) (setq i (1+ i)) ) ) (defun c:Test ( / col doc enm obj) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-endundomark doc) (vla-startundomark doc) (if (and (setq enm (car (entsel))) (setq obj (vlax-ename->vla-object enm)) (= "AcDbBlockReference" (vla-get-objectname obj)) (setq col (acad_colordlg 2)) ) (progn (ChangeDynBlockColor (vla-get-name obj) col) (vla-regen doc acactiveviewport) ) ) (vla-endundomark doc) (princ) )
    1 point
  2. Hello, Finally the Electrical Cable Tray program is ready for all to use. https://autolispprograms.wordpress.com/cable-tray-program/
    1 point
  3. is asked before : have a block routine but some say it's rather complicated to drive so to spreak so I won't repost or refer to it , but the way my batch application works in case of mdi mode is to start a new drawing , save and close all open drawings and then reopen them and run all the scripts & commands I want. Totally dragon proof and totally don't care about the few seconds longer it takes compared to vba / odbx. if you do want to use the fast lane (not sure about dynamic blocks though) the way my block routine handles it is for each block get its properties (inspoint , rotation etc) and all the attribute values , then burn them all , sorry can't help m'self , then delete them all , purge block definition , and then re-insert them one by one and transfer attribute data.
    1 point
  4. This should get you started https://www.cadtutor.net/forum/topic/55445-center-text-in-box-from-entsel-to-ssget/ Steve
    1 point
  5. Check this program... (you have to be logged in...) https://www.theswamp.org/index.php?topic=48113.msg531626#msg531626 Regards, M.R.
    1 point
  6. I think you have misunderstood how the program operates: The 'tag' parameter allows you to specify a predefined attribute tag to house the output from the program - you should not modify the ssget filter which is used to obtain the input.
    1 point
  7. Hi there! Does anybody have the original lisp to -rename layers with use of wildcards in names, that Gilsoto13 modified to renaming blocks? I hope it could recognize wildcards to change layers too. Regular command line -rename unfortunately does not recognize wildcards... Best regards, mikitari
    1 point
×
×
  • Create New...